|
|
 |
-
src/ch/ch.cpp
(+5 -17)
-
| |
24 |
24 |
#include "../common/ipcstructs.h" |
| |
25 |
25 |
#include <Dbghelp.h> |
| |
26 |
26 |
#include "CrashDlg.h" |
| |
27 |
27 |
#include "../common/version.h" |
| |
28 |
28 |
#include "TCommandLineParser.h" |
| |
29 |
29 |
|
| |
30 |
30 |
#ifdef _DEBUG |
| |
31 |
31 |
#define new DEBUG_NEW |
| |
32 |
32 |
#endif |
| |
33 |
33 |
|
| |
34 |
34 |
#ifdef _DEBUG |
| |
35 |
35 |
#define new DEBUG_NEW |
| |
36 |
36 |
#undef THIS_FILE |
| |
37 |
37 |
static char THIS_FILE[] = __FILE__; |
| |
38 |
38 |
#endif |
| |
39 |
39 |
|
| |
40 |
40 |
|
| |
41 |
41 |
|
| |
42 |
42 |
|
| |
43 |
43 |
BEGIN_MESSAGE_MAP(CCopyHandlerApp, CWinApp) |
| |
44 |
|
|
| |
45 |
|
|
| |
46 |
44 |
END_MESSAGE_MAP() |
| |
47 |
45 |
|
| |
48 |
46 |
int iCount=98; |
| |
49 |
47 |
unsigned short msg[]={ 0x40d1, 0x4dcd, 0x8327, 0x6cdf, 0xb912, 0x017b, 0xac78, 0x1e04, 0x5637, |
| |
50 |
48 |
0x1822, 0x0a69, 0x1b40, 0x4169, 0x504d, 0x80ff, 0x6c2f, 0xa612, 0x017e, |
| |
51 |
49 |
0xac84, 0x1c8c, 0x552b, 0x16e2, 0x0a4b, 0x1dc0, 0x4179, 0x4d0d, 0x8337, |
| |
52 |
50 |
0x6c4f, 0x6512, 0x0169, 0xac46, 0x1db4, 0x55cf, 0x1652, 0x0a0b, 0x1480, |
| |
53 |
51 |
0x40fd, 0x470d, 0x822f, 0x6b8f, 0x6512, 0x013a, 0xac5a, 0x1d24, 0x5627, |
| |
54 |
52 |
0x1762, 0x0a27, 0x1240, 0x40f5, 0x3f8d, 0x8187, 0x690f, 0x6e12, 0x011c, |
| |
55 |
53 |
0xabc0, 0x1cc4, 0x567f, 0x1952, 0x0a51, 0x1cc0, 0x4175, 0x3ccd, 0x8377, |
| |
56 |
54 |
0x6c5f, 0x6512, 0x0186, 0xac7c, 0x1e04, 0x5677, 0x1412, 0x0a61, 0x1d80, |
| |
57 |
55 |
0x4169, 0x4e8d, 0x838f, 0x6c0f, 0xb212, 0x0132, 0xac7e, 0x1e54, 0x5593, |
| |
58 |
56 |
0x1412, 0x0a15, 0x3dc0, 0x4195, 0x4e0d, 0x832f, 0x67ff, 0x9812, 0x0186, |
| |
59 |
57 |
0xac6e, 0x1e4c, 0x5667, 0x1942, 0x0a47, 0x1f80, 0x4191, 0x4f8d }; |
| |
60 |
58 |
|
| |
61 |
59 |
int iOffCount=12; |
| |
62 |
60 |
unsigned char off[]={ 2, 6, 3, 4, 8, 0, 1, 3, 2, 4, 1, 6 }; |
| |
63 |
61 |
unsigned short _hash[]={ 0x3fad, 0x34cd, 0x7fff, 0x65ff, 0x4512, 0x0112, 0xabac, 0x1abc, 0x54ab, 0x1212, 0x0981, 0x0100 }; |
| |
64 |
62 |
|
| |
65 |
63 |
|
|
| |
443 |
441 |
strMsg.Format(_T("Registration succeeded, but still the shell extension has different version (0x%lx) than Copy Handler (0x%lx)."), lExtensionVersion, PRODUCT_VERSION1 << 24 | PRODUCT_VERSION2 << 16 | PRODUCT_VERSION3 << 8 | PRODUCT_VERSION4); |
| |
444 |
442 |
LOG_WARNING(strMsg); |
| |
445 |
443 |
|
| |
446 |
444 |
MsgBox(IDS_SHELL_EXTENSION_REGISTERED_MISMATCH_STRING, MB_ICONWARNING | MB_OK); |
| |
447 |
445 |
} |
| |
448 |
446 |
else if(hResult == S_OK) |
| |
449 |
447 |
MsgBox(IDS_REGISTEROK_STRING, MB_ICONINFORMATION | MB_OK); |
| |
450 |
448 |
} |
| |
451 |
449 |
|
| |
452 |
450 |
void CCopyHandlerApp::UnregisterShellExtension() |
| |
453 |
451 |
{ |
| |
454 |
452 |
CString strPath = CString(GetProgramPath()) + _T("\\"); |
| |
455 |
453 |
|
| |
456 |
454 |
#ifdef _WIN64 |
| |
457 |
455 |
strPath += _T("chext64.dll"); |
| |
458 |
456 |
#else |
| |
459 |
457 |
strPath += _T("chext.dll"); |
| |
460 |
458 |
#endif |
| |
461 |
459 |
|
| |
462 |
460 |
HRESULT hResult = m_tShellExtClient.UnRegisterShellExtDll(strPath); |
| |
463 |
|
if(FAILED(hResult)) |
| |
|
461 |
if(hResult == TYPE_E_REGISTRYACCESS) |
| |
464 |
462 |
{ |
| |
|
463 |
MsgBox(IDS_CHEXT_ALREADY_UNREGISTERED, MB_ICONINFORMATION | MB_OK); |
| |
|
464 |
} |
| |
|
465 |
else if(FAILED(hResult)) |
| |
|
466 |
{ |
| |
465 |
467 |
TCHAR szStr[256]; |
| |
466 |
468 |
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hResult, 0, szStr, 256, NULL); |
| |
467 |
469 |
while (szStr[_tcslen(szStr)-1] == _T('\n') || szStr[_tcslen(szStr)-1] == _T('\r') || szStr[_tcslen(szStr)-1] == _T('.')) |
| |
468 |
470 |
szStr[_tcslen(szStr)-1] = _T('\0'); |
| |
469 |
471 |
|
| |
470 |
472 |
ictranslate::CFormat fmt(GetResManager().LoadString(IDS_UNREGISTERERR_STRING)); |
| |
471 |
473 |
fmt.SetParam(_T("%errno"), (ulong_t)hResult); |
| |
472 |
474 |
fmt.SetParam(_T("%errdesc"), szStr); |
| |
473 |
475 |
|
| |
474 |
476 |
AfxMessageBox(fmt, MB_ICONERROR | MB_OK); |
| |
475 |
477 |
} |
| |
476 |
478 |
else if(hResult == S_OK) |
| |
477 |
479 |
MsgBox(IDS_UNREGISTEROK_STRING, MB_ICONINFORMATION | MB_OK); |
| |
478 |
480 |
} |
| |
479 |
481 |
|
| |
480 |
|
|
| |
481 |
|
|
| |
482 |
|
|
| |
483 |
|
|
| |
484 |
|
|
| |
485 |
|
|
| |
486 |
|
|
| |
487 |
|
|
| |
488 |
|
|
| |
489 |
|
|
| |
490 |
|
|
| |
491 |
|
|
| |
492 |
|
|
| |
493 |
|
|
| |
494 |
482 |
void CCopyHandlerApp::OnConfigNotify(const chcore::TStringSet& setPropNames) |
| |
495 |
483 |
{ |
| |
496 |
484 |
|
| |
497 |
485 |
if(setPropNames.HasValue(PropData<PP_PLANGUAGE>::GetPropertyName())) |
| |
498 |
486 |
{ |
| |
499 |
487 |
|
| |
500 |
488 |
CString strPath; |
| |
501 |
489 |
GetPropValue<PP_PLANGUAGE>(GetConfig(), strPath); |
| |
502 |
490 |
GetResManager().SetLanguage(ExpandPath(strPath.GetBufferSetLength(_MAX_PATH))); |
| |
503 |
491 |
strPath.ReleaseBuffer(); |
| |
504 |
492 |
} |
| |
505 |
493 |
|
| |
506 |
494 |
if(setPropNames.HasValue(PropData<PP_LOGENABLELOGGING>::GetPropertyName())) |
| |
507 |
495 |
{ |
| |
508 |
496 |
chcore::TLogger& rLogger = chcore::TLogger::Acquire(); |
| |
509 |
497 |
|
| |
510 |
498 |
rLogger.Enable(GetPropValue<PP_LOGENABLELOGGING>(GetConfig())); |
| |
511 |
499 |
} |
| |
512 |
500 |
|
| |
513 |
501 |
if(setPropNames.HasValue(PropData<PP_LOGLEVEL>::GetPropertyName())) |
|