15
15
#include <restartmanager.h>
16
16
#pragma comment(lib, "Rstrtmgr.lib")
17
17
#define _LIBVALINET_INCLUDE_UNIVERSAL
18
+ #ifndef __cplusplus
18
19
#include <valinet/universal/toast/toast.h>
20
+ #endif
19
21
#include "osutility.h"
20
22
#include "queryversion.h"
21
23
#pragma comment(lib, "Psapi.lib")
22
24
#include <activscp.h>
23
25
#include <netlistmgr.h>
26
+ #include <Psapi.h>
24
27
25
28
#include "def.h"
26
29
27
30
#define WM_MSG_GUI_SECTION WM_USER + 1
28
31
#define WM_MSG_GUI_SECTION_GET 1
29
32
33
+ #ifdef __cplusplus
34
+ extern "C" {
35
+ #endif
36
+
30
37
DEFINE_GUID (CLSID_ImmersiveShell ,
31
38
0xc2f03a33 ,
32
39
0x21f5 , 0x47fa , 0xb4 , 0xbb ,
@@ -245,15 +252,15 @@ void printf_guid(GUID guid);
245
252
246
253
LRESULT CALLBACK BalloonWndProc (HWND hWnd , UINT msg , WPARAM wParam , LPARAM lParam );
247
254
248
- __declspec(dllexport ) CALLBACK ZZTestBalloon (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
255
+ __declspec(dllexport ) int CALLBACK ZZTestBalloon (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
249
256
250
- __declspec(dllexport ) CALLBACK ZZTestToast (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
257
+ __declspec(dllexport ) int CALLBACK ZZTestToast (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
251
258
252
- __declspec(dllexport ) CALLBACK ZZLaunchExplorer (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
259
+ __declspec(dllexport ) int CALLBACK ZZLaunchExplorer (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
253
260
254
- __declspec(dllexport ) CALLBACK ZZLaunchExplorerDelayed (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
261
+ __declspec(dllexport ) int CALLBACK ZZLaunchExplorerDelayed (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
255
262
256
- __declspec(dllexport ) CALLBACK ZZRestartExplorer (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
263
+ __declspec(dllexport ) int CALLBACK ZZRestartExplorer (HWND hWnd , HINSTANCE hInstance , LPSTR lpszCmdLine , int nCmdShow );
257
264
258
265
#define MIN (X , Y ) (((X) < (Y)) ? (X) : (Y))
259
266
#define MAX (X , Y ) (((X) > (Y)) ? (X) : (Y))
@@ -297,7 +304,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
297
304
pwszValue ,
298
305
0 ,
299
306
NULL ,
300
- pvData ,
307
+ ( LPBYTE ) pvData ,
301
308
pcbData
302
309
);
303
310
RegCloseKey (hKey );
@@ -324,7 +331,7 @@ inline LSTATUS SHRegGetValueFromHKCUHKLMWithOpt(
324
331
pwszValue ,
325
332
0 ,
326
333
NULL ,
327
- pvData ,
334
+ ( LPBYTE ) pvData ,
328
335
pcbData
329
336
);
330
337
RegCloseKey (hKey );
@@ -517,7 +524,7 @@ static DWORD RmSession = -1;
517
524
static wchar_t RmSessionKey [CCH_RM_SESSION_KEY + 1 ];
518
525
519
526
// shuts down the explorer and is ready for explorer restart
520
- inline void BeginExplorerRestart ()
527
+ inline DWORD WINAPI BeginExplorerRestart (LPVOID lpUnused )
521
528
{
522
529
if (RmStartSession (& RmSession , 0 , RmSessionKey ) == ERROR_SUCCESS )
523
530
{
@@ -535,6 +542,7 @@ inline void BeginExplorerRestart()
535
542
RmShutdown (RmSession , RmForceShutdown , 0 );
536
543
}
537
544
}
545
+ return 0 ;
538
546
}
539
547
// restarts the explorer
540
548
inline void FinishExplorerRestart ()
@@ -673,8 +681,9 @@ inline BOOL IncrementDLLReferenceCount(HINSTANCE hinst)
673
681
HMODULE hMod ;
674
682
GetModuleHandleExW (
675
683
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS ,
676
- hinst ,
684
+ ( LPCWSTR ) hinst ,
677
685
& hMod );
686
+ return TRUE;
678
687
}
679
688
680
689
inline BOOL WINAPI PatchContextMenuOfNewMicrosoftIME (BOOL * bFound )
@@ -786,7 +795,7 @@ BOOL ExtractMonitorByIndex(HMONITOR hMonitor, HDC hDC, LPRECT lpRect, MonitorOve
786
795
787
796
inline BOOL MaskCompare (PVOID pBuffer , LPCSTR lpPattern , LPCSTR lpMask )
788
797
{
789
- for (PBYTE value = pBuffer ; * lpMask ; ++ lpPattern , ++ lpMask , ++ value )
798
+ for (PBYTE value = ( PBYTE ) pBuffer ; * lpMask ; ++ lpPattern , ++ lpMask , ++ value )
790
799
{
791
800
if (* lpMask == 'x' && * (LPCBYTE )lpPattern != * value )
792
801
return FALSE;
@@ -810,3 +819,7 @@ inline PVOID FindPattern(PVOID pBase, SIZE_T dwSize, LPCSTR lpPattern, LPCSTR lp
810
819
return NULL ;
811
820
}
812
821
#endif
822
+
823
+ #ifdef __cplusplus
824
+ }
825
+ #endif
0 commit comments