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

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

kernel32: Make SEH work in OS/2 context.

See #82 for details.

  • 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#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)
42 {
43 printf("hFile %08lX\n", hFile);
44 BY_HANDLE_FILE_INFORMATION info;
45 if (GetFileInformationByHandle(hFile, &info))
46 {
47 printf("dwVolumeSerialNumber %08lX\n", info.dwVolumeSerialNumber);
48 printf("nFileIndexHigh %08lX\n", info.nFileIndexHigh);
49 printf("nFileIndexLow %08lX\n", info.nFileIndexLow);
50 }
51 }
52
53 return 0;
54}
Note: See TracBrowser for help on using the repository browser.