| 1 | #include <windows.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 |
|
|---|
| 5 | #ifndef _MSC_VER
|
|---|
| 6 |
|
|---|
| 7 | #include <odinlx.h>
|
|---|
| 8 |
|
|---|
| 9 | int _main(int argc, char **argv);
|
|---|
| 10 |
|
|---|
| 11 | int WIN32API WinMain(HANDLE hInstance,
|
|---|
| 12 | HANDLE hPrevInstance,
|
|---|
| 13 | LPSTR lpCmdLine,
|
|---|
| 14 | int nCmdShow)
|
|---|
| 15 | {
|
|---|
| 16 | return _main(__argcA, __argvA);
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | int main(int argc, char **argv)
|
|---|
| 20 | {
|
|---|
| 21 | EnableSEH();
|
|---|
| 22 | RegisterLxExe(WinMain, NULL);
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | #else
|
|---|
| 26 | #define _main main
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| 29 | int _main(int argc, char **argv)
|
|---|
| 30 | {
|
|---|
| 31 | STARTUPINFO si;
|
|---|
| 32 | PROCESS_INFORMATION pi;
|
|---|
| 33 | BOOL rc;
|
|---|
| 34 | char *cmd;
|
|---|
| 35 |
|
|---|
| 36 | /* ANSI encoding */
|
|---|
| 37 | MessageBoxA(NULL,
|
|---|
| 38 | "ANSI: Ðóññêèé 1251, ãá᪚© 866",
|
|---|
| 39 | "ANSI: Ðóññêèé 1251, ãá᪚© 866",
|
|---|
| 40 | MB_ICONINFORMATION | MB_OK);
|
|---|
| 41 |
|
|---|
| 42 | /* Unicode */
|
|---|
| 43 | MessageBoxW(NULL,
|
|---|
| 44 | L"Unicode: \x0420\x0443\x0441\x0441\x043a\x0438\x0439",
|
|---|
| 45 | L"Unicode: \x0420\x0443\x0441\x0441\x043a\x0438\x0439",
|
|---|
| 46 | MB_ICONINFORMATION | MB_OK);
|
|---|
| 47 |
|
|---|
| 48 | /* Command line */
|
|---|
| 49 | printf("1st Command Line argument: \"%s\"\n", argc > 1 ? argv[1] : NULL);
|
|---|
| 50 | MessageBoxA(NULL,
|
|---|
| 51 | argc > 1 ? argv[1] : NULL,
|
|---|
| 52 | "1st Command Line argument",
|
|---|
| 53 | MB_ICONINFORMATION | MB_OK);
|
|---|
| 54 |
|
|---|
| 55 | /* Start a command */
|
|---|
| 56 | memset(&pi, 0, sizeof(pi));
|
|---|
| 57 | memset(&si, 0, sizeof(si));
|
|---|
| 58 | si.cb = sizeof(si);
|
|---|
| 59 | cmd = getenv("COMSPEC");
|
|---|
| 60 | rc = CreateProcess(cmd, "cmd.exe /c òåñò.cmd", NULL, NULL, FALSE, 0,
|
|---|
| 61 | NULL, NULL, &si, &pi);
|
|---|
| 62 | printf("CreateProcess returned %d (error %x)\n", rc, GetLastError());
|
|---|
| 63 | if (rc) {
|
|---|
| 64 | printf("dwProcessId %d\n", pi.dwProcessId);
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | return 0;
|
|---|
| 68 | }
|
|---|