Commit 799dfa6a authored by Pierre Schweitzer's avatar Pierre Schweitzer Committed by Alexandre Julliard

setupapi: Implement SetupOpenLog(), SetupCloseLog().

parent d2751ebc
...@@ -42,6 +42,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); ...@@ -42,6 +42,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
/* arbitrary limit not related to what native actually uses */ /* arbitrary limit not related to what native actually uses */
#define OEM_INDEX_LIMIT 999 #define OEM_INDEX_LIMIT 999
/* Handles and critical sections for the SetupLog API */
static HANDLE setupact = INVALID_HANDLE_VALUE;
static HANDLE setuperr = INVALID_HANDLE_VALUE;
static CRITICAL_SECTION setupapi_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &setupapi_cs,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": setupapi_cs") }
};
static CRITICAL_SECTION setupapi_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
/************************************************************************** /**************************************************************************
* MyFree [SETUPAPI.@] * MyFree [SETUPAPI.@]
* *
...@@ -1600,3 +1612,70 @@ BOOL WINAPI SetupSetNonInteractiveMode( BOOL flag ) ...@@ -1600,3 +1612,70 @@ BOOL WINAPI SetupSetNonInteractiveMode( BOOL flag )
non_interactive_mode = flag; non_interactive_mode = flag;
return ret; return ret;
} }
/***********************************************************************
* SetupCloseLog(SETUPAPI.@)
*/
void WINAPI SetupCloseLog(void)
{
EnterCriticalSection(&setupapi_cs);
CloseHandle(setupact);
setupact = INVALID_HANDLE_VALUE;
CloseHandle(setuperr);
setuperr = INVALID_HANDLE_VALUE;
LeaveCriticalSection(&setupapi_cs);
}
/***********************************************************************
* SetupOpenLog(SETUPAPI.@)
*/
BOOL WINAPI SetupOpenLog(BOOL reserved)
{
WCHAR path[MAX_PATH];
static const WCHAR setupactlog[] = {'\\','s','e','t','u','p','a','c','t','.','l','o','g',0};
static const WCHAR setuperrlog[] = {'\\','s','e','t','u','p','e','r','r','.','l','o','g',0};
EnterCriticalSection(&setupapi_cs);
if (setupact != INVALID_HANDLE_VALUE && setuperr != INVALID_HANDLE_VALUE)
{
LeaveCriticalSection(&setupapi_cs);
return TRUE;
}
GetWindowsDirectoryW(path, MAX_PATH);
lstrcatW(path, setupactlog);
setupact = CreateFileW(path, FILE_GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (setupact == INVALID_HANDLE_VALUE)
{
LeaveCriticalSection(&setupapi_cs);
return FALSE;
}
SetFilePointer(setupact, 0, NULL, FILE_END);
GetWindowsDirectoryW(path, MAX_PATH);
lstrcatW(path, setuperrlog);
setuperr = CreateFileW(path, FILE_GENERIC_WRITE, FILE_SHARE_WRITE | FILE_SHARE_READ,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (setuperr == INVALID_HANDLE_VALUE)
{
CloseHandle(setupact);
setupact = INVALID_HANDLE_VALUE;
LeaveCriticalSection(&setupapi_cs);
return FALSE;
}
SetFilePointer(setuperr, 0, NULL, FILE_END);
LeaveCriticalSection(&setupapi_cs);
return TRUE;
}
...@@ -694,6 +694,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -694,6 +694,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (lpvReserved) break; if (lpvReserved) break;
SetupCloseLog();
if (CABINET_hInstance) FreeLibrary(CABINET_hInstance); if (CABINET_hInstance) FreeLibrary(CABINET_hInstance);
break; break;
} }
......
...@@ -189,14 +189,6 @@ BOOL WINAPI RegistryDelnode(DWORD x, DWORD y) ...@@ -189,14 +189,6 @@ BOOL WINAPI RegistryDelnode(DWORD x, DWORD y)
} }
/*********************************************************************** /***********************************************************************
* SetupCloseLog(SETUPAPI.@)
*/
void WINAPI SetupCloseLog(void)
{
FIXME("() stub\n");
}
/***********************************************************************
* SetupLogErrorW(SETUPAPI.@) * SetupLogErrorW(SETUPAPI.@)
*/ */
BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity) BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity)
...@@ -206,15 +198,6 @@ BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity) ...@@ -206,15 +198,6 @@ BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity)
} }
/*********************************************************************** /***********************************************************************
* SetupOpenLog(SETUPAPI.@)
*/
BOOL WINAPI SetupOpenLog(BOOL Reserved)
{
FIXME("(%d) stub\n", Reserved);
return TRUE;
}
/***********************************************************************
* SetupPromptReboot(SETUPAPI.@) * SetupPromptReboot(SETUPAPI.@)
*/ */
INT WINAPI SetupPromptReboot( HSPFILEQ file_queue, HWND owner, BOOL scan_only ) INT WINAPI SetupPromptReboot( HSPFILEQ file_queue, HWND owner, BOOL scan_only )
......
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