Implement AssertFail and GetSetFileTimestamp.

svn path=/trunk/; revision=15080
This commit is contained in:
Eric Kohl 2005-05-07 15:22:32 +00:00
parent 0abe7f6039
commit 104e05622a
5 changed files with 107 additions and 5 deletions

View file

@ -666,6 +666,7 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PFILEPATHS)
LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3); LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3);
VOID WINAPI AssertFail(LPSTR, UINT, LPSTR);
DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst); DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
DWORD WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst); DWORD WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
BOOL WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName); BOOL WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName);
@ -673,6 +674,7 @@ BOOL WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName);
PWSTR WINAPI DuplicateString(PCWSTR lpSrc); PWSTR WINAPI DuplicateString(PCWSTR lpSrc);
BOOL WINAPI EnablePrivilege(PCWSTR lpPrivilegeName, BOOL bEnable); BOOL WINAPI EnablePrivilege(PCWSTR lpPrivilegeName, BOOL bEnable);
BOOL WINAPI FileExists(PCWSTR lpFileName, PWIN32_FIND_DATAW lpFileFindData); 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 InstallHinfSectionA( HWND hwnd, HINSTANCE handle, PCSTR cmdline, INT show );
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, PCWSTR cmdline, INT show ); void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, PCWSTR cmdline, INT show );
#define InstallHinfSection WINELIB_NAME_AW(InstallHinfSection) #define InstallHinfSection WINELIB_NAME_AW(InstallHinfSection)

View file

@ -802,6 +802,8 @@ DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
DWORD dwSize = 0x100; DWORD dwSize = 0x100;
DWORD dwError; DWORD dwError;
TRACE("%s %p\n", debugstr_w(lpFileName), pSecurityDescriptor);
SecDesc = (PSECURITY_DESCRIPTOR)MyMalloc(dwSize); SecDesc = (PSECURITY_DESCRIPTOR)MyMalloc(dwSize);
if (SecDesc == NULL) if (SecDesc == NULL)
return ERROR_NOT_ENOUGH_MEMORY; return ERROR_NOT_ENOUGH_MEMORY;
@ -838,3 +840,97 @@ DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
return dwError; 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;
}

View file

@ -2,7 +2,7 @@
@ stub AddMiniIconToList @ stub AddMiniIconToList
@ stub AddTagToGroupOrderListEntry @ stub AddTagToGroupOrderListEntry
@ stub AppendStringToMultiSz @ stub AppendStringToMultiSz
@ stub AssertFail @ stdcall AssertFail(str long str)
@ stub CMP_Init_Detection @ stub CMP_Init_Detection
@ stub CMP_RegisterNotification @ stub CMP_RegisterNotification
@ stub CMP_Report_LogOn @ stub CMP_Report_LogOn
@ -205,7 +205,7 @@
@ stub FreeStringArray @ stub FreeStringArray
@ stub GetCurrentDriverSigningPolicy @ stub GetCurrentDriverSigningPolicy
@ stub GetNewInfName @ stub GetNewInfName
@ stub GetSetFileTimestamp @ stdcall GetSetFileTimestamp(wstr ptr ptr ptr long)
@ stub GetVersionInfoFromImage @ stub GetVersionInfoFromImage
@ stub InfIsFromOemLocation @ stub InfIsFromOemLocation
@ stub InstallCatalog @ stub InstallCatalog
@ -525,6 +525,7 @@
@ stub StringTableLookUpStringEx @ stub StringTableLookUpStringEx
@ stub StringTableSetExtraData @ stub StringTableSetExtraData
@ stub StringTableStringFromId @ stub StringTableStringFromId
@ stub StringTableStringFromIdEx
@ stub StringTableTrim @ stub StringTableTrim
@ stdcall TakeOwnershipOfFile(wstr) @ stdcall TakeOwnershipOfFile(wstr)
@ stdcall UnicodeToMultiByte(wstr long) @ stdcall UnicodeToMultiByte(wstr long)

View file

@ -54,6 +54,7 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, U
#define _S_IWRITE 0x0080 #define _S_IWRITE 0x0080
#define _S_IREAD 0x0100 #define _S_IREAD 0x0100
extern HINSTANCE hInstance;
extern OSVERSIONINFOW OsVersionInfo; extern OSVERSIONINFOW OsVersionInfo;
DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst); DWORD WINAPI CaptureAndConvertAnsiArg(LPCSTR pSrc, LPWSTR *pDst);

View file

@ -1,4 +1,4 @@
/* /*
* Setupapi cabinet routines * Setupapi cabinet routines
* *
* Copyright 2003 Gregory M. Turner * Copyright 2003 Gregory M. Turner
@ -20,7 +20,7 @@
* *
* Many useful traces are commented in code, uncomment them if you have * Many useful traces are commented in code, uncomment them if you have
* trouble and run with WINEDEBUG=+setupapi * trouble and run with WINEDEBUG=+setupapi
* *
*/ */
#include <stdarg.h> #include <stdarg.h>
@ -44,6 +44,7 @@
#include "wine/debug.h" #include "wine/debug.h"
HINSTANCE hInstance = 0;
OSVERSIONINFOW OsVersionInfo; OSVERSIONINFOW OsVersionInfo;
static HINSTANCE CABINET_hInstance = 0; static HINSTANCE CABINET_hInstance = 0;
@ -544,7 +545,7 @@ BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved,
TRACE("(CabinetFile == %s, Reserved == %lu, MsgHandler == ^%p, Context == ^%p)\n", TRACE("(CabinetFile == %s, Reserved == %lu, MsgHandler == ^%p, Context == ^%p)\n",
debugstr_a(CabinetFile), Reserved, MsgHandler, Context); debugstr_a(CabinetFile), Reserved, MsgHandler, Context);
if (! LoadCABINETDll()) if (! LoadCABINETDll())
return FALSE; return FALSE;
memset(&my_hsc, 0, sizeof(SC_HSC_A)); memset(&my_hsc, 0, sizeof(SC_HSC_A));
@ -677,6 +678,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!GetVersionExW(&OsVersionInfo)) if (!GetVersionExW(&OsVersionInfo))
return FALSE; return FALSE;
hInstance = (HINSTANCE)hinstDLL;
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
UnloadCABINETDll(); UnloadCABINETDll();