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