mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 18:51:37 +00:00
[KERNEL32_APITEST]
Complete a bit more the PrivMoveFileIdentityW tests svn path=/trunk/; revision=67306
This commit is contained in:
parent
3804a6e321
commit
2a8f6b6f83
1 changed files with 33 additions and 3 deletions
|
@ -13,6 +13,8 @@
|
|||
#include <ndk/rtltypes.h>
|
||||
|
||||
static const WCHAR FileName[] = L"TestFile.xxx";
|
||||
static const CHAR FileNameA[] = "TestFile.xxx";
|
||||
static const WCHAR FileName2[] = L"TestFile2.xxx";
|
||||
|
||||
static BOOL (WINAPI * pPrivMoveFileIdentityW)(LPCWSTR, LPCWSTR, DWORD);
|
||||
|
||||
|
@ -59,10 +61,11 @@ TestPrivMoveFileIdentityW(VOID)
|
|||
FILE_STANDARD_INFORMATION FileStandardInfo;
|
||||
LARGE_INTEGER CreationTime, EndOfFile;
|
||||
HANDLE hDest;
|
||||
NTSTATUS Status;
|
||||
WCHAR Self[MAX_PATH];
|
||||
OFSTRUCT ReOpen;
|
||||
|
||||
DeleteFileW(FileName);
|
||||
DeleteFileW(FileName2);
|
||||
|
||||
if (GetModuleFileNameW(NULL, Self, MAX_PATH) == 0)
|
||||
{
|
||||
|
@ -96,8 +99,14 @@ TestPrivMoveFileIdentityW(VOID)
|
|||
ok(QueryFileInfo(FileName, &FileBasicInfo, &FileStandardInfo) == TRUE, "QueryFileInfo returned FALSE\n");
|
||||
ok(FileBasicInfo.CreationTime.QuadPart != CreationTime.QuadPart, "Equal creation times\n");
|
||||
ok(FileStandardInfo.EndOfFile.QuadPart == 0LL, "File wasn't created empty: %I64d\n", FileStandardInfo.EndOfFile.QuadPart);
|
||||
Status = (NTSTATUS)pPrivMoveFileIdentityW(Self, FileName, 0);
|
||||
ok(Status == STATUS_SUCCESS, "PrivMoveFileIdentityW failed with %lx\n", Status);
|
||||
SetLastError(0xdeadbeef);
|
||||
ok(pPrivMoveFileIdentityW(Self, FileName, 0) == FALSE, "PrivMoveFileIdentityW succeed\n");
|
||||
ok(GetLastError() == ERROR_SHARING_VIOLATION, "Last error: %lx\n", GetLastError());
|
||||
ok(QueryFileInfo(FileName, &FileBasicInfo, &FileStandardInfo) == TRUE, "QueryFileInfo returned FALSE\n");
|
||||
ok(FileBasicInfo.CreationTime.QuadPart != CreationTime.QuadPart, "Equal creation times\n");
|
||||
ok(FileStandardInfo.EndOfFile.QuadPart == 0LL, "File wasn't created empty: %I64d\n", FileStandardInfo.EndOfFile.QuadPart);
|
||||
SetLastError(0xdeadbeef);
|
||||
ok(pPrivMoveFileIdentityW(Self, FileName, 2) == TRUE, "PrivMoveFileIdentityW failed with %lx\n", GetLastError());
|
||||
ok(QueryFileInfo(FileName, &FileBasicInfo, &FileStandardInfo) == TRUE, "QueryFileInfo returned FALSE\n");
|
||||
ok(FileBasicInfo.CreationTime.QuadPart == CreationTime.QuadPart, "Creation time didn't change\n");
|
||||
ok(FileStandardInfo.EndOfFile.QuadPart == 0LL, "File not empty anymore: %I64d\n", FileStandardInfo.EndOfFile.QuadPart);
|
||||
|
@ -105,6 +114,27 @@ TestPrivMoveFileIdentityW(VOID)
|
|||
ok(FileBasicInfo.CreationTime.QuadPart == CreationTime.QuadPart, "Creation time changed\n");
|
||||
ok(FileStandardInfo.EndOfFile.QuadPart == EndOfFile.QuadPart, "File size changed: %I64d\n", FileStandardInfo.EndOfFile.QuadPart);
|
||||
|
||||
hDest = CreateFileW(FileName2, GENERIC_WRITE | SYNCHRONIZE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
|
||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_SYNCHRONOUS_IO_NONALERT,
|
||||
NULL);
|
||||
if (hDest == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
win_skip("Failed creating new\n");
|
||||
return;
|
||||
}
|
||||
|
||||
CloseHandle(hDest);
|
||||
|
||||
ok(QueryFileInfo(FileName2, &FileBasicInfo, &FileStandardInfo) == TRUE, "QueryFileInfo returned FALSE\n");
|
||||
ok(FileBasicInfo.CreationTime.QuadPart != CreationTime.QuadPart, "Equal creation times\n");
|
||||
SetLastError(0xdeadbeef);
|
||||
ok(pPrivMoveFileIdentityW(FileName, FileName2, 3) == TRUE, "PrivMoveFileIdentityW failed with %lx\n", GetLastError());
|
||||
ok(QueryFileInfo(FileName2, &FileBasicInfo, &FileStandardInfo) == TRUE, "QueryFileInfo returned FALSE\n");
|
||||
ok(FileBasicInfo.CreationTime.QuadPart == CreationTime.QuadPart, "Creation time didn't change\n");
|
||||
ok(OpenFile(FileNameA, &ReOpen, OF_EXIST) == HFILE_ERROR, "Source file still exists\n");
|
||||
|
||||
DeleteFileW(FileName2);
|
||||
DeleteFileW(FileName);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue