mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:56:05 +00:00
- Fixed line endings
- Updated regsvr32 to latest version by ShadowFlare. svn path=/trunk/; revision=8265
This commit is contained in:
parent
bb25722258
commit
e4340278d7
2 changed files with 947 additions and 954 deletions
|
@ -246,6 +246,14 @@ LPWSTR ConvertToWideChar(LPCSTR lpString)
|
||||||
#define FreeConvertedWideChar(lpwString) free(lpwString)
|
#define FreeConvertedWideChar(lpwString) free(lpwString)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void DisplayMessage(BOOL bConsole, BOOL bSilent, LPCTSTR lpMessage, LPCTSTR lpTitle, UINT uType)
|
||||||
|
{
|
||||||
|
if (!bSilent)
|
||||||
|
MessageBox(0,lpMessage,lpTitle,uType);
|
||||||
|
if (bConsole)
|
||||||
|
_tprintf(_T("%s: %s\n\n"),lpTitle,lpMessage);
|
||||||
|
}
|
||||||
|
|
||||||
int WINAPI WinMain(
|
int WINAPI WinMain(
|
||||||
HINSTANCE hInstance,
|
HINSTANCE hInstance,
|
||||||
HINSTANCE hPrevInstance,
|
HINSTANCE hPrevInstance,
|
||||||
|
@ -300,10 +308,11 @@ int WINAPI WinMain(
|
||||||
case _T('i'):
|
case _T('i'):
|
||||||
case _T('I'):
|
case _T('I'):
|
||||||
bInstall = TRUE;
|
bInstall = TRUE;
|
||||||
if (argv[i][2] == _T(':'))
|
lptDllCmdLine = argv[i];
|
||||||
lptDllCmdLine = argv[i]+3;
|
while (*lptDllCmdLine != 0 && *lptDllCmdLine != _T(':'))
|
||||||
else
|
lptDllCmdLine++;
|
||||||
lptDllCmdLine = _T("");
|
if (*lptDllCmdLine == _T(':'))
|
||||||
|
lptDllCmdLine++;
|
||||||
break;
|
break;
|
||||||
case _T('n'):
|
case _T('n'):
|
||||||
case _T('N'):
|
case _T('N'):
|
||||||
|
@ -321,37 +330,31 @@ int WINAPI WinMain(
|
||||||
|
|
||||||
// An unrecognized flag was used, display a message and show available options
|
// An unrecognized flag was used, display a message and show available options
|
||||||
if (lptFuncName) {
|
if (lptFuncName) {
|
||||||
if (!bSilent) {
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2 + _tcslen(InvalidFlag) - 2 + _tcslen(lptFuncName) + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2 + _tcslen(InvalidFlag) - 2 + _tcslen(lptFuncName) + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer + (_tcslen(UsageMessage) - 2),InvalidFlag,lptFuncName);
|
||||||
_stprintf(lptMsgBuffer + (_tcslen(UsageMessage) - 2),InvalidFlag,lptFuncName);
|
_stprintf(lptMsgBuffer,UsageMessage,lptMsgBuffer + (_tcslen(UsageMessage) - 2));
|
||||||
_stprintf(lptMsgBuffer,UsageMessage,lptMsgBuffer + (_tcslen(UsageMessage) - 2));
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
free(lptMsgBuffer);
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
|
||||||
GlobalFree(argv);
|
GlobalFree(argv);
|
||||||
return EXITCODE_PARAMERROR;
|
return EXITCODE_PARAMERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /n was used without /i, display a message and show available options
|
// /n was used without /i, display a message and show available options
|
||||||
if (bNoRegister && (!bInstall)) {
|
if (bNoRegister && (!bInstall)) {
|
||||||
if (!bSilent) {
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2 + _tcslen(SwitchN_NoI) + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2 + _tcslen(SwitchN_NoI) + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,UsageMessage,SwitchN_NoI);
|
||||||
_stprintf(lptMsgBuffer,UsageMessage,SwitchN_NoI);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
free(lptMsgBuffer);
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
|
||||||
GlobalFree(argv);
|
GlobalFree(argv);
|
||||||
return EXITCODE_PARAMERROR;
|
return EXITCODE_PARAMERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No dll was specified, display a message and show available options
|
// No dll was specified, display a message and show available options
|
||||||
if (nDllCount == 0) {
|
if (nDllCount == 0) {
|
||||||
if (!bSilent) {
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2 + _tcslen(NoDllSpecified) + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2 + _tcslen(NoDllSpecified) + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,UsageMessage,NoDllSpecified);
|
||||||
_stprintf(lptMsgBuffer,UsageMessage,NoDllSpecified);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
free(lptMsgBuffer);
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
|
||||||
GlobalFree(argv);
|
GlobalFree(argv);
|
||||||
return EXITCODE_PARAMERROR;
|
return EXITCODE_PARAMERROR;
|
||||||
}
|
}
|
||||||
|
@ -382,7 +385,7 @@ int WINAPI WinMain(
|
||||||
lptDllName = argv[i];
|
lptDllName = argv[i];
|
||||||
|
|
||||||
// Everything is all setup, so load the dll now
|
// Everything is all setup, so load the dll now
|
||||||
hDll = LoadLibrary(lptDllName);
|
hDll = LoadLibraryEx(lptDllName,0,LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||||
if (hDll) {
|
if (hDll) {
|
||||||
if (!bNoRegister) {
|
if (!bNoRegister) {
|
||||||
// Get the address of DllRegisterServer or DllUnregisterServer
|
// Get the address of DllRegisterServer or DllUnregisterServer
|
||||||
|
@ -390,33 +393,29 @@ int WINAPI WinMain(
|
||||||
if (fnDllRegister) {
|
if (fnDllRegister) {
|
||||||
// If the function exists, call it
|
// If the function exists, call it
|
||||||
hResult = fnDllRegister();
|
hResult = fnDllRegister();
|
||||||
if (!bSilent) {
|
if (hResult == S_OK) {
|
||||||
if (hResult == S_OK) {
|
// (Un)register succeeded, display a message
|
||||||
// (Un)register succeeded, display a message
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(SuccessMessage) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(SuccessMessage) - 4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,SuccessMessage,lptFuncName,lptDllName);
|
||||||
_stprintf(lptMsgBuffer,SuccessMessage,lptFuncName,lptDllName);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONINFORMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONINFORMATION);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// (Un)register failed, display a message
|
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(FailureMessage) + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
|
||||||
_stprintf(lptMsgBuffer,FailureMessage,lptFuncName,lptDllName,hResult);
|
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
|
||||||
}
|
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// (Un)register failed, display a message
|
||||||
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(FailureMessage) + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||||
|
_stprintf(lptMsgBuffer,FailureMessage,lptFuncName,lptDllName,hResult);
|
||||||
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
|
free(lptMsgBuffer);
|
||||||
if (hResult != S_OK)
|
if (hResult != S_OK)
|
||||||
nRetValue = EXITCODE_FAILURE;
|
nRetValue = EXITCODE_FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FreeLibrary(hDll);
|
FreeLibrary(hDll);
|
||||||
if (!bSilent) {
|
// Dll(Un)register was not found, display an error message
|
||||||
// Dll(Un)register was not found, display an error message
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(MissingEntry) - 8 + _tcslen(lptFuncName) * 2 + _tcslen(lptDllName) * 2 + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(MissingEntry) - 8 + _tcslen(lptFuncName) * 2 + _tcslen(lptDllName) * 2 + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,MissingEntry,lptDllName,lptFuncName,lptFuncName,lptDllName);
|
||||||
_stprintf(lptMsgBuffer,MissingEntry,lptDllName,lptFuncName,lptFuncName,lptDllName);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
free(lptMsgBuffer);
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
|
||||||
nRetValue = EXITCODE_NOENTRY;
|
nRetValue = EXITCODE_NOENTRY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,33 +429,29 @@ int WINAPI WinMain(
|
||||||
hResult = fnDllInstall(1,lpwDllCmdLine);
|
hResult = fnDllInstall(1,lpwDllCmdLine);
|
||||||
else
|
else
|
||||||
hResult = fnDllInstall(0,lpwDllCmdLine);
|
hResult = fnDllInstall(0,lpwDllCmdLine);
|
||||||
if (!bSilent) {
|
if (hResult == S_OK) {
|
||||||
if (hResult == S_OK) {
|
// (Un)install succeeded, display a message
|
||||||
// (Un)install succeeded, display a message
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(SuccessMessage) - 4 + _tcslen(tszDllInstall) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(SuccessMessage) - 4 + _tcslen(tszDllInstall) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,SuccessMessage,tszDllInstall,lptDllName);
|
||||||
_stprintf(lptMsgBuffer,SuccessMessage,tszDllInstall,lptDllName);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONINFORMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONINFORMATION);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// (Un)install failed, display a message
|
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(FailureMessage) + _tcslen(tszDllInstall) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
|
||||||
_stprintf(lptMsgBuffer,FailureMessage,tszDllInstall,lptDllName,hResult);
|
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
|
||||||
}
|
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// (Un)install failed, display a message
|
||||||
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(FailureMessage) + _tcslen(tszDllInstall) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||||
|
_stprintf(lptMsgBuffer,FailureMessage,tszDllInstall,lptDllName,hResult);
|
||||||
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
|
}
|
||||||
|
free(lptMsgBuffer);
|
||||||
if (hResult != S_OK)
|
if (hResult != S_OK)
|
||||||
nRetValue = EXITCODE_FAILURE;
|
nRetValue = EXITCODE_FAILURE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FreeLibrary(hDll);
|
FreeLibrary(hDll);
|
||||||
if (!bSilent) {
|
// DllInstall was not found, display an error message
|
||||||
// DllInstall was not found, display an error message
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(MissingEntry) - 8 + _tcslen(tszDllInstall) * 2 + _tcslen(lptDllName) * 2 + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(MissingEntry) - 8 + _tcslen(tszDllInstall) * 2 + _tcslen(lptDllName) * 2 + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,MissingEntry,lptDllName,tszDllInstall,tszDllInstall,lptDllName);
|
||||||
_stprintf(lptMsgBuffer,MissingEntry,lptDllName,tszDllInstall,tszDllInstall,lptDllName);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
free(lptMsgBuffer);
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
|
||||||
nRetValue = EXITCODE_NOENTRY;
|
nRetValue = EXITCODE_NOENTRY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,14 +460,12 @@ int WINAPI WinMain(
|
||||||
FreeLibrary(hDll);
|
FreeLibrary(hDll);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!bSilent) {
|
// The dll could not be loaded; display an error message
|
||||||
// The dll could not be loaded; display an error message
|
dwErr = GetLastError();
|
||||||
dwErr = GetLastError();
|
lptMsgBuffer = (LPTSTR)malloc((_tcslen(DllNotLoaded) + 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
||||||
lptMsgBuffer = (LPTSTR)malloc((_tcslen(DllNotLoaded) + 2 + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
|
_stprintf(lptMsgBuffer,DllNotLoaded,lptDllName,dwErr);
|
||||||
_stprintf(lptMsgBuffer,DllNotLoaded,lptDllName,dwErr);
|
DisplayMessage(bConsole,bSilent,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
||||||
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONEXCLAMATION);
|
free(lptMsgBuffer);
|
||||||
free(lptMsgBuffer);
|
|
||||||
}
|
|
||||||
nRetValue = EXITCODE_LOADERROR;
|
nRetValue = EXITCODE_LOADERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue