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

Last change on this file since 22026 was 22026, checked in by dmik, 13 years ago

testapp: Add GetFileInformationByHandle test for directories.

  • Property svn:eol-style set to native
File size: 1.3 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#ifdef ODIN_FORCE_WIN32_TIB
26 ForceWin32TIB();
27#endif
28 RegisterLxExe(WinMain, NULL);
29}
30
31#else
32#define _main main
33#endif
34
35int _main(int argc, char **argv)
36{
37 LPCTSTR szFile = _T("test.txt");
38
39 HANDLE hFile = CreateFile(szFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
40 FILE_ATTRIBUTE_NORMAL, NULL);
41 if (hFile != INVALID_HANDLE_VALUE)
42 {
43 printf("szFile %s\n", szFile);
44 printf("hFile %08lX\n", hFile);
45 BY_HANDLE_FILE_INFORMATION info;
46 if (GetFileInformationByHandle(hFile, &info))
47 {
48 printf("dwVolumeSerialNumber %08lX\n", info.dwVolumeSerialNumber);
49 printf("nFileIndexHigh %08lX\n", info.nFileIndexHigh);
50 printf("nFileIndexLow %08lX\n", info.nFileIndexLow);
51 }
52 }
53 else
54 {
55 printf("Error %d opening file '%s'\n", GetLastError(), szFile);
56 }
57
58 return 0;
59}
Note: See TracBrowser for help on using the repository browser.