setupapi: Implement SetupOpenLog(), SetupCloseLog().

This commit is contained in:
Pierre Schweitzer 2015-03-25 21:12:35 +01:00 committed by Alexandre Julliard
parent d2751ebcd5
commit 799dfa6ada
3 changed files with 80 additions and 17 deletions

View File

@ -42,6 +42,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
/* arbitrary limit not related to what native actually uses */
#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.@]
*
@ -1600,3 +1612,70 @@ BOOL WINAPI SetupSetNonInteractiveMode( BOOL flag )
non_interactive_mode = flag;
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;
}

View File

@ -694,6 +694,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
break;
case DLL_PROCESS_DETACH:
if (lpvReserved) break;
SetupCloseLog();
if (CABINET_hInstance) FreeLibrary(CABINET_hInstance);
break;
}

View File

@ -188,14 +188,6 @@ BOOL WINAPI RegistryDelnode(DWORD x, DWORD y)
return FALSE;
}
/***********************************************************************
* SetupCloseLog(SETUPAPI.@)
*/
void WINAPI SetupCloseLog(void)
{
FIXME("() stub\n");
}
/***********************************************************************
* SetupLogErrorW(SETUPAPI.@)
*/
@ -205,15 +197,6 @@ BOOL WINAPI SetupLogErrorW(LPCWSTR MessageString, LogSeverity Severity)
return TRUE;
}
/***********************************************************************
* SetupOpenLog(SETUPAPI.@)
*/
BOOL WINAPI SetupOpenLog(BOOL Reserved)
{
FIXME("(%d) stub\n", Reserved);
return TRUE;
}
/***********************************************************************
* SetupPromptReboot(SETUPAPI.@)
*/