source: trunk/testapp/console/file/file.c@ 21565

Last change on this file since 21565 was 21565, checked in by dmik, 15 years ago

testapp: Added simple CreateFile()/GetFileInformationByHandle() test case.

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1#include <stdio.h>
2#include <windows.h>
3#include <tchar.h>
4
5#ifndef _MSC_VER
6
7#include <odinlx.h>
8
9int _main();
10int _argc;
11char **_argv;
12
13int WIN32API WinMain(HANDLE hInstance,
14 HANDLE hPrevInstance,
15 LPSTR lpCmdLine,
16 int nCmdShow)
17{
18 return _main(_argc, _argv);
19}
20
21int main(int argc, char **argv)
22{
23 _argc = argc;
24 _argv = argv;
25 EnableSEH();
26 RegisterLxExe(WinMain, NULL);
27}
28
29#else
30#define _main main
31#endif
32
33int _main(int argc, char **argv)
34{
35 LPCTSTR szFile = _T("test.txt");
36
37 HANDLE hFile = CreateFile(szFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
38 FILE_ATTRIBUTE_NORMAL, NULL);
39 if (hFile)
40 {
41 printf("hFile %08lX\n", hFile);
42 BY_HANDLE_FILE_INFORMATION info;
43 if (GetFileInformationByHandle(hFile, &info))
44 {
45 printf("dwVolumeSerialNumber %08lX\n", info.dwVolumeSerialNumber);
46 printf("nFileIndexHigh %08lX\n", info.nFileIndexHigh);
47 printf("nFileIndexLow %08lX\n", info.nFileIndexLow);
48 }
49 }
50
51 return 0;
52}
Note: See TracBrowser for help on using the repository browser.