From 4d5c2318e63d2f4de132b889931dee1a7bbddc43 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Mon, 14 Feb 2005 11:04:39 +0000 Subject: [PATCH] Implement DelayedMove and FileExists. --- dlls/setupapi/misc.c | 37 +++++++++++++++++++++++++++++++++++++ dlls/setupapi/setupapi.spec | 4 ++-- include/setupapi.h | 2 ++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c index bb7eda14d30..ad6b1234f90 100644 --- a/dlls/setupapi/misc.c +++ b/dlls/setupapi/misc.c @@ -30,6 +30,9 @@ #include "wine/unicode.h" #include "wine/debug.h" +#include "setupapi_private.h" + + WINE_DEFAULT_DEBUG_CHANNEL(setupapi); @@ -458,3 +461,37 @@ BOOL WINAPI EnablePrivilege(LPCWSTR lpPrivilegeName, BOOL bEnable) return bResult; } + + +BOOL WINAPI DelayedMove(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName) +{ + return MoveFileExW(lpExistingFileName, lpNewFileName, + MOVEFILE_REPLACE_EXISTING | MOVEFILE_DELAY_UNTIL_REBOOT); +} + + +BOOL WINAPI FileExists(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFileFindData) +{ + WIN32_FIND_DATAW FindData; + HANDLE hFind; + UINT uErrorMode; + DWORD dwError; + + uErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); + + hFind = FindFirstFileW(lpFileName, &FindData); + if (hFind == INVALID_HANDLE_VALUE) + { + dwError = GetLastError(); + SetErrorMode(uErrorMode); + SetLastError(dwError); + return FALSE; + } + + FindClose(hFind); + + if (lpFileFindData) + memcpy(lpFileFindData, &FindData, sizeof(WIN32_FIND_DATAW)); + + return TRUE; +} diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec index 9ecca648230..10ed72a4980 100644 --- a/dlls/setupapi/setupapi.spec +++ b/dlls/setupapi/setupapi.spec @@ -194,14 +194,14 @@ @ stub CaptureStringArg @ stub CenterWindowRelativeToParent @ stub ConcatenatePaths -@ stub DelayedMove +@ stdcall DelayedMove(wstr wstr) @ stub DelimStringToMultiSz @ stub DestroyTextFileReadBuffer @ stdcall DoesUserHavePrivilege(wstr) @ stdcall DuplicateString(wstr) @ stdcall EnablePrivilege(wstr long) @ stub ExtensionPropSheetPageProc -@ stub FileExists +@ stdcall FileExists(wstr ptr) @ stub FreeStringArray @ stub GetCurrentDriverSigningPolicy @ stub GetNewInfName diff --git a/include/setupapi.h b/include/setupapi.h index 763b07202e7..cee5f4c02e6 100644 --- a/include/setupapi.h +++ b/include/setupapi.h @@ -666,9 +666,11 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PFILEPATHS) LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWORD dwUnknown3); +BOOL WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName); BOOL WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName); PWSTR WINAPI DuplicateString(PCWSTR lpSrc); BOOL WINAPI EnablePrivilege(PCWSTR lpPrivilegeName, BOOL bEnable); +BOOL WINAPI FileExists(PCWSTR lpFileName, PWIN32_FIND_DATAW lpFileFindData); 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)