| 1 | #include <stdio.h>
|
|---|
| 2 | #include <windows.h>
|
|---|
| 3 | #include <tchar.h>
|
|---|
| 4 |
|
|---|
| 5 | #ifndef _MSC_VER
|
|---|
| 6 |
|
|---|
| 7 | #include <odinlx.h>
|
|---|
| 8 |
|
|---|
| 9 | #include <minivcrt.h>
|
|---|
| 10 |
|
|---|
| 11 | int _main();
|
|---|
| 12 | int _argc;
|
|---|
| 13 | char **_argv;
|
|---|
| 14 |
|
|---|
| 15 | int WIN32API WinMain(HANDLE hInstance,
|
|---|
| 16 | HANDLE hPrevInstance,
|
|---|
| 17 | LPSTR lpCmdLine,
|
|---|
| 18 | int nCmdShow)
|
|---|
| 19 | {
|
|---|
| 20 | return _main(_argc, _argv);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | int main(int argc, char **argv)
|
|---|
| 24 | {
|
|---|
| 25 | _argc = argc;
|
|---|
| 26 | _argv = argv;
|
|---|
| 27 | EnableSEH();
|
|---|
| 28 | RegisterLxExe(WinMain, NULL);
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | #else
|
|---|
| 32 | #define _main main
|
|---|
| 33 | #endif
|
|---|
| 34 |
|
|---|
| 35 | static void test_fullpath(const char *path)
|
|---|
| 36 | {
|
|---|
| 37 | char fullPath[MAX_PATH];
|
|---|
| 38 | _fullpath(fullPath, path, sizeof(fullPath));
|
|---|
| 39 | printf("### [%s] => [%s]\n", path, fullPath);
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | static void do_test_fullpath()
|
|---|
| 43 | {
|
|---|
| 44 | test_fullpath("");
|
|---|
| 45 | test_fullpath("\\");
|
|---|
| 46 | test_fullpath("\\\\\\\\");
|
|---|
| 47 | test_fullpath(".");
|
|---|
| 48 | test_fullpath(".\\");
|
|---|
| 49 | test_fullpath("\\.");
|
|---|
| 50 | test_fullpath("\\.\\");
|
|---|
| 51 | test_fullpath("..");
|
|---|
| 52 | test_fullpath("..\\");
|
|---|
| 53 | test_fullpath("\\..");
|
|---|
| 54 | test_fullpath("\\..\\");
|
|---|
| 55 | test_fullpath("a\\b");
|
|---|
| 56 | test_fullpath("\\a\\b");
|
|---|
| 57 | test_fullpath("a\\b\\");
|
|---|
| 58 | test_fullpath("\\a\\b\\");
|
|---|
| 59 | test_fullpath("d:\\a\\b");
|
|---|
| 60 | test_fullpath("d:\\a\\b\\");
|
|---|
| 61 | test_fullpath("d:\\a\\b\\\\");
|
|---|
| 62 | test_fullpath("d:\\a\\\\b\\c\\\\d");
|
|---|
| 63 | test_fullpath("d:\\a\\.\\.\\b\\c\\.\\.\\.\\d");
|
|---|
| 64 | test_fullpath("d:\\..\\..\\.\\");
|
|---|
| 65 | test_fullpath("d:\\a\\\\b\\c\\\\d\\..\\e");
|
|---|
| 66 | test_fullpath("d:\\a\\\\b\\c\\\\d\\..\\..\\e");
|
|---|
| 67 | test_fullpath("d:\\a\\\\b\\c\\\\d\\..\\..\\..\\e");
|
|---|
| 68 | test_fullpath("d:\\a\\\\b\\c\\\\d\\..\\..\\\\..\\e");
|
|---|
| 69 | test_fullpath("d:\\a\\\\b\\c\\\\d\\..\\..\\..\\..\\e");
|
|---|
| 70 | test_fullpath("d:\\a\\\\b\\c\\\\d\\..\\..\\..\\..\\..\\e");
|
|---|
| 71 | test_fullpath("d\\a\\\\b\\c\\\\d\\..\\..\\..\\..\\..\\e");
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | int _main(int argc, char **argv)
|
|---|
| 75 | {
|
|---|
| 76 | do_test_fullpath();
|
|---|
| 77 |
|
|---|
| 78 | return 0;
|
|---|
| 79 | }
|
|---|