diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/nw/test/lock2.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to '')
-rw-r--r-- | private/nw/test/lock2.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/private/nw/test/lock2.c b/private/nw/test/lock2.c new file mode 100644 index 000000000..d1e0ba45c --- /dev/null +++ b/private/nw/test/lock2.c @@ -0,0 +1,65 @@ +/*++ + +Copyright (c) 1990 Microsoft Corporation + +Module Name: + + tfile.c + +Abstract: + + Test program for Win32 Base File API calls + +Author: + + Mark Lucovsky (markl) 26-Sep-1990 + +Revision History: + +--*/ + +#include <windows.h> +#include <assert.h> + +DWORD +_cdecl +main( + int argc, + char *argv[], + char *envp[] + ) +{ + + HANDLE iFile; + + iFile = CreateFile( + "testfile.txt", + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + 0, + NULL + ); + assert(iFile != INVALID_HANDLE_VALUE); + + assert(LockFile(iFile,0,0,10,0)); + assert(LockFile(iFile,10,0,10,0)); + assert(!LockFile(iFile,1,0,1,0)); + assert(!LockFile(iFile,0,0,11,0)); + assert(!LockFile(iFile,0,0,20,0)); + assert(!UnlockFile(iFile,1,0,1,0)); + assert(!UnlockFile(iFile,0,0,11,0)); + assert(!UnlockFile(iFile,0,0,20,0)); + assert(UnlockFile(iFile,0,0,10,0)); + assert(UnlockFile(iFile,10,0,10,0)); + assert(LockFile(iFile,0,0,10,0)); + assert(LockFile(iFile,10,0,10,0)); + + Sleep(60 * 1000); + + CloseHandle(iFile); + + return 1; + +} |