mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-25 01:42:24 -05:00
tst: winfsp-tests: add WINAPI for Hook* and Resilient* APIs
This commit is contained in:
parent
205a59dbc6
commit
79bf651203
@ -120,7 +120,7 @@ static VOID MaybeAdjustTraversePrivilege(BOOL Enable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE HookCreateFileW(
|
HANDLE WINAPI HookCreateFileW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
DWORD dwDesiredAccess,
|
DWORD dwDesiredAccess,
|
||||||
DWORD dwShareMode,
|
DWORD dwShareMode,
|
||||||
@ -147,14 +147,14 @@ HANDLE HookCreateFileW(
|
|||||||
return Handle;
|
return Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookCloseHandle(
|
BOOL WINAPI HookCloseHandle(
|
||||||
HANDLE hObject)
|
HANDLE hObject)
|
||||||
{
|
{
|
||||||
return (OptResilient ? ResilientCloseHandle : CloseHandle)(
|
return (OptResilient ? ResilientCloseHandle : CloseHandle)(
|
||||||
hObject);
|
hObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookSetFileAttributesW(
|
BOOL WINAPI HookSetFileAttributesW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
DWORD dwFileAttributes)
|
DWORD dwFileAttributes)
|
||||||
{
|
{
|
||||||
@ -169,7 +169,7 @@ BOOL HookSetFileAttributesW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookCreateDirectoryW(
|
BOOL WINAPI HookCreateDirectoryW(
|
||||||
LPCWSTR lpPathName,
|
LPCWSTR lpPathName,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes)
|
||||||
{
|
{
|
||||||
@ -184,7 +184,7 @@ BOOL HookCreateDirectoryW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookDeleteFileW(
|
BOOL WINAPI HookDeleteFileW(
|
||||||
LPCWSTR lpFileName)
|
LPCWSTR lpFileName)
|
||||||
{
|
{
|
||||||
WCHAR FileNameBuf[FILENAMEBUF_SIZE];
|
WCHAR FileNameBuf[FILENAMEBUF_SIZE];
|
||||||
@ -199,7 +199,7 @@ BOOL HookDeleteFileW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookRemoveDirectoryW(
|
BOOL WINAPI HookRemoveDirectoryW(
|
||||||
LPCWSTR lpPathName)
|
LPCWSTR lpPathName)
|
||||||
{
|
{
|
||||||
WCHAR FileNameBuf[FILENAMEBUF_SIZE];
|
WCHAR FileNameBuf[FILENAMEBUF_SIZE];
|
||||||
@ -214,7 +214,7 @@ BOOL HookRemoveDirectoryW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookMoveFileExW(
|
BOOL WINAPI HookMoveFileExW(
|
||||||
LPCWSTR lpExistingFileName,
|
LPCWSTR lpExistingFileName,
|
||||||
LPCWSTR lpNewFileName,
|
LPCWSTR lpNewFileName,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
@ -232,7 +232,7 @@ BOOL HookMoveFileExW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE HookFindFirstFileW(
|
HANDLE WINAPI HookFindFirstFileW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
LPWIN32_FIND_DATAW lpFindFileData)
|
LPWIN32_FIND_DATAW lpFindFileData)
|
||||||
{
|
{
|
||||||
@ -247,7 +247,7 @@ HANDLE HookFindFirstFileW(
|
|||||||
return Handle;
|
return Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE HookFindFirstStreamW(
|
HANDLE WINAPI HookFindFirstStreamW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
STREAM_INFO_LEVELS InfoLevel,
|
STREAM_INFO_LEVELS InfoLevel,
|
||||||
LPVOID lpFindStreamData,
|
LPVOID lpFindStreamData,
|
||||||
@ -264,7 +264,7 @@ HANDLE HookFindFirstStreamW(
|
|||||||
return Handle;
|
return Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookGetDiskFreeSpaceW(
|
BOOL WINAPI HookGetDiskFreeSpaceW(
|
||||||
LPCWSTR lpRootPathName,
|
LPCWSTR lpRootPathName,
|
||||||
LPDWORD lpSectorsPerCluster,
|
LPDWORD lpSectorsPerCluster,
|
||||||
LPDWORD lpBytesPerSector,
|
LPDWORD lpBytesPerSector,
|
||||||
@ -287,7 +287,7 @@ BOOL HookGetDiskFreeSpaceW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookGetVolumeInformationW(
|
BOOL WINAPI HookGetVolumeInformationW(
|
||||||
LPCWSTR lpRootPathName,
|
LPCWSTR lpRootPathName,
|
||||||
LPWSTR lpVolumeNameBuffer,
|
LPWSTR lpVolumeNameBuffer,
|
||||||
DWORD nVolumeNameSize,
|
DWORD nVolumeNameSize,
|
||||||
@ -316,7 +316,7 @@ BOOL HookGetVolumeInformationW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HookSetVolumeLabelW(
|
BOOL WINAPI HookSetVolumeLabelW(
|
||||||
LPCWSTR lpRootPathName,
|
LPCWSTR lpRootPathName,
|
||||||
LPCWSTR lpVolumeName)
|
LPCWSTR lpVolumeName)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
static VOID WaitDeletePending(PCWSTR FileName);
|
static VOID WaitDeletePending(PCWSTR FileName);
|
||||||
|
|
||||||
HANDLE ResilientCreateFileW(
|
HANDLE WINAPI ResilientCreateFileW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
DWORD dwDesiredAccess,
|
DWORD dwDesiredAccess,
|
||||||
DWORD dwShareMode,
|
DWORD dwShareMode,
|
||||||
@ -56,7 +56,7 @@ HANDLE ResilientCreateFileW(
|
|||||||
return Handle;
|
return Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ResilientCloseHandle(
|
BOOL WINAPI ResilientCloseHandle(
|
||||||
HANDLE hObject)
|
HANDLE hObject)
|
||||||
{
|
{
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
@ -90,7 +90,7 @@ BOOL ResilientCloseHandle(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ResilientDeleteFileW(
|
BOOL WINAPI ResilientDeleteFileW(
|
||||||
LPCWSTR lpFileName)
|
LPCWSTR lpFileName)
|
||||||
{
|
{
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
@ -116,7 +116,7 @@ BOOL ResilientDeleteFileW(
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ResilientRemoveDirectoryW(
|
BOOL WINAPI ResilientRemoveDirectoryW(
|
||||||
LPCWSTR lpPathName)
|
LPCWSTR lpPathName)
|
||||||
{
|
{
|
||||||
BOOL Success;
|
BOOL Success;
|
||||||
@ -147,7 +147,8 @@ static VOID WaitDeletePending(PCWSTR FileName)
|
|||||||
for (ULONG MaxTries = DeleteMaxTries; 0 != MaxTries; MaxTries--)
|
for (ULONG MaxTries = DeleteMaxTries; 0 != MaxTries; MaxTries--)
|
||||||
{
|
{
|
||||||
HANDLE Handle = CreateFileW(FileName,
|
HANDLE Handle = CreateFileW(FileName,
|
||||||
FILE_READ_ATTRIBUTES, 0, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
|
FILE_READ_ATTRIBUTES, 0, 0, OPEN_EXISTING,
|
||||||
|
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0);
|
||||||
if (INVALID_HANDLE_VALUE != Handle)
|
if (INVALID_HANDLE_VALUE != Handle)
|
||||||
/* should never happen! */
|
/* should never happen! */
|
||||||
CloseHandle(Handle);
|
CloseHandle(Handle);
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#define GetVolumeInformationW HookGetVolumeInformationW
|
#define GetVolumeInformationW HookGetVolumeInformationW
|
||||||
#define SetVolumeLabelW HookSetVolumeLabelW
|
#define SetVolumeLabelW HookSetVolumeLabelW
|
||||||
#endif
|
#endif
|
||||||
HANDLE HookCreateFileW(
|
HANDLE WINAPI HookCreateFileW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
DWORD dwDesiredAccess,
|
DWORD dwDesiredAccess,
|
||||||
DWORD dwShareMode,
|
DWORD dwShareMode,
|
||||||
@ -50,37 +50,37 @@ HANDLE HookCreateFileW(
|
|||||||
DWORD dwCreationDisposition,
|
DWORD dwCreationDisposition,
|
||||||
DWORD dwFlagsAndAttributes,
|
DWORD dwFlagsAndAttributes,
|
||||||
HANDLE hTemplateFile);
|
HANDLE hTemplateFile);
|
||||||
BOOL HookCloseHandle(
|
BOOL WINAPI HookCloseHandle(
|
||||||
HANDLE hObject);
|
HANDLE hObject);
|
||||||
BOOL HookSetFileAttributesW(
|
BOOL WINAPI HookSetFileAttributesW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
DWORD dwFileAttributes);
|
DWORD dwFileAttributes);
|
||||||
BOOL HookCreateDirectoryW(
|
BOOL WINAPI HookCreateDirectoryW(
|
||||||
LPCWSTR lpPathName,
|
LPCWSTR lpPathName,
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes);
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes);
|
||||||
BOOL HookDeleteFileW(
|
BOOL WINAPI HookDeleteFileW(
|
||||||
LPCWSTR lpFileName);
|
LPCWSTR lpFileName);
|
||||||
BOOL HookRemoveDirectoryW(
|
BOOL WINAPI HookRemoveDirectoryW(
|
||||||
LPCWSTR lpPathName);
|
LPCWSTR lpPathName);
|
||||||
BOOL HookMoveFileExW(
|
BOOL WINAPI HookMoveFileExW(
|
||||||
LPCWSTR lpExistingFileName,
|
LPCWSTR lpExistingFileName,
|
||||||
LPCWSTR lpNewFileName,
|
LPCWSTR lpNewFileName,
|
||||||
DWORD dwFlags);
|
DWORD dwFlags);
|
||||||
HANDLE HookFindFirstFileW(
|
HANDLE WINAPI HookFindFirstFileW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
LPWIN32_FIND_DATAW lpFindFileData);
|
LPWIN32_FIND_DATAW lpFindFileData);
|
||||||
HANDLE HookFindFirstStreamW(
|
HANDLE WINAPI HookFindFirstStreamW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
STREAM_INFO_LEVELS InfoLevel,
|
STREAM_INFO_LEVELS InfoLevel,
|
||||||
LPVOID lpFindStreamData,
|
LPVOID lpFindStreamData,
|
||||||
DWORD dwFlags);
|
DWORD dwFlags);
|
||||||
BOOL HookGetDiskFreeSpaceW(
|
BOOL WINAPI HookGetDiskFreeSpaceW(
|
||||||
LPCWSTR lpRootPathName,
|
LPCWSTR lpRootPathName,
|
||||||
LPDWORD lpSectorsPerCluster,
|
LPDWORD lpSectorsPerCluster,
|
||||||
LPDWORD lpBytesPerSector,
|
LPDWORD lpBytesPerSector,
|
||||||
LPDWORD lpNumberOfFreeClusters,
|
LPDWORD lpNumberOfFreeClusters,
|
||||||
LPDWORD lpTotalNumberOfClusters);
|
LPDWORD lpTotalNumberOfClusters);
|
||||||
BOOL HookGetVolumeInformationW(
|
BOOL WINAPI HookGetVolumeInformationW(
|
||||||
LPCWSTR lpRootPathName,
|
LPCWSTR lpRootPathName,
|
||||||
LPWSTR lpVolumeNameBuffer,
|
LPWSTR lpVolumeNameBuffer,
|
||||||
DWORD nVolumeNameSize,
|
DWORD nVolumeNameSize,
|
||||||
@ -89,11 +89,11 @@ BOOL HookGetVolumeInformationW(
|
|||||||
LPDWORD lpFileSystemFlags,
|
LPDWORD lpFileSystemFlags,
|
||||||
LPWSTR lpFileSystemNameBuffer,
|
LPWSTR lpFileSystemNameBuffer,
|
||||||
DWORD nFileSystemNameSize);
|
DWORD nFileSystemNameSize);
|
||||||
BOOL HookSetVolumeLabelW(
|
BOOL WINAPI HookSetVolumeLabelW(
|
||||||
LPCWSTR lpRootPathName,
|
LPCWSTR lpRootPathName,
|
||||||
LPCWSTR lpVolumeName);
|
LPCWSTR lpVolumeName);
|
||||||
|
|
||||||
HANDLE ResilientCreateFileW(
|
HANDLE WINAPI ResilientCreateFileW(
|
||||||
LPCWSTR lpFileName,
|
LPCWSTR lpFileName,
|
||||||
DWORD dwDesiredAccess,
|
DWORD dwDesiredAccess,
|
||||||
DWORD dwShareMode,
|
DWORD dwShareMode,
|
||||||
@ -101,11 +101,11 @@ HANDLE ResilientCreateFileW(
|
|||||||
DWORD dwCreationDisposition,
|
DWORD dwCreationDisposition,
|
||||||
DWORD dwFlagsAndAttributes,
|
DWORD dwFlagsAndAttributes,
|
||||||
HANDLE hTemplateFile);
|
HANDLE hTemplateFile);
|
||||||
BOOL ResilientCloseHandle(
|
BOOL WINAPI ResilientCloseHandle(
|
||||||
HANDLE hObject);
|
HANDLE hObject);
|
||||||
BOOL ResilientDeleteFileW(
|
BOOL WINAPI ResilientDeleteFileW(
|
||||||
LPCWSTR lpFileName);
|
LPCWSTR lpFileName);
|
||||||
BOOL ResilientRemoveDirectoryW(
|
BOOL WINAPI ResilientRemoveDirectoryW(
|
||||||
LPCWSTR lpPathName);
|
LPCWSTR lpPathName);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
Loading…
x
Reference in New Issue
Block a user