Commit 3858ea03 authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

regsvr32: Move silent check to the output_write function.

parent 412a4f13
...@@ -72,6 +72,8 @@ static void __cdecl output_write(UINT id, ...) ...@@ -72,6 +72,8 @@ static void __cdecl output_write(UINT id, ...)
char *str; char *str;
DWORD len, nOut, ret; DWORD len, nOut, ret;
if (Silent) return;
if (!LoadStringA(GetModuleHandleA(NULL), id, fmt, sizeof(fmt)/sizeof(fmt[0]))) if (!LoadStringA(GetModuleHandleA(NULL), id, fmt, sizeof(fmt)/sizeof(fmt[0])))
{ {
WINE_FIXME("LoadString failed with %d\n", GetLastError()); WINE_FIXME("LoadString failed with %d\n", GetLastError());
...@@ -112,16 +114,13 @@ static VOID *LoadProc(const char* strDll, const char* procName, HMODULE* DllHand ...@@ -112,16 +114,13 @@ static VOID *LoadProc(const char* strDll, const char* procName, HMODULE* DllHand
*DllHandle = LoadLibraryExA(strDll, 0, LOAD_WITH_ALTERED_SEARCH_PATH); *DllHandle = LoadLibraryExA(strDll, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
if(!*DllHandle) if(!*DllHandle)
{ {
if(!Silent) output_write(STRING_DLL_LOAD_FAILED, strDll);
output_write(STRING_DLL_LOAD_FAILED, strDll);
ExitProcess(1); ExitProcess(1);
} }
proc = (VOID *) GetProcAddress(*DllHandle, procName); proc = (VOID *) GetProcAddress(*DllHandle, procName);
if(!proc) if(!proc)
{ {
if(!Silent) output_write(STRING_PROC_NOT_IMPLEMENTED, procName, strDll);
output_write(STRING_PROC_NOT_IMPLEMENTED, procName, strDll);
FreeLibrary(*DllHandle); FreeLibrary(*DllHandle);
return NULL; return NULL;
} }
...@@ -141,13 +140,10 @@ static int RegisterDll(const char* strDll) ...@@ -141,13 +140,10 @@ static int RegisterDll(const char* strDll)
hr = pfRegister(); hr = pfRegister();
if(FAILED(hr)) if(FAILED(hr))
{ {
if(!Silent) output_write(STRING_REGISTER_FAILED, strDll);
output_write(STRING_REGISTER_FAILED, strDll);
return -1; return -1;
} }
if(!Silent) output_write(STRING_REGISTER_SUCCESSFUL, strDll);
output_write(STRING_REGISTER_SUCCESSFUL, strDll);
if(DllHandle) if(DllHandle)
FreeLibrary(DllHandle); FreeLibrary(DllHandle);
...@@ -167,13 +163,10 @@ static int UnregisterDll(char* strDll) ...@@ -167,13 +163,10 @@ static int UnregisterDll(char* strDll)
hr = pfUnregister(); hr = pfUnregister();
if(FAILED(hr)) if(FAILED(hr))
{ {
if(!Silent) output_write(STRING_UNREGISTER_FAILED, strDll);
output_write(STRING_UNREGISTER_FAILED, strDll);
return -1; return -1;
} }
if(!Silent) output_write(STRING_UNREGISTER_SUCCESSFUL, strDll);
output_write(STRING_UNREGISTER_SUCCESSFUL, strDll);
if(DllHandle) if(DllHandle)
FreeLibrary(DllHandle); FreeLibrary(DllHandle);
...@@ -193,22 +186,16 @@ static int InstallDll(BOOL install, char *strDll, WCHAR *command_line) ...@@ -193,22 +186,16 @@ static int InstallDll(BOOL install, char *strDll, WCHAR *command_line)
hr = pfInstall(install, command_line); hr = pfInstall(install, command_line);
if(FAILED(hr)) if(FAILED(hr))
{ {
if(!Silent)
{
if (install)
output_write(STRING_INSTALL_FAILED, strDll);
else
output_write(STRING_UNINSTALL_FAILED, strDll);
}
return -1;
}
if(!Silent)
{
if (install) if (install)
output_write(STRING_INSTALL_SUCCESSFUL, strDll); output_write(STRING_INSTALL_FAILED, strDll);
else else
output_write(STRING_UNINSTALL_SUCCESSFUL, strDll); output_write(STRING_UNINSTALL_FAILED, strDll);
return -1;
} }
if (install)
output_write(STRING_INSTALL_SUCCESSFUL, strDll);
else
output_write(STRING_UNINSTALL_SUCCESSFUL, strDll);
if(DllHandle) if(DllHandle)
FreeLibrary(DllHandle); FreeLibrary(DllHandle);
...@@ -320,11 +307,8 @@ int main(int argc, char* argv[]) ...@@ -320,11 +307,8 @@ int main(int argc, char* argv[])
if (!DllFound) if (!DllFound)
{ {
if(!Silent) output_write(STRING_HEADER);
{ output_write(STRING_USAGE);
output_write(STRING_HEADER);
output_write(STRING_USAGE);
}
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment