Implement AssertFail and GetSetFileTimestamp.
Modified: trunk/reactos/include/wine/setupapi.h
Modified: trunk/reactos/lib/setupapi/misc.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/lib/setupapi/setupapi_private.h
Modified: trunk/reactos/lib/setupapi/setupcab.c

Modified: trunk/reactos/include/wine/setupapi.h
--- trunk/reactos/include/wine/setupapi.h	2005-05-07 15:19:33 UTC (rev 15079)
+++ trunk/reactos/include/wine/setupapi.h	2005-05-07 15:22:32 UTC (rev 15080)
@@ -666,6 +666,7 @@
 
 
 LONG     WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3);
+VOID     WINAPI AssertFail(LPSTR, UINT, LPSTR);
 DWORD    WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
 DWORD    WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
 BOOL     WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName);
@@ -673,6 +674,7 @@
 PWSTR    WINAPI DuplicateString(PCWSTR lpSrc);
 BOOL     WINAPI EnablePrivilege(PCWSTR lpPrivilegeName, BOOL bEnable);
 BOOL     WINAPI FileExists(PCWSTR lpFileName, PWIN32_FIND_DATAW lpFileFindData);
+DWORD    WINAPI GetSetFileTimestamp(PCWSTR, PFILETIME, PFILETIME, PFILETIME, BOOLEAN);
 void     WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, PCSTR cmdline, INT show );
 void     WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, PCWSTR cmdline, INT show );
 #define         InstallHinfSection WINELIB_NAME_AW(InstallHinfSection)

Modified: trunk/reactos/lib/setupapi/misc.c
--- trunk/reactos/lib/setupapi/misc.c	2005-05-07 15:19:33 UTC (rev 15079)
+++ trunk/reactos/lib/setupapi/misc.c	2005-05-07 15:22:32 UTC (rev 15080)
@@ -802,6 +802,8 @@
     DWORD dwSize = 0x100;
     DWORD dwError;
 
+    TRACE("%s %p\n", debugstr_w(lpFileName), pSecurityDescriptor);
+
     SecDesc = (PSECURITY_DESCRIPTOR)MyMalloc(dwSize);
     if (SecDesc == NULL)
         return ERROR_NOT_ENOUGH_MEMORY;
@@ -838,3 +840,97 @@
 
     return dwError;
 }
+
+
+/**************************************************************************
+ * AssertFail [SETUPAPI.@]
+ *
+ * Display an assertion message.
+ *
+ * PARAMS
+ *     lpFile    [I] File name
+ *     uLine     [I] Line number
+ *     lpMessage [I] Assertion message
+ *
+ * RETURNS
+ *     Nothing
+ */
+VOID WINAPI AssertFail(LPSTR lpFile, UINT uLine, LPSTR lpMessage)
+{
+    CHAR szModule[MAX_PATH];
+    CHAR szBuffer[2048];
+    LPSTR lpName;
+    LPSTR lpBuffer;
+
+    TRACE("%s %u %s\n", lpFile, uLine, lpMessage);
+
+    GetModuleFileNameA(hInstance, szModule, MAX_PATH);
+    lpName = strrchr(szModule, '\\');
+    if (lpName != NULL)
+        lpName++;
+    else
+        lpName = szModule;
+
+    wsprintfA(szBuffer,
+              "Assertion failure at line %u in file %s: %s\n\nCall DebugBreak()?",
+              uLine, lpFile, lpMessage);
+
+    if (MessageBoxA(NULL, szBuffer, lpName, MB_SETFOREGROUND |
+                    MB_TASKMODAL | MB_ICONERROR | MB_YESNO) == IDYES)
+        DebugBreak();
+}
+
+
+/**************************************************************************
+ * GetSetFileTimestamp [SETUPAPI.@]
+ *
+ * Gets or sets a files timestamp.
+ *
+ * PARAMS
+ *     lpFileName       [I]   File name
+ *     lpCreationTime   [I/O] Creation time
+ *     lpLastAccessTime [I/O] Last access time
+ *     lpLastWriteTime  [I/O] Last write time
+ *     bSetFileTime     [I]   TRUE: Set file times
+ *                            FALSE: Get file times
+ *
+ * RETURNS
+ *     Success: ERROR_SUCCESS
+ *     Failure: other
+ */
+DWORD WINAPI GetSetFileTimestamp(LPCWSTR lpFileName,
+                                 LPFILETIME lpCreationTime,
+                                 LPFILETIME lpLastAccessTime,
+                                 LPFILETIME lpLastWriteTime,
+                                 BOOLEAN bSetFileTime)
+{
+    HANDLE hFile;
+    BOOLEAN bRet;
+    DWORD dwError = ERROR_SUCCESS;
+
+    TRACE("%s %p %p %p %x\n", debugstr_w(lpFileName), lpCreationTime,
+          lpLastAccessTime, lpLastWriteTime, bSetFileTime);
+
+    hFile = CreateFileW(lpFileName,
+                        bSetFileTime ? GENERIC_WRITE : GENERIC_READ,
+                        FILE_SHARE_READ | FILE_SHARE_WRITE,
+                        NULL,
+                        OPEN_EXISTING,
+                        0,
+                        NULL);
+
+    if (hFile == INVALID_HANDLE_VALUE)
+        return GetLastError();
+
+    if (bSetFileTime)
+        bRet = SetFileTime(hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime);
+    else
+        bRet = GetFileTime(hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime);
+
+    if (bRet == FALSE)
+        dwError = GetLastError();
+
+     CloseHandle(hFile);
+
+     return dwError;
+}

Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec	2005-05-07 15:19:33 UTC (rev 15079)
+++ trunk/reactos/lib/setupapi/setupapi.spec	2005-05-07 15:22:32 UTC (rev 15080)
@@ -2,7 +2,7 @@
 @ stub AddMiniIconToList
 @ stub AddTagToGroupOrderListEntry
 @ stub AppendStringToMultiSz
-@ stub AssertFail
+@ stdcall AssertFail(str long str)
 @ stub CMP_Init_Detection
 @ stub CMP_RegisterNotification
 @ stub CMP_Report_LogOn
@@ -205,7 +205,7 @@
 @ stub FreeStringArray
 @ stub GetCurrentDriverSigningPolicy
 @ stub GetNewInfName
-@ stub GetSetFileTimestamp
+@ stdcall GetSetFileTimestamp(wstr ptr ptr ptr long)
 @ stub GetVersionInfoFromImage
 @ stub InfIsFromOemLocation
 @ stub InstallCatalog
@@ -525,6 +525,7 @@
 @ stub StringTableLookUpStringEx
 @ stub StringTableSetExtraData
 @ stub StringTableStringFromId
+@ stub StringTableStringFromIdEx
 @ stub StringTableTrim
 @ stdcall TakeOwnershipOfFile(wstr)
 @ stdcall UnicodeToMultiByte(wstr long)

Modified: trunk/reactos/lib/setupapi/setupapi_private.h
--- trunk/reactos/lib/setupapi/setupapi_private.h	2005-05-07 15:19:33 UTC (rev 15079)
+++ trunk/reactos/lib/setupapi/setupapi_private.h	2005-05-07 15:22:32 UTC (rev 15080)
@@ -54,6 +54,7 @@
 #define _S_IWRITE 0x0080
 #define _S_IREAD  0x0100
 
+extern HINSTANCE hInstance;
 extern OSVERSIONINFOW OsVersionInfo;
 
 DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst);

Modified: trunk/reactos/lib/setupapi/setupcab.c
--- trunk/reactos/lib/setupapi/setupcab.c	2005-05-07 15:19:33 UTC (rev 15079)
+++ trunk/reactos/lib/setupapi/setupcab.c	2005-05-07 15:22:32 UTC (rev 15080)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Setupapi cabinet routines
  *
  * Copyright 2003 Gregory M. Turner
@@ -20,7 +20,7 @@
  *
  * Many useful traces are commented in code, uncomment them if you have
  * trouble and run with WINEDEBUG=+setupapi
- * 
+ *
  */
 
 #include <stdarg.h>
@@ -44,6 +44,7 @@
 
 #include "wine/debug.h"
 
+HINSTANCE hInstance = 0;
 OSVERSIONINFOW OsVersionInfo;
 
 static HINSTANCE CABINET_hInstance = 0;
@@ -544,7 +545,7 @@
   TRACE("(CabinetFile == %s, Reserved == %lu, MsgHandler == ^%p, Context == ^%p)\n",
         debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
 
-  if (! LoadCABINETDll()) 
+  if (! LoadCABINETDll())
     return FALSE;
 
   memset(&my_hsc, 0, sizeof(SC_HSC_A));
@@ -677,6 +678,7 @@
         OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
         if (!GetVersionExW(&OsVersionInfo))
             return FALSE;
+        hInstance = (HINSTANCE)hinstDLL;
         break;
     case DLL_PROCESS_DETACH:
         UnloadCABINETDll();