-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cc5e172
Showing
66 changed files
with
4,954 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TODO: | ||
<< add your help here >> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[MSILoader] | ||
MSIFileName=WPKGSetup.msi |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
setup /i PATH=PATH FILE=FILE PATHUSER=PATHUSER PATHPASSWORD=PATHPASSWORD EXECUSER=EXECUSER EXECPASSWORD=EXECPASSWORD PARAMETERS=PARAMETERS SILENT=NO | ||
SCRIPTVARNAME1=TOMEK SCRIPTVARVALUE1=EXAMPLEVARIALBE | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "StdAfx.h" | ||
#include ".\exceptionex.h" | ||
|
||
IMPLEMENT_DYNAMIC(CExceptionEx, CException) | ||
|
||
CExceptionEx::CExceptionEx(void) | ||
{ | ||
m_dwError = 0; | ||
} | ||
|
||
|
||
CExceptionEx::~CExceptionEx(void) | ||
{ | ||
} | ||
|
||
|
||
|
||
BOOL CExceptionEx::GetErrorMessage(LPTSTR lpszError, UINT nMaxError, | ||
PUINT pnHelpContext) | ||
{ | ||
ASSERT(lpszError != NULL && AfxIsValidString(lpszError, nMaxError)); | ||
|
||
if (lpszError == NULL || nMaxError == 0) | ||
{ | ||
return FALSE; | ||
} | ||
|
||
if (pnHelpContext != NULL) | ||
*pnHelpContext = 0; | ||
|
||
lstrcpyn(lpszError, m_strMessage, nMaxError); | ||
|
||
return TRUE; | ||
} | ||
|
||
void CExceptionEx::FormatMessage(DWORD dwErrorCode) | ||
{ | ||
CHAR szProvider[256]; | ||
m_strMessage = _T("Unknown error occured."); | ||
|
||
if (dwErrorCode != ERROR_EXTENDED_ERROR) | ||
{ | ||
::FormatMessage( | ||
FORMAT_MESSAGE_FROM_SYSTEM, | ||
NULL, | ||
dwErrorCode, | ||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language | ||
(LPTSTR) m_strMessage.GetBufferSetLength(1025), | ||
1024, | ||
NULL ); | ||
} | ||
else | ||
{ | ||
WNetGetLastError(&dwErrorCode, // error code | ||
(LPSTR) m_strMessage.GetBufferSetLength(1025), | ||
// buffer for error description | ||
1024, // size of error buffer | ||
(LPSTR) szProvider, // buffer for provider name | ||
sizeof(szProvider)); // size of name buffer | ||
|
||
} | ||
|
||
m_strMessage.ReleaseBuffer(); | ||
m_strMessage.Replace("\r\n",""); | ||
|
||
} | ||
|
||
|
||
void CExceptionEx::ThrowError(DWORD Error) | ||
{ | ||
CExceptionEx* exception = new CExceptionEx(); | ||
exception->FormatMessage(Error); | ||
exception->m_dwError = Error; | ||
throw exception; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
#include "afx.h" | ||
|
||
class CExceptionEx : | ||
public CException | ||
{ | ||
DECLARE_DYNAMIC(CExceptionEx) | ||
private: | ||
void FormatMessage(DWORD dwErrorCode); | ||
|
||
public: | ||
CString m_strMessage; | ||
DWORD m_dwError; | ||
CExceptionEx(void); | ||
virtual ~CExceptionEx(void); | ||
virtual BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, | ||
PUINT pnHelpContext = NULL); | ||
|
||
static void PASCAL ThrowError(DWORD Error); | ||
|
||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#include "StdAfx.h" | ||
#include ".\netconnection.h" | ||
#include "exceptionex.h" | ||
|
||
CNetConnection::CNetConnection(void) | ||
{ | ||
m_bSilent = TRUE; | ||
} | ||
|
||
CNetConnection::~CNetConnection(void) | ||
{ | ||
} | ||
|
||
DWORD CNetConnection::DisconnectFromServer(CString RemotePath) | ||
{ | ||
HANDLE hEnum; | ||
DWORD counter=0xFFFFFFFF; | ||
BYTE buffer[1024*16]; | ||
DWORD size=1024*16; | ||
|
||
|
||
DWORD error = WNetOpenEnum( | ||
RESOURCE_CONNECTED, | ||
RESOURCETYPE_ANY, | ||
0, | ||
0, | ||
&hEnum); | ||
|
||
error = WNetEnumResource( | ||
hEnum, | ||
&counter, | ||
buffer, | ||
&size); | ||
|
||
WNetCloseEnum(hEnum); | ||
|
||
NETRESOURCE* nrb=(NETRESOURCE*)buffer; | ||
CString str; | ||
CString Server; | ||
|
||
// find in path server name | ||
int pos = RemotePath.Find('\\',2); | ||
if(pos!=-1) | ||
Server = RemotePath.Left(pos); | ||
|
||
|
||
|
||
for( DWORD i=0; i<counter; i++ ) | ||
{ | ||
str.Empty(); | ||
str=nrb[i].lpRemoteName; | ||
// our server? - yes: disconnect from here | ||
if( Server.CompareNoCase( str.Left( Server.GetLength() ) ) != 0 ) | ||
continue; | ||
if( nrb[i].lpLocalName ) | ||
{ | ||
error = WNetCancelConnection2( nrb[i].lpLocalName,0,1); | ||
} | ||
error = WNetCancelConnection2( str,0,1); | ||
|
||
} | ||
|
||
return error; | ||
} | ||
|
||
|
||
void CNetConnection::NetErrorHandler( DWORD dwErrorCode ) | ||
{ | ||
DWORD dwLastError; | ||
char lpMsgBuf[1024]="Unknown error."; | ||
CHAR szProvider[256]; | ||
|
||
if (dwErrorCode != ERROR_EXTENDED_ERROR) | ||
{ | ||
FormatMessage( | ||
FORMAT_MESSAGE_FROM_SYSTEM, | ||
NULL, | ||
dwErrorCode, | ||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language | ||
(LPTSTR) &lpMsgBuf, | ||
1024, | ||
NULL ); | ||
|
||
} | ||
else | ||
{ | ||
WNetGetLastError(&dwLastError, // error code | ||
(LPSTR) lpMsgBuf, // buffer for error description | ||
sizeof(lpMsgBuf), // size of error buffer | ||
(LPSTR) szProvider, // buffer for provider name | ||
sizeof(szProvider)); // size of name buffer | ||
|
||
|
||
|
||
} | ||
|
||
if( m_bSilent ) | ||
{ | ||
} | ||
else | ||
AfxMessageBox(lpMsgBuf); | ||
|
||
} | ||
|
||
void CNetConnection::AddConnection(CString RemotePath, CString user, | ||
CString password) | ||
{ | ||
|
||
// disconnect - closing files | ||
DWORD Error = DisconnectFromServer(RemotePath); | ||
|
||
NETRESOURCE nr; | ||
nr.dwType = RESOURCETYPE_ANY; | ||
nr.lpLocalName = NULL ; | ||
nr.lpRemoteName = RemotePath.GetBuffer(); | ||
nr.lpProvider = NULL; | ||
|
||
|
||
Error = WNetAddConnection2( &nr, | ||
password, | ||
user, | ||
0); | ||
|
||
|
||
if( Error != 0 && Error != ERROR_ALREADY_ASSIGNED ) | ||
CExceptionEx::ThrowError(Error); | ||
|
||
} | ||
|
||
void CNetConnection::Disconnect(CString RemotePath) | ||
{ | ||
WNetCancelConnection2( RemotePath,0,1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#pragma once | ||
|
||
class CNetConnection | ||
{ | ||
public: | ||
BOOL m_bSilent; | ||
CNetConnection(void); | ||
virtual ~CNetConnection(void); | ||
DWORD DisconnectFromServer(CString RemotePath); | ||
void AddConnection(CString RemotePath, CString user, | ||
CString password); | ||
void NetErrorHandler( DWORD dwErrorCode ); | ||
|
||
void Disconnect(CString RemotePath); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include "StdAfx.h" | ||
#include ".\parameters.h" | ||
|
||
CParameters::CParameters(void) | ||
{ | ||
m_strParDelimiter = "--"; | ||
m_strValDelimiter = '='; | ||
} | ||
|
||
CParameters::~CParameters(void) | ||
{ | ||
} | ||
|
||
void CParameters::SetCommandLine(CString command) | ||
{ | ||
m_strCommandLine = command; | ||
} | ||
|
||
void CParameters::Compute(void) | ||
{ | ||
int pos = 0; | ||
int tempPos; | ||
CString str; | ||
m_array.RemoveAll(); | ||
//m_strCommandLine.Remove(' '); | ||
|
||
while(pos > -1) | ||
{ | ||
tempPos = pos; | ||
pos = m_strCommandLine.Find(m_strParDelimiter,pos+m_strParDelimiter.GetLength()); | ||
if(pos==-1) | ||
str = m_strCommandLine.Mid(tempPos+m_strParDelimiter.GetLength()); | ||
else | ||
str = m_strCommandLine.Mid(tempPos+m_strParDelimiter.GetLength(),pos-tempPos-m_strParDelimiter.GetLength()); | ||
|
||
m_array.Add(str); | ||
} | ||
|
||
|
||
} | ||
|
||
|
||
CString CParameters::GetParameter(CString paramName) | ||
{ | ||
CString strResult; | ||
CString line; | ||
for(int i=0; i<m_array.GetSize(); i++) | ||
{ | ||
line = m_array.GetAt(i); | ||
if(GetName(line).CompareNoCase(paramName)==0) | ||
{ | ||
strResult = GetValue(line); | ||
break; | ||
} | ||
|
||
} | ||
return strResult; | ||
} | ||
|
||
CString CParameters::GetValue(CString& line) | ||
{ | ||
CString strResult; | ||
int pos = line.Find(m_strValDelimiter); | ||
strResult = line.Mid(pos+m_strValDelimiter.GetLength()); | ||
strResult.Trim(); | ||
return strResult; | ||
|
||
} | ||
|
||
CString CParameters::GetName(CString& line) | ||
{ | ||
int pos = line.Find(m_strValDelimiter); | ||
return line.Left(pos); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
|
||
class CParameters | ||
{ | ||
private: | ||
CString m_strCommandLine; | ||
CString m_strParDelimiter; | ||
CString m_strValDelimiter; | ||
CStringArray m_array; | ||
protected: | ||
virtual CString GetValue(CString& line); | ||
virtual CString GetName(CString& line); | ||
|
||
public: | ||
CParameters(void); | ||
virtual ~CParameters(void); | ||
void SetCommandLine(CString command); | ||
void Compute(void); | ||
CString GetParameter(CString paramName); | ||
|
||
}; |
Oops, something went wrong.