OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include <Windows.h> | 8 #include <Windows.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hIns
tance, NULL); | 131 CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hIns
tance, NULL); |
132 | 132 |
133 if (!hWnd) | 133 if (!hWnd) |
134 { | 134 { |
135 return FALSE; | 135 return FALSE; |
136 } | 136 } |
137 | 137 |
138 char* argv[4096]; | 138 char* argv[4096]; |
139 int argc = 0; | 139 int argc = 0; |
140 TCHAR exename[1024], *next; | 140 TCHAR exename[1024], *next; |
141 int exenameLen = GetModuleFileName(NULL, exename, 1024); | 141 int exenameLen = GetModuleFileName(NULL, exename, SK_ARRAY_COUNT(exename)); |
| 142 // we're ignoring the possibility that the exe name exceeds the exename buffe
r |
| 143 (void) exenameLen; |
142 argv[argc++] = tchar_to_utf8(exename); | 144 argv[argc++] = tchar_to_utf8(exename); |
143 TCHAR* arg = _tcstok_s(lpCmdLine, _T(" "), &next); | 145 TCHAR* arg = _tcstok_s(lpCmdLine, _T(" "), &next); |
144 while (arg != NULL) { | 146 while (arg != NULL) { |
145 argv[argc++] = tchar_to_utf8(arg); | 147 argv[argc++] = tchar_to_utf8(arg); |
146 arg = _tcstok_s(NULL, _T(" "), &next); | 148 arg = _tcstok_s(NULL, _T(" "), &next); |
147 } | 149 } |
148 | 150 |
149 gSkWind = create_sk_window(hWnd, argc, argv); | 151 gSkWind = create_sk_window(hWnd, argc, argv); |
150 for (int i = 0; i < argc; ++i) { | 152 for (int i = 0; i < argc; ++i) { |
151 free(argv[i]); | 153 free(argv[i]); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 case WM_COMMAND: | 198 case WM_COMMAND: |
197 if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) | 199 if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) |
198 { | 200 { |
199 EndDialog(hDlg, LOWORD(wParam)); | 201 EndDialog(hDlg, LOWORD(wParam)); |
200 return (INT_PTR)TRUE; | 202 return (INT_PTR)TRUE; |
201 } | 203 } |
202 break; | 204 break; |
203 } | 205 } |
204 return (INT_PTR)FALSE; | 206 return (INT_PTR)FALSE; |
205 } | 207 } |
OLD | NEW |