Loweynet
Revisão | 9b756a48d7a13d5080350823d8117f217535cd62 (tree) |
---|---|
Hora | 2012-02-11 23:19:36 |
Autor | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Fix codes for debugging.
Recompile executable files.
@@ -258,66 +258,68 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi | ||
258 | 258 | |
259 | 259 | // プロセス保護 |
260 | 260 | #ifdef ENABLE_PROCESS_PROTECTION |
261 | - DWORD ProtectLevel; | |
262 | - char* pCommand; | |
263 | - char Option[FMAX_PATH+1]; | |
264 | - ProtectLevel = PROCESS_PROTECTION_NONE; | |
265 | - pCommand = lpszCmdLine; | |
266 | - while(pCommand = GetToken(pCommand, Option)) | |
267 | 261 | { |
268 | - if(strcmp(Option, "--protect") == 0) | |
262 | + DWORD ProtectLevel; | |
263 | + char* pCommand; | |
264 | + char Option[FMAX_PATH+1]; | |
265 | + ProtectLevel = PROCESS_PROTECTION_NONE; | |
266 | + pCommand = lpszCmdLine; | |
267 | + while(pCommand = GetToken(pCommand, Option)) | |
269 | 268 | { |
270 | - ProtectLevel = PROCESS_PROTECTION_DEFAULT; | |
271 | - break; | |
272 | - } | |
273 | - else if(strcmp(Option, "--protect-high") == 0) | |
274 | - { | |
275 | - ProtectLevel = PROCESS_PROTECTION_HIGH; | |
276 | - break; | |
277 | - } | |
278 | - else if(strcmp(Option, "--protect-medium") == 0) | |
279 | - { | |
280 | - ProtectLevel = PROCESS_PROTECTION_MEDIUM; | |
281 | - break; | |
269 | + if(strcmp(Option, "--protect") == 0) | |
270 | + { | |
271 | + ProtectLevel = PROCESS_PROTECTION_DEFAULT; | |
272 | + break; | |
273 | + } | |
274 | + else if(strcmp(Option, "--protect-high") == 0) | |
275 | + { | |
276 | + ProtectLevel = PROCESS_PROTECTION_HIGH; | |
277 | + break; | |
278 | + } | |
279 | + else if(strcmp(Option, "--protect-medium") == 0) | |
280 | + { | |
281 | + ProtectLevel = PROCESS_PROTECTION_MEDIUM; | |
282 | + break; | |
283 | + } | |
284 | + else if(strcmp(Option, "--protect-low") == 0) | |
285 | + { | |
286 | + ProtectLevel = PROCESS_PROTECTION_LOW; | |
287 | + break; | |
288 | + } | |
282 | 289 | } |
283 | - else if(strcmp(Option, "--protect-low") == 0) | |
290 | + if(ProtectLevel != PROCESS_PROTECTION_NONE) | |
284 | 291 | { |
285 | - ProtectLevel = PROCESS_PROTECTION_LOW; | |
286 | - break; | |
287 | - } | |
288 | - } | |
289 | - if(ProtectLevel != PROCESS_PROTECTION_NONE) | |
290 | - { | |
291 | - SetProcessProtectionLevel(ProtectLevel); | |
292 | - if(!InitializeLoadLibraryHook()) | |
293 | - { | |
294 | - MessageBox(NULL, MSGJPN321, "FFFTP", MB_OK | MB_ICONERROR); | |
295 | - return 0; | |
296 | - } | |
292 | + SetProcessProtectionLevel(ProtectLevel); | |
293 | + if(!InitializeLoadLibraryHook()) | |
294 | + { | |
295 | + MessageBox(NULL, MSGJPN321, "FFFTP", MB_OK | MB_ICONERROR); | |
296 | + return 0; | |
297 | + } | |
297 | 298 | #ifndef _DEBUG |
298 | - if(IsDebuggerPresent()) | |
299 | - { | |
300 | - MessageBox(NULL, MSGJPN322, "FFFTP", MB_OK | MB_ICONERROR); | |
301 | - return 0; | |
302 | - } | |
299 | + if(IsDebuggerPresent()) | |
300 | + { | |
301 | + MessageBox(NULL, MSGJPN322, "FFFTP", MB_OK | MB_ICONERROR); | |
302 | + return 0; | |
303 | + } | |
303 | 304 | #endif |
304 | - if(!UnloadUntrustedModule()) | |
305 | - { | |
306 | - MessageBox(NULL, MSGJPN323, "FFFTP", MB_OK | MB_ICONERROR); | |
307 | - return 0; | |
308 | - } | |
305 | + if(!UnloadUntrustedModule()) | |
306 | + { | |
307 | + MessageBox(NULL, MSGJPN323, "FFFTP", MB_OK | MB_ICONERROR); | |
308 | + return 0; | |
309 | + } | |
309 | 310 | #ifndef _DEBUG |
310 | - if(RestartProtectedProcess(" --restart")) | |
311 | - return 0; | |
311 | + if(RestartProtectedProcess(" --restart")) | |
312 | + return 0; | |
312 | 313 | #endif |
313 | - if(!EnableLoadLibraryHook(TRUE)) | |
314 | - { | |
315 | - MessageBox(NULL, MSGJPN324, "FFFTP", MB_OK | MB_ICONERROR); | |
316 | - return 0; | |
314 | + if(!EnableLoadLibraryHook(TRUE)) | |
315 | + { | |
316 | + MessageBox(NULL, MSGJPN324, "FFFTP", MB_OK | MB_ICONERROR); | |
317 | + return 0; | |
318 | + } | |
317 | 319 | } |
320 | + else | |
321 | + InitializeLoadLibraryHook(); | |
318 | 322 | } |
319 | - else | |
320 | - InitializeLoadLibraryHook(); | |
321 | 323 | #endif |
322 | 324 | |
323 | 325 | // マルチコアCPUの特定環境下でファイル通信中にクラッシュするバグ対策 |
@@ -1046,8 +1046,16 @@ BOOL LoadPuTTY() | ||
1046 | 1046 | RegisterTrustedModuleSHA1Hash("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"); |
1047 | 1047 | #endif |
1048 | 1048 | // デバッグ用 |
1049 | -// g_hPuTTY = LoadLibrary("putty.dll"); | |
1050 | - g_hPuTTY = LoadLibrary("C:\\SourceForge\\ffftp\\putty\\Debug\\PuTTY.dll"); | |
1049 | +#ifdef _DEBUG | |
1050 | + { | |
1051 | + char Path[MAX_PATH]; | |
1052 | + GetModuleFileName(NULL, Path, MAX_PATH); | |
1053 | + strcpy(strrchr(Path, '\\'), "\\..\\putty\\Debug\\PuTTY.dll"); | |
1054 | + g_hPuTTY = LoadLibrary(Path); | |
1055 | + } | |
1056 | +#else | |
1057 | + g_hPuTTY = LoadLibrary("putty.dll"); | |
1058 | +#endif | |
1051 | 1059 | if(!g_hPuTTY |
1052 | 1060 | || !(p_SFTP_Create = (_SFTP_Create)GetProcAddress(g_hPuTTY, "SFTP_Create")) |
1053 | 1061 | || !(p_SFTP_Destroy = (_SFTP_Destroy)GetProcAddress(g_hPuTTY, "SFTP_Destroy")) |