diff --git a/SystemInformer/SystemInformer.def b/SystemInformer/SystemInformer.def
index 858a9aa8d5e3..5b58c2336c52 100644
--- a/SystemInformer/SystemInformer.def
+++ b/SystemInformer/SystemInformer.def
@@ -183,7 +183,7 @@ EXPORTS
PhWordMatchStringRef
PhWritePhTextHeader
PhaChoiceDialog
- PhaGetProcessKnownCommandLine
+ PhaGetProcessKnownCommandLine
; plugin
PhEnumeratePlugins
@@ -819,6 +819,7 @@ EXPORTS
; cpysave
PhGetGenericTreeNewLines
PhGetListViewItemText
+ PhGetIListViewItemText
PhGetListViewSelectedItemText
PhGetTreeNewText
@@ -900,6 +901,7 @@ EXPORTS
PhFindIListViewItemByFlags
PhFindListViewItemByFlags
PhFindListViewItemByParam
+ PhFindIListViewItemByParam
PhGetComboBoxString
PhGetDialogItemValue
PhGetIListViewItemParam
@@ -907,6 +909,7 @@ EXPORTS
PhGetListViewItemImageIndex
PhGetListViewItemParam
PhGetSelectedListViewItemParam
+ PhGetSelectedIListViewItemParam
PhGetSelectedListViewItemParams
PhGetSelectedIListViewItemParams
PhGetStockApplicationIcon
@@ -935,9 +938,10 @@ EXPORTS
PhModalPropertySheet
PhQueryDirectXExclusiveOwnership
PhInitializeWindowTheme
- PhReInitializeWindowTheme
+ PhReInitializeTheme
PhRegisterWindowCallback
PhRemoveListViewItem
+ PhRemoveIListViewItem
PhRemoveWindowContext
PhSelectComboBoxString
PhSetClipboardString
@@ -949,6 +953,7 @@ EXPORTS
PhSetHeaderSortIcon
PhSetImageListBitmap
PhSetListViewItemImageIndex
+ PhSetIListViewItemImageIndex
PhSetListViewItemParam
PhSetListViewSubItem
PhSetIListViewSubItem
@@ -956,14 +961,19 @@ EXPORTS
PhSetWindowContext
PhSetWindowText
PhTerminateWindow
+ PhUnregisterWindowCallback
+ PhThemeWindowDrawButton
PhThemeWindowDrawRebar
PhThemeWindowDrawToolbar
- PhUnregisterWindowCallback
PhWindowThemeControlColor
+ PhIsThemeSupportEnabled
+ PhWindowThemeSetDarkMode
+ PhReInitializeStreamerMode
; hndlinfo
PhCallKphQueryFileInformationWithTimeout
PhCreateHandleItem
+ PhShowHandlePropertiesEx
PhCompareObjects
PhEnumObjectTypes
PhFormatNativeKeyName
@@ -1195,4 +1205,4 @@ EXPORTS
KphQueryInformationDriver
KphQueryInformationObject
KsiEnumerateProcessHandles
- KsiQueryHashInformationFile
+ KsiQueryHashInformationFile
\ No newline at end of file
diff --git a/SystemInformer/SystemInformer.def.h b/SystemInformer/SystemInformer.def.h
index b93c2e190455..81ec09d4bbfa 100644
--- a/SystemInformer/SystemInformer.def.h
+++ b/SystemInformer/SystemInformer.def.h
@@ -20,1089 +20,1101 @@
#ifndef _PH_EXPORT_DEF_H
#define _PH_EXPORT_DEF_H
-#define EXPORT_PHADDPROCESSPROPPAGE 1001
-#define EXPORT_PHADDPROCESSPROPPAGE2 1002
-#define EXPORT_PHADDPROPPAGELAYOUTITEM 1003
-#define EXPORT_PHADDTREENEWFILTER 1004
-#define EXPORT_PHAPPLYTREENEWFILTERS 1005
-#define EXPORT_PHAPPLYTREENEWFILTERSTONODE 1006
-#define EXPORT_PHCHOICEDIALOG 1007
-#define EXPORT_PHCMLOADSETTINGS 1008
-#define EXPORT_PHCMSAVESETTINGS 1009
-#define EXPORT_PHCOPYLISTVIEW 1010
-#define EXPORT_PHCOPYLISTVIEWINFOTIP 1011
-#define EXPORT_PHCREATEKSISETTINGSBLOB 1012
-#define EXPORT_PHCREATEPROCESSPROPCONTEXT 1013
-#define EXPORT_PHCREATEPROCESSPROPPAGECONTEXT 1014
-#define EXPORT_PHCREATEPROCESSPROPPAGECONTEXTEX 1015
-#define EXPORT_PHCREATESEARCHCONTROL 1016
-#define EXPORT_PHCREATESERVICELISTCONTROL 1017
-#define EXPORT_PHDELETEMEMORYITEMLIST 1018
-#define EXPORT_PHDELETESTATICWINDOWICON 1019
-#define EXPORT_PHDELETETREENEWCOLUMNMENU 1020
-#define EXPORT_PHDELETETREENEWFILTERSUPPORT 1021
-#define EXPORT_PHDEREFERENCEPROCESSRECORD 1022
-#define EXPORT_PHDESELECTALLPROCESSNODES 1023
-#define EXPORT_PHDESELECTALLSERVICENODES 1024
-#define EXPORT_PHDESTROYWINDOWICON 1025
-#define EXPORT_PHDEVICEPROVIDERINITIALIZATION 1026
-#define EXPORT_PHDOPROPPAGELAYOUT 1027
-#define EXPORT_PHDUPLICATEPROCESSINFORMATION 1028
-#define EXPORT_PHDUPLICATEPROCESSNODELIST 1029
-#define EXPORT_PHENUMNETWORKITEMS 1030
-#define EXPORT_PHENUMNETWORKITEMSBYPROCESSID 1031
-#define EXPORT_PHENUMPROCESSITEMS 1032
-#define EXPORT_PHEXECUTERUNASCOMMAND2 1033
-#define EXPORT_PHEXECUTERUNASCOMMAND3 1034
-#define EXPORT_PHEXPANDALLPROCESSNODES 1035
-#define EXPORT_PHFINDNETWORKNODE 1036
-#define EXPORT_PHFINDPROCESSNODE 1037
-#define EXPORT_PHFINDPROCESSRECORD 1038
-#define EXPORT_PHFINDSERVICENODE 1039
-#define EXPORT_PHFORMATLOGENTRY 1040
-#define EXPORT_PHGETAPPLICATIONICON 1041
-#define EXPORT_PHGETAPPLICATIONICONEX 1042
-#define EXPORT_PHGETCLIENTIDNAME 1043
-#define EXPORT_PHGETCLIENTIDNAMEEX 1044
-#define EXPORT_PHGETDEVICEICON 1045
-#define EXPORT_PHGETDEVICEPROPERTY 1046
-#define EXPORT_PHGETFILTERSUPPORTNETWORKTREELIST 1047
-#define EXPORT_PHGETFILTERSUPPORTPROCESSTREELIST 1048
-#define EXPORT_PHGETFILTERSUPPORTSERVICETREELIST 1049
-#define EXPORT_PHGETGENERALCALLBACK 1050
-#define EXPORT_PHGETIMAGELISTICON 1051
-#define EXPORT_PHGETLISTVIEWCONTEXTMENUPOINT 1052
-#define EXPORT_PHGETPHRELEASECHANNEL 1053
-#define EXPORT_PHGETPHRELEASECHANNELSTRING 1054
-#define EXPORT_PHGETPHVERSION 1055
-#define EXPORT_PHGETPHVERSIONHASH 1056
-#define EXPORT_PHGETPHVERSIONNUMBERS 1057
-#define EXPORT_PHGETPROCESSISSUSPENDED 1058
-#define EXPORT_PHGETPROCESSKNOWNTYPE 1059
-#define EXPORT_PHGETPROCESSKNOWNTYPEEX 1060
-#define EXPORT_PHGETPROCESSPRIORITYCLASSSTRING 1061
-#define EXPORT_PHGETPROCESSSMALLIMAGELIST 1062
-#define EXPORT_PHGETPROTOCOLTYPENAME 1063
-#define EXPORT_PHGETSELECTEDANDPROPAGATEPROCESSITEMS 1064
-#define EXPORT_PHGETSELECTEDPROCESSITEM 1065
-#define EXPORT_PHGETSELECTEDPROCESSITEMS 1066
-#define EXPORT_PHGETSELECTEDPROCESSNODES 1067
-#define EXPORT_PHGETSELECTEDSERVICEITEM 1068
-#define EXPORT_PHGETSELECTEDSERVICEITEMS 1069
-#define EXPORT_PHGETSERVICECHANGE 1070
-#define EXPORT_PHGETSHIELDBITMAP 1071
-#define EXPORT_PHGETSTATISTICSTIME 1072
-#define EXPORT_PHGETSTATISTICSTIMESTRING 1073
-#define EXPORT_PHGETTCPSTATENAME 1074
-#define EXPORT_PHHANDLECOPYCELLEMENUITEM 1075
-#define EXPORT_PHHANDLECOPYLISTVIEWEMENUITEM 1076
-#define EXPORT_PHHANDLELISTVIEWNOTIFYBEHAVIORS 1077
-#define EXPORT_PHHANDLELISTVIEWNOTIFYFORCOPY 1078
-#define EXPORT_PHHANDLETREENEWCOLUMNMENU 1079
-#define EXPORT_PHIMAGELISTEXTRACTICON 1080
-#define EXPORT_PHIMAGELISTFLUSHCACHE 1081
-#define EXPORT_PHINITIALIZETREENEWCOLUMNMENU 1082
-#define EXPORT_PHINITIALIZETREENEWCOLUMNMENUEX 1083
-#define EXPORT_PHINITIALIZETREENEWFILTERSUPPORT 1084
-#define EXPORT_PHINSERTCOPYCELLEMENUITEM 1085
-#define EXPORT_PHINSERTCOPYLISTVIEWEMENUITEM 1086
-#define EXPORT_PHINSERTHANDLEOBJECTPROPERTIESEMENUITEMS 1087
-#define EXPORT_PHINVALIDATEALLPROCESSNODES 1088
-#define EXPORT_PHISPROCESSSUSPENDED 1089
-#define EXPORT_PHLOADSYMBOLPROVIDEROPTIONS 1090
-#define EXPORT_PHLOGMESSAGEENTRY 1091
-#define EXPORT_PHLOOKUPDEVICEITEM 1092
-#define EXPORT_PHLOOKUPDEVICEITEMBYHASH 1093
-#define EXPORT_PHLOOKUPDEVICEPROPERTYCLASS 1094
-#define EXPORT_PHLOOKUPMEMORYITEMLIST 1095
-#define EXPORT_PHPROCESSIMAGELISTINITIALIZATION 1096
-#define EXPORT_PHPROPPAGEDLGPROCHEADER 1097
-#define EXPORT_PHQUERYMEMORYITEMLIST 1098
-#define EXPORT_PHREFERENCEDEVICEITEM 1099
-#define EXPORT_PHREFERENCEDEVICEITEM2 1100
-#define EXPORT_PHREFERENCEDEVICEITEMBYHASH 1101
-#define EXPORT_PHREFERENCEDEVICETREE 1102
-#define EXPORT_PHREFERENCEDEVICETREEEX 1103
-#define EXPORT_PHREFERENCENETWORKITEM 1104
-#define EXPORT_PHREFERENCEPROCESSITEM 1105
-#define EXPORT_PHREFERENCEPROCESSITEMFORPARENT 1106
-#define EXPORT_PHREFERENCEPROCESSITEMFORRECORD 1107
-#define EXPORT_PHREFERENCEPROCESSRECORD 1108
-#define EXPORT_PHREFERENCEPROCESSRECORDFORSTATISTICS 1109
-#define EXPORT_PHREFERENCEPROCESSRECORDSAFE 1110
-#define EXPORT_PHREFERENCESERVICEITEM 1111
-#define EXPORT_PHREGISTERDIALOG 1112
-#define EXPORT_PHREGISTERMESSAGELOOPFILTER 1113
-#define EXPORT_PHREMOVETREENEWFILTER 1114
-#define EXPORT_PHSEARCHCONTROLMATCH 1115
-#define EXPORT_PHSEARCHCONTROLMATCHLONGHINTZ 1116
-#define EXPORT_PHSEARCHCONTROLMATCHPOINTER 1117
-#define EXPORT_PHSEARCHCONTROLMATCHPOINTERRANGE 1118
-#define EXPORT_PHSEARCHCONTROLMATCHZ 1119
-#define EXPORT_PHSEARCHONLINESTRING 1120
-#define EXPORT_PHSELECTANDENSUREVISIBLEPROCESSNODE 1121
-#define EXPORT_PHSELECTANDENSUREVISIBLESERVICENODE 1122
-#define EXPORT_PHSETAPPLICATIONWINDOWICON 1123
-#define EXPORT_PHSETAPPLICATIONWINDOWICONEX 1124
-#define EXPORT_PHSETPROCESSITEMAFFINITYMASK 1125
-#define EXPORT_PHSETPROCESSITEMIOPRIORITY 1126
-#define EXPORT_PHSETPROCESSITEMPAGEPRIORITY 1127
-#define EXPORT_PHSETPROCESSITEMPRIORITY 1128
-#define EXPORT_PHSETPROCESSITEMPRIORITYBOOST 1129
-#define EXPORT_PHSETPROCESSITEMTHROTTLINGSTATE 1130
-#define EXPORT_PHSETSELECTTHREADIDPROCESSPROPCONTEXT 1131
-#define EXPORT_PHSETSTATICWINDOWICON 1132
-#define EXPORT_PHSETWINDOWICON 1133
-#define EXPORT_PHSHELLEXECUTEUSERSTRING 1134
-#define EXPORT_PHSHELLOPENKEY 1135
-#define EXPORT_PHSHELLOPENKEY2 1136
-#define EXPORT_PHSHELLPROCESSHACKER 1137
-#define EXPORT_PHSHOWCHOOSEPROCESSDIALOG 1138
-#define EXPORT_PHSHOWHANDLEOBJECTPROPERTIES1 1139
-#define EXPORT_PHSHOWHANDLEOBJECTPROPERTIES2 1140
-#define EXPORT_PHSHOWICONNOTIFICATION 1141
-#define EXPORT_PHSHOWPROCESSAFFINITYDIALOG2 1142
-#define EXPORT_PHSHOWPROCESSPROPERTIES 1143
-#define EXPORT_PHSHOWPROCESSRECORDDIALOG 1144
-#define EXPORT_PHSHOWSYSTEMINFORMATIONDIALOG 1145
-#define EXPORT_PHSHOWTHREADAFFINITYDIALOG 1146
-#define EXPORT_PHSIDOUBLELABELYFUNCTION 1147
-#define EXPORT_PHSISETCOLORSGRAPHDRAWINFO 1148
-#define EXPORT_PHSISIZELABELYFUNCTION 1149
-#define EXPORT_PHSIUINT64LABELYFUNCTION 1150
-#define EXPORT_PHUNREGISTERDIALOG 1151
-#define EXPORT_PHUNREGISTERMESSAGELOOPFILTER 1152
-#define EXPORT_PHUPDATEPROCESSNODE 1153
-#define EXPORT_PHUPDATESERVICENODE 1154
-#define EXPORT_PHWORDMATCHSTRINGREF 1155
-#define EXPORT_PHWRITEPHTEXTHEADER 1156
-#define EXPORT_PHACHOICEDIALOG 1157
-#define EXPORT_PHAGETPROCESSKNOWNCOMMANDLINE 1158
-#define EXPORT_PHENUMERATEPLUGINS 1159
-#define EXPORT_PHFINDPLUGIN2 1160
-#define EXPORT_PHGETPLUGINCALLBACK 1161
-#define EXPORT_PHGETPLUGINFILENAME 1162
-#define EXPORT_PHGETPLUGININFORMATION 1163
-#define EXPORT_PHGETPLUGININTERFACE 1164
-#define EXPORT_PHGETPLUGINNAME 1165
-#define EXPORT_PHPLUGINADDMENUHOOK 1166
-#define EXPORT_PHPLUGINADDTREENEWCOLUMN 1167
-#define EXPORT_PHPLUGINCALLPHSVC 1168
-#define EXPORT_PHPLUGINCREATEEMENUITEM 1169
-#define EXPORT_PHPLUGINCREATETABPAGE 1170
-#define EXPORT_PHPLUGINENABLETREENEWNOTIFY 1171
-#define EXPORT_PHPLUGINGETOBJECTEXTENSION 1172
-#define EXPORT_PHPLUGINGETSYSTEMSTATISTICS 1173
-#define EXPORT_PHPLUGININVOKEWINDOWCALLBACK 1174
-#define EXPORT_PHPLUGINQUERYPHSVC 1175
-#define EXPORT_PHPLUGINRESERVEIDS 1176
-#define EXPORT_PHPLUGINSETOBJECTEXTENSION 1177
-#define EXPORT_PHREGISTERPLUGIN 1178
-#define EXPORT_PHSVCCALLCHANGESERVICECONFIG 1179
-#define EXPORT_PHSVCCALLCHANGESERVICECONFIG2 1180
-#define EXPORT_PHSVCCALLPOSTMESSAGE 1181
-#define EXPORT_PHSVCCALLSENDMESSAGE 1182
-#define EXPORT_PHUICLOSECONNECTIONS 1183
-#define EXPORT_PHUICLOSEHANDLES 1184
-#define EXPORT_PHUICONNECTSESSION 1185
-#define EXPORT_PHUICONNECTTOPHSVC 1186
-#define EXPORT_PHUICONNECTTOPHSVCEX 1187
-#define EXPORT_PHUICONTINUESERVICE 1188
-#define EXPORT_PHUICONTINUESERVICES 1189
-#define EXPORT_PHUIDEBUGPROCESS 1190
-#define EXPORT_PHUIDELETESERVICE 1191
-#define EXPORT_PHUIDETACHFROMDEBUGGERPROCESS 1192
-#define EXPORT_PHUIDISCONNECTFROMPHSVC 1193
-#define EXPORT_PHUIDISCONNECTSESSION 1194
-#define EXPORT_PHUIFLUSHHEAPPROCESSES 1195
-#define EXPORT_PHUIFREEMEMORY 1196
-#define EXPORT_PHUIFREEZETREEPROCESS 1197
-#define EXPORT_PHUIHIBERNATECOMPUTER 1198
-#define EXPORT_PHUILOADDLLPROCESS 1199
-#define EXPORT_PHUILOCKCOMPUTER 1200
-#define EXPORT_PHUILOGOFFCOMPUTER 1201
-#define EXPORT_PHUILOGOFFSESSION 1202
-#define EXPORT_PHUIPAUSESERVICE 1203
-#define EXPORT_PHUIPAUSESERVICES 1204
-#define EXPORT_PHUIREDUCEWORKINGSETPROCESSES 1205
-#define EXPORT_PHUIRESTARTCOMPUTER 1206
-#define EXPORT_PHUIRESTARTPROCESS 1207
-#define EXPORT_PHUIRESUMEPROCESSES 1208
-#define EXPORT_PHUIRESUMETHREADS 1209
-#define EXPORT_PHUIRESUMETREEPROCESS 1210
-#define EXPORT_PHUISETATTRIBUTESHANDLE 1211
-#define EXPORT_PHUISETBOOSTPRIORITYPROCESS 1212
-#define EXPORT_PHUISETBOOSTPRIORITYPROCESSES 1213
-#define EXPORT_PHUISETBOOSTPRIORITYTHREAD 1214
-#define EXPORT_PHUISETBOOSTPRIORITYTHREADS 1215
-#define EXPORT_PHUISETCRITICALPROCESS 1216
-#define EXPORT_PHUISETECOMODEPROCESS 1217
-#define EXPORT_PHUISETEXECUTIONREQUIREDPROCESS 1218
-#define EXPORT_PHUISETIOPRIORITYPROCESSES 1219
-#define EXPORT_PHUISETIOPRIORITYTHREAD 1220
-#define EXPORT_PHUISETPAGEPRIORITYPROCESS 1221
-#define EXPORT_PHUISETPAGEPRIORITYTHREAD 1222
-#define EXPORT_PHUISETPRIORITYPROCESSES 1223
-#define EXPORT_PHUISETPRIORITYTHREAD 1224
-#define EXPORT_PHUISETPRIORITYTHREADS 1225
-#define EXPORT_PHUISETVIRTUALIZATIONPROCESS 1226
-#define EXPORT_PHUISHUTDOWNCOMPUTER 1227
-#define EXPORT_PHUISLEEPCOMPUTER 1228
-#define EXPORT_PHUISTARTSERVICE 1229
-#define EXPORT_PHUISTARTSERVICES 1230
-#define EXPORT_PHUISTOPSERVICE 1231
-#define EXPORT_PHUISTOPSERVICES 1232
-#define EXPORT_PHUISUSPENDPROCESSES 1233
-#define EXPORT_PHUISUSPENDTHREADS 1234
-#define EXPORT_PHUISUSPENDTREEPROCESS 1235
-#define EXPORT_PHUITERMINATEPROCESSES 1236
-#define EXPORT_PHUITERMINATETHREADS 1237
-#define EXPORT_PHUITERMINATETREEPROCESS 1238
-#define EXPORT_PHUITHAWTREEPROCESS 1239
-#define EXPORT_PHUIUNLOADMODULE 1240
-#define EXPORT_PHAUTODEREFERENCEOBJECT 1241
-#define EXPORT_PHCREATEALLOC 1242
-#define EXPORT_PHCREATEOBJECT 1243
-#define EXPORT_PHCREATEOBJECTTYPE 1244
-#define EXPORT_PHCREATEOBJECTTYPEEX 1245
-#define EXPORT_PHDELETEAUTOPOOL 1246
-#define EXPORT_PHDEREFERENCEOBJECT 1247
-#define EXPORT_PHDEREFERENCEOBJECTDEFERDELETE 1248
-#define EXPORT_PHDEREFERENCEOBJECTEX 1249
-#define EXPORT_PHDRAINAUTOPOOL 1250
-#define EXPORT_PHGETOBJECTTYPE 1251
-#define EXPORT_PHGETOBJECTTYPEINFORMATION 1252
-#define EXPORT_PHINITIALIZEAUTOPOOL 1253
-#define EXPORT_PHREFERENCEOBJECT 1254
-#define EXPORT_PHREFERENCEOBJECTEX 1255
-#define EXPORT_PHREFERENCEOBJECTSAFE 1256
-#define EXPORT_PHFACQUIREQUEUEDLOCKEXCLUSIVE 1257
-#define EXPORT_PHFACQUIREQUEUEDLOCKSHARED 1258
-#define EXPORT_PHFPULSEALLCONDITION 1259
-#define EXPORT_PHFPULSECONDITION 1260
-#define EXPORT_PHFQUEUEWAKEEVENT 1261
-#define EXPORT_PHFRELEASEQUEUEDLOCKEXCLUSIVE 1262
-#define EXPORT_PHFRELEASEQUEUEDLOCKSHARED 1263
-#define EXPORT_PHFSETWAKEEVENT 1264
-#define EXPORT_PHFWAITFORCONDITION 1265
-#define EXPORT_PHFWAITFORCONDITIONEX 1266
-#define EXPORT_PHFWAITFORWAKEEVENT 1267
-#define EXPORT_PHFWAKEFORRELEASEQUEUEDLOCK 1268
-#define EXPORT_PHISEXECUTINGINWOW64 1269
-#define EXPORT_PHSYSTEMBASICINFORMATION 1270
-#define EXPORT_PHADDELEMENTAVLTREE 1271
-#define EXPORT_PHADDENTRYHASHTABLE 1272
-#define EXPORT_PHADDENTRYHASHTABLEEX 1273
-#define EXPORT_PHADDITEMARRAY 1274
-#define EXPORT_PHADDITEMLIST 1275
-#define EXPORT_PHADDITEMPOINTERLIST 1276
-#define EXPORT_PHADDITEMSIMPLEHASHTABLE 1277
-#define EXPORT_PHADDITEMSARRAY 1278
-#define EXPORT_PHADDITEMSLIST 1279
-#define EXPORT_PHADDPLUSMAXMEMORYSINGLES 1280
-#define EXPORT_PHALLOCATE 1281
-#define EXPORT_PHALLOCATEEXSAFE 1282
-#define EXPORT_PHALLOCATEFROMFREELIST 1283
-#define EXPORT_PHALLOCATEPAGE 1284
-#define EXPORT_PHALLOCATESAFE 1285
-#define EXPORT_PHAPPENDBYTESBUILDER 1286
-#define EXPORT_PHAPPENDBYTESBUILDER2 1287
-#define EXPORT_PHAPPENDBYTESBUILDEREX 1288
-#define EXPORT_PHAPPENDCHARSTRINGBUILDER 1289
-#define EXPORT_PHAPPENDCHARSTRINGBUILDER2 1290
-#define EXPORT_PHAPPENDFORMATSTRINGBUILDER 1291
-#define EXPORT_PHAPPENDFORMATSTRINGBUILDER_V 1292
-#define EXPORT_PHAPPENDSTRINGBUILDEREX 1293
-#define EXPORT_PHBUFFERTOHEXSTRING 1294
-#define EXPORT_PHBUFFERTOHEXSTRINGEX 1295
-#define EXPORT_PHCLEARARRAY 1296
-#define EXPORT_PHCLEARHASHTABLE 1297
-#define EXPORT_PHCLEARLIST 1298
-#define EXPORT_PHCOMPARESTRINGREF 1299
-#define EXPORT_PHCOMPARESTRINGZNATURAL 1300
-#define EXPORT_PHCONCATSTRINGREF2 1301
-#define EXPORT_PHCONCATSTRINGREF3 1302
-#define EXPORT_PHCONCATSTRINGREF4 1303
-#define EXPORT_PHCONCATSTRINGS 1304
-#define EXPORT_PHCONCATSTRINGS2 1305
-#define EXPORT_PHCONCATSTRINGS_V 1306
-#define EXPORT_PHCONVERTMULTIBYTETOUTF16 1307
-#define EXPORT_PHCONVERTMULTIBYTETOUTF16EX 1308
-#define EXPORT_PHCONVERTUTF16TOASCIIEX 1309
-#define EXPORT_PHCONVERTUTF16TOMULTIBYTE 1310
-#define EXPORT_PHCONVERTUTF16TOMULTIBYTEEX 1311
-#define EXPORT_PHCONVERTUTF16TOUTF8 1312
-#define EXPORT_PHCONVERTUTF16TOUTF8BUFFER 1313
-#define EXPORT_PHCONVERTUTF16TOUTF8EX 1314
-#define EXPORT_PHCONVERTUTF16TOUTF8SIZE 1315
-#define EXPORT_PHCONVERTUTF8TOUTF16 1316
-#define EXPORT_PHCONVERTUTF8TOUTF16BUFFER 1317
-#define EXPORT_PHCONVERTUTF8TOUTF16EX 1318
-#define EXPORT_PHCONVERTUTF8TOUTF16SIZE 1319
-#define EXPORT_PHCOPYBYTESZ 1320
-#define EXPORT_PHCOPYCONVERTCIRCULARBUFFERULONG 1321
-#define EXPORT_PHCOPYSTRINGZ 1322
-#define EXPORT_PHCOPYSTRINGZFROMBYTES 1323
-#define EXPORT_PHCOPYSTRINGZFROMMULTIBYTE 1324
-#define EXPORT_PHCOUNTSTRINGZ 1325
-#define EXPORT_PHCREATEBYTES 1326
-#define EXPORT_PHCREATEBYTESEX 1327
-#define EXPORT_PHCREATEHASHTABLE 1328
-#define EXPORT_PHCREATELIST 1329
-#define EXPORT_PHCREATEPOINTERLIST 1330
-#define EXPORT_PHCREATESIMPLEHASHTABLE 1331
-#define EXPORT_PHCREATESTRING3 1332
-#define EXPORT_PHCREATESTRINGEX 1333
-#define EXPORT_PHCREATETHREAD 1334
-#define EXPORT_PHCREATETHREAD2 1335
-#define EXPORT_PHCREATETHREADEX 1336
-#define EXPORT_PHDECODEUNICODEDECODER 1337
-#define EXPORT_PHDELAYEXECUTION 1338
-#define EXPORT_PHDELETEARRAY 1339
-#define EXPORT_PHDELETEBYTESBUILDER 1340
-#define EXPORT_PHDELETECALLBACK 1341
-#define EXPORT_PHDELETEFREELIST 1342
-#define EXPORT_PHDELETESTRINGBUILDER 1343
-#define EXPORT_PHDIVIDESINGLESBYSINGLE 1344
-#define EXPORT_PHDOSERRORTONTSTATUS 1345
-#define EXPORT_PHDUPLICATEBYTESZ 1346
-#define EXPORT_PHDUPLICATEBYTESZSAFE 1347
-#define EXPORT_PHDUPLICATESTRINGZ 1348
-#define EXPORT_PHENCODEUNICODE 1349
-#define EXPORT_PHENUMAVLTREE 1350
-#define EXPORT_PHENUMHASHTABLE 1351
-#define EXPORT_PHENUMPOINTERLISTEX 1352
-#define EXPORT_PHEQUALSTRINGREF 1353
-#define EXPORT_PHEXPONENTIATE 1354
-#define EXPORT_PHEXPONENTIATE64 1355
-#define EXPORT_PHEXTRACTICON 1356
-#define EXPORT_PHEXTRACTICONEX 1357
-#define EXPORT_PHFILLMEMORYULONG 1358
-#define EXPORT_PHFINALBYTESBUILDERBYTES 1359
-#define EXPORT_PHFINALSTRINGBUILDERSTRING 1360
-#define EXPORT_PHFINDCHARINSTRINGREF 1361
-#define EXPORT_PHFINDELEMENTAVLTREE 1362
-#define EXPORT_PHFINDENTRYHASHTABLE 1363
-#define EXPORT_PHFINDITEMLIST 1364
-#define EXPORT_PHFINDITEMPOINTERLIST 1365
-#define EXPORT_PHFINDITEMSIMPLEHASHTABLE 1366
-#define EXPORT_PHFINDLASTCHARINSTRINGREF 1367
-#define EXPORT_PHFINDSTRINGINSTRINGREF 1368
-#define EXPORT_PHFORMAT 1369
-#define EXPORT_PHFORMATBYTES 1370
-#define EXPORT_PHFORMATBYTES_V 1371
-#define EXPORT_PHFORMATSTRING 1372
-#define EXPORT_PHFORMATSTRING_V 1373
-#define EXPORT_PHFORMATTOBUFFER 1374
-#define EXPORT_PHFREE 1375
-#define EXPORT_PHFREEPAGE 1376
-#define EXPORT_PHFREETOFREELIST 1377
-#define EXPORT_PHGETLASTERROR 1378
-#define EXPORT_PHGETPRIMENUMBER 1379
-#define EXPORT_PHHASHBYTES 1380
-#define EXPORT_PHHASHSTRINGREF 1381
-#define EXPORT_PHHASHSTRINGREFEX 1382
-#define EXPORT_PHHEXSTRINGTOBUFFER 1383
-#define EXPORT_PHHEXSTRINGTOBUFFEREX 1384
-#define EXPORT_PHHUNGWINDOWFROMGHOSTWINDOW 1385
-#define EXPORT_PHINITIALIZEARRAY 1386
-#define EXPORT_PHINITIALIZEAVLTREE 1387
-#define EXPORT_PHINITIALIZEBYTESBUILDER 1388
-#define EXPORT_PHINITIALIZECALLBACK 1389
-#define EXPORT_PHINITIALIZEFREELIST 1390
-#define EXPORT_PHINITIALIZESTRINGBUILDER 1391
-#define EXPORT_PHINSERTITEMLIST 1392
-#define EXPORT_PHINSERTITEMSLIST 1393
-#define EXPORT_PHINSERTSTRINGBUILDER 1394
-#define EXPORT_PHINSERTSTRINGBUILDER2 1395
-#define EXPORT_PHINSERTSTRINGBUILDEREX 1396
-#define EXPORT_PHINTEGERTOSTRING64 1397
-#define EXPORT_PHINVOKECALLBACK 1398
-#define EXPORT_PHLOADINDIRECTSTRING 1399
-#define EXPORT_PHLOADRESOURCE 1400
-#define EXPORT_PHLOCALTIMETOSYSTEMTIME 1401
-#define EXPORT_PHLOWERBOUNDELEMENTAVLTREE 1402
-#define EXPORT_PHLOWERDUALBOUNDELEMENTAVLTREE 1403
-#define EXPORT_PHMAXMEMORYSINGLES 1404
-#define EXPORT_PHMAXIMUMELEMENTAVLTREE 1405
-#define EXPORT_PHMINIMUMELEMENTAVLTREE 1406
-#define EXPORT_PHNTSTATUSFILENOTFOUND 1407
-#define EXPORT_PHNTSTATUSTODOSERROR 1408
-#define EXPORT_PHPREDECESSORELEMENTAVLTREE 1409
-#define EXPORT_PHPRINTTIMESPAN 1410
-#define EXPORT_PHQUERYPERFORMANCECOUNTER 1411
-#define EXPORT_PHQUERYPERFORMANCEFREQUENCY 1412
-#define EXPORT_PHQUERYSYSTEMTIME 1413
-#define EXPORT_PHQUERYTIMEZONEBIAS 1414
-#define EXPORT_PHREALLOCATE 1415
-#define EXPORT_PHREALLOCATESAFE 1416
-#define EXPORT_PHREADTIMESTAMPCOUNTER 1417
-#define EXPORT_PHREFERENCEEMPTYSTRING 1418
-#define EXPORT_PHREGISTERCALLBACK 1419
-#define EXPORT_PHREGISTERCALLBACKEX 1420
-#define EXPORT_PHREMOVEELEMENTAVLTREE 1421
-#define EXPORT_PHREMOVEENTRYHASHTABLE 1422
-#define EXPORT_PHREMOVEITEMARRAY 1423
-#define EXPORT_PHREMOVEITEMLIST 1424
-#define EXPORT_PHREMOVEITEMPOINTERLIST 1425
-#define EXPORT_PHREMOVEITEMSIMPLEHASHTABLE 1426
-#define EXPORT_PHREMOVEITEMSARRAY 1427
-#define EXPORT_PHREMOVEITEMSLIST 1428
-#define EXPORT_PHREMOVESTRINGBUILDER 1429
-#define EXPORT_PHRESIZEARRAY 1430
-#define EXPORT_PHRESIZELIST 1431
-#define EXPORT_PHROUNDUPTOPOWEROFTWO 1432
-#define EXPORT_PHSECONDSSINCE1970TOTIME 1433
-#define EXPORT_PHSPLITSTRINGREFATCHAR 1434
-#define EXPORT_PHSPLITSTRINGREFATLASTCHAR 1435
-#define EXPORT_PHSPLITSTRINGREFATSTRING 1436
-#define EXPORT_PHSPLITSTRINGREFEX 1437
-#define EXPORT_PHSTRINGTODOUBLE 1438
-#define EXPORT_PHSTRINGTOINTEGER64 1439
-#define EXPORT_PHSTRINGTOUINT64 1440
-#define EXPORT_PHSUCCESSORELEMENTAVLTREE 1441
-#define EXPORT_PHSYSTEMTIMETOLOCALTIME 1442
-#define EXPORT_PHTIMETOSECONDSSINCE1970 1443
-#define EXPORT_PHTRIMSTRINGREF 1444
-#define EXPORT_PHUNREGISTERCALLBACK 1445
-#define EXPORT_PHUPPERBOUNDELEMENTAVLTREE 1446
-#define EXPORT_PHUPPERDUALBOUNDELEMENTAVLTREE 1447
-#define EXPORT_PHWRITEUNICODEDECODER 1448
-#define EXPORT_PHZEROEXTENDTOUTF16BUFFER 1449
-#define EXPORT_PHZEROEXTENDTOUTF16EX 1450
-#define EXPORT_PHFACQUIRERUNDOWNPROTECTION 1451
-#define EXPORT_PHFBEGININITONCE 1452
-#define EXPORT_PHFENDINITONCE 1453
-#define EXPORT_PHFINITIALIZEBARRIER 1454
-#define EXPORT_PHFINITIALIZEEVENT 1455
-#define EXPORT_PHFINITIALIZEINITONCE 1456
-#define EXPORT_PHFINITIALIZERUNDOWNPROTECTION 1457
-#define EXPORT_PHFRELEASERUNDOWNPROTECTION 1458
-#define EXPORT_PHFRESETEVENT 1459
-#define EXPORT_PHFSETEVENT 1460
-#define EXPORT_PHFWAITFORBARRIER 1461
-#define EXPORT_PHFWAITFOREVENT 1462
-#define EXPORT_PHFWAITFORRUNDOWNPROTECTION 1463
-#define EXPORT_PHENUMSMBIOS 1464
-#define EXPORT_PHGETSMBIOSSTRING 1465
-#define EXPORT_PHADJUSTPRIVILEGE 1466
-#define EXPORT_PHCONNECTPIPE 1467
-#define EXPORT_PHCREATEDIRECTORYFULLPATHWIN32 1468
-#define EXPORT_PHCREATEDIRECTORYWIN32 1469
-#define EXPORT_PHCREATEEVENT 1470
-#define EXPORT_PHCREATEFILE 1471
-#define EXPORT_PHCREATEFILEWIN32 1472
-#define EXPORT_PHCREATEFILEWIN32EX 1473
-#define EXPORT_PHCREATEKEY 1474
-#define EXPORT_PHCREATENAMEDPIPE 1475
-#define EXPORT_PHCREATEPIPE 1476
-#define EXPORT_PHDELETEDIRECTORYWIN32 1477
-#define EXPORT_PHDELETEFILE 1478
-#define EXPORT_PHDELETEFILEWIN32 1479
-#define EXPORT_PHDELETEVALUEKEY 1480
-#define EXPORT_PHDESTROYWINDOWREMOTE 1481
-#define EXPORT_PHDETERMINEDOSPATHNAMETYPE 1482
-#define EXPORT_PHDEVICEIOCONTROLFILE 1483
-#define EXPORT_PHDISCONNECTNAMEDPIPE 1484
-#define EXPORT_PHDOESFILEEXIST 1485
-#define EXPORT_PHDOESFILEEXISTWIN32 1486
-#define EXPORT_PHDOSPATHNAMETONTPATHNAME 1487
-#define EXPORT_PHENUMBIGPOOLINFORMATION 1488
-#define EXPORT_PHENUMDIRECTORYFILE 1489
-#define EXPORT_PHENUMDIRECTORYOBJECTS 1490
-#define EXPORT_PHENUMFILESTREAMS 1491
-#define EXPORT_PHENUMFIRMWAREENVIRONMENTVALUES 1492
-#define EXPORT_PHENUMGENERICMODULES 1493
-#define EXPORT_PHENUMHANDLESEX 1494
-#define EXPORT_PHENUMKERNELMODULES 1495
-#define EXPORT_PHENUMNEXTPROCESS 1496
-#define EXPORT_PHENUMNEXTTHREAD 1497
-#define EXPORT_PHENUMOBJECTIDINFORMATION 1498
-#define EXPORT_PHENUMPAGEFILES 1499
-#define EXPORT_PHENUMPOOLTAGINFORMATION 1500
-#define EXPORT_PHENUMPROCESSENVIRONMENTVARIABLES 1501
-#define EXPORT_PHENUMPROCESSES 1502
-#define EXPORT_PHENUMPROCESSESEX 1503
-#define EXPORT_PHENUMPROCESSHANDLES 1504
-#define EXPORT_PHENUMREPARSEPOINTINFORMATION 1505
-#define EXPORT_PHENUMERATEKEY 1506
-#define EXPORT_PHENUMERATEVALUEKEY 1507
-#define EXPORT_PHFILTERCONNECTCOMMUNICATIONPORT 1508
-#define EXPORT_PHFINDPROCESSINFORMATION 1509
-#define EXPORT_PHFINDPROCESSINFORMATIONBYIMAGENAME 1510
-#define EXPORT_PHGETACTIVEPROCESSORCOUNT 1511
-#define EXPORT_PHGETCONTEXTTHREAD 1512
-#define EXPORT_PHGETDEVICETYPE 1513
-#define EXPORT_PHGETDLLHANDLE 1514
-#define EXPORT_PHGETDRIVERIMAGEFILENAME 1515
-#define EXPORT_PHGETDRIVERNAME 1516
-#define EXPORT_PHGETDRIVERSERVICEKEYNAME 1517
-#define EXPORT_PHGETFILEFULLATTRIBUTESINFORMATION 1518
-#define EXPORT_PHGETFILENAME 1519
-#define EXPORT_PHGETFILEPOSITION 1520
-#define EXPORT_PHGETFILESIZE 1521
-#define EXPORT_PHGETFIRMWAREENVIRONMENTVARIABLE 1522
-#define EXPORT_PHGETJOBPROCESSIDLIST 1523
-#define EXPORT_PHGETKERNELFILENAME 1524
-#define EXPORT_PHGETKERNELFILENAME2 1525
-#define EXPORT_PHGETKERNELFILENAMEEX 1526
-#define EXPORT_PHGETMODULEPROCADDRESS 1527
-#define EXPORT_PHGETNAMEDPIPECLIENTCOMPUTERNAME 1528
-#define EXPORT_PHGETNAMEDPIPECLIENTPROCESSID 1529
-#define EXPORT_PHGETNAMEDPIPESERVERPROCESSID 1530
-#define EXPORT_PHGETOBJECTSECURITY 1531
-#define EXPORT_PHGETOBJECTTYPEINDEXNAME 1532
-#define EXPORT_PHGETOBJECTTYPENUMBER 1533
-#define EXPORT_PHGETOWNTOKENATTRIBUTES 1534
-#define EXPORT_PHGETPNPDEVICENAME 1535
-#define EXPORT_PHGETPROCEDUREADDRESS 1536
-#define EXPORT_PHGETPROCEDUREADDRESSREMOTE 1537
-#define EXPORT_PHGETPROCESSCOMMANDLINE 1538
-#define EXPORT_PHGETPROCESSDEPSTATUS 1539
-#define EXPORT_PHGETPROCESSDEVICEMAP 1540
-#define EXPORT_PHGETPROCESSENVIRONMENT 1541
-#define EXPORT_PHGETPROCESSIMAGEFILENAME 1542
-#define EXPORT_PHGETPROCESSIMAGEFILENAMEBYPROCESSID 1543
-#define EXPORT_PHGETPROCESSIMAGEFILENAMEWIN32 1544
-#define EXPORT_PHGETPROCESSISDOTNET 1545
-#define EXPORT_PHGETPROCESSISDOTNETEX 1546
-#define EXPORT_PHGETPROCESSMAPPEDFILENAME 1547
-#define EXPORT_PHGETPROCESSPEBSTRING 1548
-#define EXPORT_PHGETPROCESSPRIORITYCLASS 1549
-#define EXPORT_PHGETPROCESSUNLOADEDDLLS 1550
-#define EXPORT_PHGETPROCESSWINDOWTITLE 1551
-#define EXPORT_PHGETPROCESSWORKINGSETINFORMATION 1552
-#define EXPORT_PHGETPROCESSWSCOUNTERS 1553
-#define EXPORT_PHGETSECTIONFILENAME 1554
-#define EXPORT_PHGETTOKENGROUPS 1555
-#define EXPORT_PHGETTOKENINTEGRITYLEVEL 1556
-#define EXPORT_PHGETTOKENINTEGRITYLEVELRID 1557
-#define EXPORT_PHGETTOKENOWNER 1558
-#define EXPORT_PHGETTOKENPRIMARYGROUP 1559
-#define EXPORT_PHGETTOKENPRIVILEGES 1560
-#define EXPORT_PHGETTOKENUSER 1561
-#define EXPORT_PHIMPERSONATETOKEN 1562
-#define EXPORT_PHISDEBUGGERPRESENT 1563
-#define EXPORT_PHISFIRMWARESUPPORTED 1564
-#define EXPORT_PHLISTENNAMEDPIPE 1565
-#define EXPORT_PHLOADAPPKEY 1566
-#define EXPORT_PHMOVEFILEWIN32 1567
-#define EXPORT_PHOPENDIRECTORYOBJECT 1568
-#define EXPORT_PHOPENDRIVER 1569
-#define EXPORT_PHOPENFILE 1570
-#define EXPORT_PHOPENFILEBYID 1571
-#define EXPORT_PHOPENKEY 1572
-#define EXPORT_PHOPENPROCESS 1573
-#define EXPORT_PHOPENPROCESSCLIENTID 1574
-#define EXPORT_PHOPENPROCESSTOKEN 1575
-#define EXPORT_PHOPENTHREAD 1576
-#define EXPORT_PHOPENTHREADPROCESS 1577
-#define EXPORT_PHPEEKNAMEDPIPE 1578
-#define EXPORT_PHQUERYENVIRONMENTVARIABLE 1579
-#define EXPORT_PHQUERYFULLATTRIBUTESFILEWIN32 1580
-#define EXPORT_PHQUERYKEY 1581
-#define EXPORT_PHQUERYSYMBOLICLINKOBJECT 1582
-#define EXPORT_PHQUERYTOKENVARIABLESIZE 1583
-#define EXPORT_PHQUERYVALUEKEY 1584
-#define EXPORT_PHQUEUEUSERWORKITEM 1585
-#define EXPORT_PHREADFILE 1586
-#define EXPORT_PHRESOLVEDEVICEPREFIX 1587
-#define EXPORT_PHREVERTIMPERSONATIONTOKEN 1588
-#define EXPORT_PHSETFILEALLOCATIONSIZE 1589
-#define EXPORT_PHSETFILEPOSITION 1590
-#define EXPORT_PHSETFILESIZE 1591
-#define EXPORT_PHSETFIRMWAREENVIRONMENTVARIABLE 1592
-#define EXPORT_PHSETOBJECTSECURITY 1593
-#define EXPORT_PHSETPROCESSPOWERTHROTTLINGSTATE 1594
-#define EXPORT_PHSETPROCESSPRIORITYBOOST 1595
-#define EXPORT_PHSETPROCESSPRIORITYCLASS 1596
-#define EXPORT_PHSETTHREADBASEPRIORITY 1597
-#define EXPORT_PHSETTHREADIOPRIORITY 1598
-#define EXPORT_PHSETTHREADNAME 1599
-#define EXPORT_PHSETTOKENISVIRTUALIZATIONENABLED 1600
-#define EXPORT_PHSETTOKENPRIVILEGE 1601
-#define EXPORT_PHSETTOKENPRIVILEGE2 1602
-#define EXPORT_PHSETTOKENSESSIONID 1603
-#define EXPORT_PHSETVALUEKEY 1604
-#define EXPORT_PHTERMINATEPROCESS 1605
-#define EXPORT_PHTRACECONTROL 1606
-#define EXPORT_PHTRANSCEIVENAMEDPIPE 1607
-#define EXPORT_PHUNLOADDLLPROCESS 1608
-#define EXPORT_PHUNLOADDRIVER 1609
-#define EXPORT_PHUPDATEDOSDEVICEPREFIXES 1610
-#define EXPORT_PHUPDATEMUPDEVICEPREFIXES 1611
-#define EXPORT_PHWAITFORNAMEDPIPE 1612
-#define EXPORT_PHWRITEFILE 1613
-#define EXPORT_PHADJUSTRECTANGLETOBOUNDS 1614
-#define EXPORT_PHADJUSTRECTANGLETOWORKINGAREA 1615
-#define EXPORT_PHCENTERRECTANGLE 1616
-#define EXPORT_PHCENTERWINDOW 1617
-#define EXPORT_PHCOMPAREUNICODESTRINGZIGNOREMENUPREFIX 1618
-#define EXPORT_PHCONSOLESETFOREGROUND 1619
-#define EXPORT_PHCONSOLESETWINDOW 1620
-#define EXPORT_PHCREATEOPENFILEDIALOG 1621
-#define EXPORT_PHCREATEPROCESS 1622
-#define EXPORT_PHCREATEPROCESSASUSER 1623
-#define EXPORT_PHCREATEPROCESSREDIRECTION 1624
-#define EXPORT_PHCREATEPROCESSWIN32 1625
-#define EXPORT_PHCREATEPROCESSWIN32EX 1626
-#define EXPORT_PHCREATESAVEFILEDIALOG 1627
-#define EXPORT_PHDELETEIMAGEVERSIONINFO 1628
-#define EXPORT_PHDEVFREEOBJECTPROPERTIES 1629
-#define EXPORT_PHDEVFREEOBJECTS 1630
-#define EXPORT_PHDEVGETOBJECTPROPERTIES 1631
-#define EXPORT_PHDEVGETOBJECTS 1632
-#define EXPORT_PHELLIPSISSTRING 1633
-#define EXPORT_PHELLIPSISSTRINGPATH 1634
-#define EXPORT_PHESCAPECOMMANDLINEPART 1635
-#define EXPORT_PHESCAPESTRINGFORMENUPREFIX 1636
-#define EXPORT_PHEXPANDENVIRONMENTSTRINGS 1637
-#define EXPORT_PHFILEREADALLTEXTWIN32 1638
-#define EXPORT_PHFINALHASH 1639
-#define EXPORT_PHFORMATDATE 1640
-#define EXPORT_PHFORMATDATETIME 1641
-#define EXPORT_PHFORMATDECIMAL 1642
-#define EXPORT_PHFORMATGUID 1643
-#define EXPORT_PHFORMATIMAGEVERSIONINFO 1644
-#define EXPORT_PHFORMATSIZE 1645
-#define EXPORT_PHFORMATTIME 1646
-#define EXPORT_PHFORMATTIMESPAN 1647
-#define EXPORT_PHFORMATTIMESPANRELATIVE 1648
-#define EXPORT_PHFORMATUINT64 1649
-#define EXPORT_PHFREEFILEDIALOG 1650
-#define EXPORT_PHFREELIBRARY 1651
-#define EXPORT_PHFREELIBRARYASIMAGERESOURCE 1652
-#define EXPORT_PHGENERATEGUID 1653
-#define EXPORT_PHGENERATEGUIDFROMNAME 1654
-#define EXPORT_PHGENERATERANDOMALPHASTRING 1655
-#define EXPORT_PHGENERATERANDOMNUMBER64 1656
-#define EXPORT_PHGETAPPLICATIONDATAFILENAME 1657
-#define EXPORT_PHGETAPPLICATIONDIRECTORY 1658
-#define EXPORT_PHGETAPPLICATIONDIRECTORYFILENAME 1659
-#define EXPORT_PHGETAPPLICATIONDIRECTORYWIN32 1660
-#define EXPORT_PHGETAPPLICATIONFILENAMEWIN32 1661
-#define EXPORT_PHGETBASEDIRECTORY 1662
-#define EXPORT_PHGETBASENAME 1663
-#define EXPORT_PHGETCLASSOBJECT 1664
-#define EXPORT_PHGETDLLFILENAME 1665
-#define EXPORT_PHGETCLIENTRECT 1666
-#define EXPORT_PHGETDPI 1667
-#define EXPORT_PHGETDPIVALUE 1668
-#define EXPORT_PHGETFILEDIALOGFILENAME 1669
-#define EXPORT_PHGETFILEDIALOGFILTERINDEX 1670
-#define EXPORT_PHGETFILEDIALOGOPTIONS 1671
-#define EXPORT_PHGETFILEVERSIONFIXEDINFO 1672
-#define EXPORT_PHGETFILEVERSIONINFO 1673
-#define EXPORT_PHGETFILEVERSIONINFOEX 1674
-#define EXPORT_PHGETFILEVERSIONINFOLANGCODEPAGE 1675
-#define EXPORT_PHGETFILEVERSIONINFOSTRING 1676
-#define EXPORT_PHGETFILEVERSIONINFOSTRING2 1677
-#define EXPORT_PHGETFULLPATH 1678
-#define EXPORT_PHGETKNOWNFOLDERPATH 1679
-#define EXPORT_PHGETKNOWNLOCATION 1680
-#define EXPORT_PHGETMESSAGE 1681
-#define EXPORT_PHGETMONITORDPI 1682
-#define EXPORT_PHGETNTMESSAGE 1683
-#define EXPORT_PHGETNTSYSTEMROOT 1684
-#define EXPORT_PHGETSIZEDPIVALUE 1685
-#define EXPORT_PHGETSTATUSMESSAGE 1686
-#define EXPORT_PHGETSYSTEMDIRECTORY 1687
-#define EXPORT_PHGETSYSTEMDPI 1688
-#define EXPORT_PHGETSYSTEMMETRICS 1689
-#define EXPORT_PHGETSYSTEMPARAMETERSINFO 1690
-#define EXPORT_PHGETSYSTEMROOT 1691
-#define EXPORT_PHGETTASKBARDPI 1692
-#define EXPORT_PHGETTEMPORARYDIRECTORYRANDOMALPHAFILENAME 1693
-#define EXPORT_PHGETWIN32MESSAGE 1694
-#define EXPORT_PHGETWINDOWDPI 1695
-#define EXPORT_PHINITIALIZEHASH 1696
-#define EXPORT_PHINITIALIZEIMAGEVERSIONINFO 1697
-#define EXPORT_PHINITIALIZEIMAGEVERSIONINFOEX 1698
-#define EXPORT_PHINITIALIZEPROCTHREADATTRIBUTELIST 1699
-#define EXPORT_PHLARGEINTEGERTOLOCALSYSTEMTIME 1700
-#define EXPORT_PHLARGEINTEGERTOSYSTEMTIME 1701
-#define EXPORT_PHLOADLIBRARY 1702
-#define EXPORT_PHLOADLIBRARYASIMAGERESOURCE 1703
-#define EXPORT_PHMAPFLAGS1 1704
-#define EXPORT_PHMAPFLAGS2 1705
-#define EXPORT_PHMATCHWILDCARDS 1706
-#define EXPORT_PHPARSECOMMANDLINE 1707
-#define EXPORT_PHPARSECOMMANDLINEFUZZY 1708
-#define EXPORT_PHPARSECOMMANDLINEPART 1709
-#define EXPORT_PHQUERYREGISTRYSTRING 1710
-#define EXPORT_PHQUERYREGISTRYULONG 1711
-#define EXPORT_PHQUERYREGISTRYULONG64 1712
-#define EXPORT_PHSETFILEDIALOGFILENAME 1713
-#define EXPORT_PHSETFILEDIALOGFILTER 1714
-#define EXPORT_PHSETFILEDIALOGOPTIONS 1715
-#define EXPORT_PHSHELLEXECUTE 1716
-#define EXPORT_PHSHELLEXECUTEEX 1717
-#define EXPORT_PHSHELLEXPLOREFILE 1718
-#define EXPORT_PHSHELLPROPERTIES 1719
-#define EXPORT_PHSHOWCONFIRMMESSAGE 1720
-#define EXPORT_PHSHOWCONTINUESTATUS 1721
-#define EXPORT_PHSHOWFILEDIALOG 1722
-#define EXPORT_PHSHOWMESSAGE 1723
-#define EXPORT_PHSHOWMESSAGE2 1724
-#define EXPORT_PHSHOWMESSAGEONETIME 1725
-#define EXPORT_PHSHOWSTATUS 1726
-#define EXPORT_PHSHOWTASKDIALOG 1727
-#define EXPORT_PHSTRINGTOGUID 1728
-#define EXPORT_PHSYSTEMTIMETOLARGEINTEGER 1729
-#define EXPORT_PHSYSTEMTIMETOTZSPECIFICLOCALTIME 1730
-#define EXPORT_PHTASKBARLISTCREATE 1731
-#define EXPORT_PHTASKBARLISTDESTROY 1732
-#define EXPORT_PHTASKBARLISTSETOVERLAYICON 1733
-#define EXPORT_PHTASKBARLISTSETPROGRESSSTATE 1734
-#define EXPORT_PHTASKBARLISTSETPROGRESSVALUE 1735
-#define EXPORT_PHUPDATEHASH 1736
-#define EXPORT_PHUPDATEPROCTHREADATTRIBUTE 1737
-#define EXPORT_PHWAITFORMULTIPLEOBJECTSANDPUMP 1738
-#define EXPORT_PHCLEARCIRCULARBUFFER_FLOAT 1739
-#define EXPORT_PHCLEARCIRCULARBUFFER_PVOID 1740
-#define EXPORT_PHCLEARCIRCULARBUFFER_ULONG 1741
-#define EXPORT_PHCLEARCIRCULARBUFFER_ULONG64 1742
-#define EXPORT_PHCOPYCIRCULARBUFFER_FLOAT 1743
-#define EXPORT_PHCOPYCIRCULARBUFFER_PVOID 1744
-#define EXPORT_PHCOPYCIRCULARBUFFER_ULONG 1745
-#define EXPORT_PHCOPYCIRCULARBUFFER_ULONG64 1746
-#define EXPORT_PHDELETECIRCULARBUFFER_FLOAT 1747
-#define EXPORT_PHDELETECIRCULARBUFFER_PVOID 1748
-#define EXPORT_PHDELETECIRCULARBUFFER_ULONG 1749
-#define EXPORT_PHDELETECIRCULARBUFFER_ULONG64 1750
-#define EXPORT_PHINITIALIZECIRCULARBUFFER_FLOAT 1751
-#define EXPORT_PHINITIALIZECIRCULARBUFFER_PVOID 1752
-#define EXPORT_PHINITIALIZECIRCULARBUFFER_ULONG 1753
-#define EXPORT_PHINITIALIZECIRCULARBUFFER_ULONG64 1754
-#define EXPORT_PHRESIZECIRCULARBUFFER_FLOAT 1755
-#define EXPORT_PHRESIZECIRCULARBUFFER_PVOID 1756
-#define EXPORT_PHRESIZECIRCULARBUFFER_ULONG 1757
-#define EXPORT_PHRESIZECIRCULARBUFFER_ULONG64 1758
-#define EXPORT_PHGETGENERICTREENEWLINES 1759
-#define EXPORT_PHGETLISTVIEWITEMTEXT 1760
-#define EXPORT_PHGETLISTVIEWSELECTEDITEMTEXT 1761
-#define EXPORT_PHGETTREENEWTEXT 1762
-#define EXPORT_PHCREATEEMENU 1763
-#define EXPORT_PHCREATEEMENUITEM 1764
-#define EXPORT_PHDESTROYEMENU 1765
-#define EXPORT_PHDESTROYEMENUITEM 1766
-#define EXPORT_PHFINDEMENUITEM 1767
-#define EXPORT_PHINDEXOFEMENUITEM 1768
-#define EXPORT_PHINSERTEMENUITEM 1769
-#define EXPORT_PHLOADRESOURCEEMENUITEM 1770
-#define EXPORT_PHMODIFYEMENUITEM 1771
-#define EXPORT_PHREMOVEALLEMENUITEMS 1772
-#define EXPORT_PHREMOVEEMENUITEM 1773
-#define EXPORT_PHSETFLAGSALLEMENUITEMS 1774
-#define EXPORT_PHSETFLAGSEMENUITEM 1775
-#define EXPORT_PHSHOWEMENU 1776
-#define EXPORT_PHDELETEFASTLOCK 1777
-#define EXPORT_PHINITIALIZEFASTLOCK 1778
-#define EXPORT_PHFACQUIREFASTLOCKEXCLUSIVE 1779
-#define EXPORT_PHFACQUIREFASTLOCKSHARED 1780
-#define EXPORT_PHFRELEASEFASTLOCKEXCLUSIVE 1781
-#define EXPORT_PHFRELEASEFASTLOCKSHARED 1782
-#define EXPORT_PHFTRYACQUIREFASTLOCKEXCLUSIVE 1783
-#define EXPORT_PHFTRYACQUIREFASTLOCKSHARED 1784
-#define EXPORT_PHCREATEFILESTREAM 1785
-#define EXPORT_PHCREATEFILESTREAM2 1786
-#define EXPORT_PHFLUSHFILESTREAM 1787
-#define EXPORT_PHGETPOSITIONFILESTREAM 1788
-#define EXPORT_PHLOCKFILESTREAM 1789
-#define EXPORT_PHREADFILESTREAM 1790
-#define EXPORT_PHSEEKFILESTREAM 1791
-#define EXPORT_PHUNLOCKFILESTREAM 1792
-#define EXPORT_PHVERIFYFILESTREAM 1793
-#define EXPORT_PHWRITEFILESTREAM 1794
-#define EXPORT_PHWRITESTRINGASUTF8FILESTREAM 1795
-#define EXPORT_PHWRITESTRINGASUTF8FILESTREAMEX 1796
-#define EXPORT_PHWRITESTRINGFORMATASUTF8FILESTREAM 1797
-#define EXPORT_PHWRITESTRINGFORMATASUTF8FILESTREAM_V 1798
-#define EXPORT_PHDELETEGRAPHSTATE 1799
-#define EXPORT_PHDRAWGRAPHDIRECT 1800
-#define EXPORT_PHDRAWTRAYICONTEXT 1801
-#define EXPORT_PHGETDRAWINFOGRAPHBUFFERS 1802
-#define EXPORT_PHGRAPHSTATEGETDRAWINFO 1803
-#define EXPORT_PHINITIALIZEGRAPHSTATE 1804
-#define EXPORT_PHNFGETTRAYICONFONT 1805
-#define EXPORT_PHSETGRAPHTEXT 1806
-#define EXPORT_PHADDLAYOUTITEM 1807
-#define EXPORT_PHADDLAYOUTITEMEX 1808
-#define EXPORT_PHADDLISTVIEWCOLUMN 1809
-#define EXPORT_PHADDILISTVIEWCOLUMN 1810
-#define EXPORT_PHADDILISTVIEWGROUP 1811
-#define EXPORT_PHADDILISTVIEWGROUPITEM 1812
-#define EXPORT_PHADDLISTVIEWGROUP 1813
-#define EXPORT_PHADDLISTVIEWGROUPITEM 1814
-#define EXPORT_PHADDLISTVIEWITEM 1815
-#define EXPORT_PHADDILISTVIEWITEM 1816
-#define EXPORT_PHADDTABCONTROLTAB 1817
-#define EXPORT_PHBITMAPSETALPHA 1818
-#define EXPORT_PHCREATEDIALOG 1819
-#define EXPORT_PHCREATEWINDOWEX 1820
-#define EXPORT_PHDELETELAYOUTMANAGER 1821
-#define EXPORT_PHDIALOGBOX 1822
-#define EXPORT_PHENUMCHILDWINDOWS 1823
-#define EXPORT_PHENUMWINDOWS 1824
-#define EXPORT_PHFINDILISTVIEWITEMBYFLAGS 1825
-#define EXPORT_PHFINDLISTVIEWITEMBYFLAGS 1826
-#define EXPORT_PHFINDLISTVIEWITEMBYPARAM 1827
-#define EXPORT_PHGETCOMBOBOXSTRING 1828
-#define EXPORT_PHGETDIALOGITEMVALUE 1829
-#define EXPORT_PHGETILISTVIEWITEMPARAM 1830
-#define EXPORT_PHGETLISTBOXSTRING 1831
-#define EXPORT_PHGETLISTVIEWITEMIMAGEINDEX 1832
-#define EXPORT_PHGETLISTVIEWITEMPARAM 1833
-#define EXPORT_PHGETSELECTEDLISTVIEWITEMPARAM 1834
-#define EXPORT_PHGETSELECTEDLISTVIEWITEMPARAMS 1835
-#define EXPORT_PHGETSELECTEDILISTVIEWITEMPARAMS 1836
-#define EXPORT_PHGETSTOCKAPPLICATIONICON 1837
-#define EXPORT_PHGETSTOCKOBJECT 1838
-#define EXPORT_PHGETWINDOWCLIENTID 1839
-#define EXPORT_PHGETWINDOWCONTEXT 1840
-#define EXPORT_PHGETWINDOWTEXT 1841
-#define EXPORT_PHGETWINDOWTEXTEX 1842
-#define EXPORT_PHICONTOBITMAP 1843
-#define EXPORT_PHIMAGELISTADDBITMAP 1844
-#define EXPORT_PHIMAGELISTADDICON 1845
-#define EXPORT_PHIMAGELISTCREATE 1846
-#define EXPORT_PHIMAGELISTDESTROY 1847
-#define EXPORT_PHIMAGELISTDRAWEX 1848
-#define EXPORT_PHIMAGELISTDRAWICON 1849
-#define EXPORT_PHIMAGELISTGETICON 1850
-#define EXPORT_PHIMAGELISTREMOVEICON 1851
-#define EXPORT_PHIMAGELISTREPLACE 1852
-#define EXPORT_PHIMAGELISTSETBKCOLOR 1853
-#define EXPORT_PHIMAGELISTSETICONSIZE 1854
-#define EXPORT_PHIMAGELISTSETIMAGECOUNT 1855
-#define EXPORT_PHINITIALIZELAYOUTMANAGER 1856
-#define EXPORT_PHLAYOUTMANAGERLAYOUT 1857
-#define EXPORT_PHLOADICON 1858
-#define EXPORT_PHLOADIMAGEFORMATFROMRESOURCE 1859
-#define EXPORT_PHMODALPROPERTYSHEET 1860
-#define EXPORT_PHQUERYDIRECTXEXCLUSIVEOWNERSHIP 1861
-#define EXPORT_PHINITIALIZEWINDOWTHEME 1862
-#define EXPORT_PHREINITIALIZEWINDOWTHEME 1863
-#define EXPORT_PHREGISTERWINDOWCALLBACK 1864
-#define EXPORT_PHREMOVELISTVIEWITEM 1865
-#define EXPORT_PHREMOVEWINDOWCONTEXT 1866
-#define EXPORT_PHSELECTCOMBOBOXSTRING 1867
-#define EXPORT_PHSETCLIPBOARDSTRING 1868
-#define EXPORT_PHSETCONTROLTHEME 1869
-#define EXPORT_PHSETDIALOGITEMTEXT 1870
-#define EXPORT_PHSETDIALOGITEMVALUE 1871
-#define EXPORT_PHSETEXTENDEDLISTVIEW 1872
-#define EXPORT_PHSETGROUPBOXTEXT 1873
-#define EXPORT_PHSETHEADERSORTICON 1874
-#define EXPORT_PHSETIMAGELISTBITMAP 1875
-#define EXPORT_PHSETLISTVIEWITEMIMAGEINDEX 1876
-#define EXPORT_PHSETLISTVIEWITEMPARAM 1877
-#define EXPORT_PHSETLISTVIEWSUBITEM 1878
-#define EXPORT_PHSETILISTVIEWSUBITEM 1879
-#define EXPORT_PHSETSTATEALLLISTVIEWITEMS 1880
-#define EXPORT_PHSETWINDOWCONTEXT 1881
-#define EXPORT_PHSETWINDOWTEXT 1882
-#define EXPORT_PHTHEMEWINDOWDRAWREBAR 1883
-#define EXPORT_PHTHEMEWINDOWDRAWTOOLBAR 1884
-#define EXPORT_PHUNREGISTERWINDOWCALLBACK 1885
-#define EXPORT_PHWINDOWTHEMECONTROLCOLOR 1886
-#define EXPORT_PHCALLKPHQUERYFILEINFORMATIONWITHTIMEOUT 1887
-#define EXPORT_PHCOMPAREOBJECTS 1888
-#define EXPORT_PHENUMOBJECTTYPES 1889
-#define EXPORT_PHFORMATNATIVEKEYNAME 1890
-#define EXPORT_PHGETETWPUBLISHERNAME 1891
-#define EXPORT_PHGETHANDLEINFORMATION 1892
-#define EXPORT_PHGETHANDLEINFORMATIONEX 1893
-#define EXPORT_PHGETOBJECTTYPENAME 1894
-#define EXPORT_PHQUERYOBJECTNAME 1895
-#define EXPORT_PHSTDGETCLIENTIDNAME 1896
-#define EXPORT_PHENUMERATEPRIVILEGES 1897
-#define EXPORT_PHGETSIDFULLNAME 1898
-#define EXPORT_PHLOOKUPNAME 1899
-#define EXPORT_PHLOOKUPPRIVILEGEDISPLAYNAME 1900
-#define EXPORT_PHLOOKUPPRIVILEGENAME 1901
-#define EXPORT_PHLOOKUPPRIVILEGEVALUE 1902
-#define EXPORT_PHLOOKUPSID 1903
-#define EXPORT_PHOPENLSAPOLICY 1904
-#define EXPORT_PHSIDTOSTRINGSID 1905
-#define EXPORT_PHLOADMAPPEDIMAGE 1906
-#define EXPORT_PHLOADMAPPEDIMAGEEX 1907
-#define EXPORT_PHLOADMAPPEDIMAGEHEADERPAGESIZE 1908
-#define EXPORT_PHUNLOADMAPPEDIMAGE 1909
-#define EXPORT_PHBOOSTPROVIDER 1910
-#define EXPORT_PHDELETEPROVIDERTHREAD 1911
-#define EXPORT_PHGETENABLEDPROVIDER 1912
-#define EXPORT_PHINITIALIZEPROVIDERTHREAD 1913
-#define EXPORT_PHREGISTERPROVIDER 1914
-#define EXPORT_PHSETENABLEDPROVIDER 1915
-#define EXPORT_PHSETINTERVALPROVIDERTHREAD 1916
-#define EXPORT_PHSTARTPROVIDERTHREAD 1917
-#define EXPORT_PHSTOPPROVIDERTHREAD 1918
-#define EXPORT_PHUNREGISTERPROVIDER 1919
-#define EXPORT_PHADDSETTING 1920
-#define EXPORT_PHADDSETTINGS 1921
-#define EXPORT_PHCLEARIGNOREDSETTINGS 1922
-#define EXPORT_PHCONVERTIGNOREDSETTINGS 1923
-#define EXPORT_PHGETINTEGERPAIRSTRINGREFSETTING 1924
-#define EXPORT_PHGETINTEGERSTRINGREFSETTING 1925
-#define EXPORT_PHGETSCALABLEINTEGERPAIRSTRINGREFSETTING 1926
-#define EXPORT_PHGETSTRINGREFSETTING 1927
-#define EXPORT_PHLOADCUSTOMCOLORLIST 1928
-#define EXPORT_PHLOADLISTVIEWCOLUMNSETTINGS 1929
-#define EXPORT_PHLOADLISTVIEWCOLUMNSFROMSETTING 1930
-#define EXPORT_PHLOADLISTVIEWGROUPSTATESFROMSETTING 1931
-#define EXPORT_PHLOADLISTVIEWSORTCOLUMNSFROMSETTING 1932
-#define EXPORT_PHLOADSETTINGS 1933
-#define EXPORT_PHLOADWINDOWPLACEMENTFROMSETTING 1934
-#define EXPORT_PHRESETSETTINGS 1935
-#define EXPORT_PHSAVECUSTOMCOLORLIST 1936
-#define EXPORT_PHSAVELISTVIEWCOLUMNSETTINGS 1937
-#define EXPORT_PHSAVELISTVIEWCOLUMNSTOSETTING 1938
-#define EXPORT_PHSAVELISTVIEWGROUPSTATESTOSETTING 1939
-#define EXPORT_PHSAVELISTVIEWSORTCOLUMNSTOSETTING 1940
-#define EXPORT_PHSAVESETTINGS 1941
-#define EXPORT_PHSAVEWINDOWPLACEMENTTOSETTING 1942
-#define EXPORT_PHSETINTEGERPAIRSTRINGREFSETTING 1943
-#define EXPORT_PHSETINTEGERSTRINGREFSETTING 1944
-#define EXPORT_PHSETSCALABLEINTEGERPAIRSTRINGREFSETTING 1945
-#define EXPORT_PHSETSCALABLEINTEGERPAIRSTRINGREFSETTING2 1946
-#define EXPORT_PHSETSTRINGREFSETTING 1947
-#define EXPORT_PHUPDATECACHEDSETTINGS 1948
-#define EXPORT_PHCREATESECURITYPAGE 1949
-#define EXPORT_PHEDITSECURITY 1950
-#define EXPORT_PHGETACCESSENTRIES 1951
-#define EXPORT_PHGETACCESSSTRING 1952
-#define EXPORT_PHGETSEOBJECTSECURITY 1953
-#define EXPORT_PHSETSEOBJECTSECURITY 1954
-#define EXPORT_PHSTDGETOBJECTSECURITY 1955
-#define EXPORT_PHSTDSETOBJECTSECURITY 1956
-#define EXPORT_PHCHANGESERVICECONFIG2 1957
-#define EXPORT_PHCLOSESERVICEHANDLE 1958
-#define EXPORT_PHENUMDEPENDENTSERVICES 1959
-#define EXPORT_PHGETSERVICECONFIG 1960
-#define EXPORT_PHGETSERVICECONFIGFILENAME 1961
-#define EXPORT_PHGETSERVICEDESCRIPTION 1962
-#define EXPORT_PHGETSERVICEDLLPARAMETER 1963
-#define EXPORT_PHGETSERVICEERRORCONTROLINTEGER 1964
-#define EXPORT_PHGETSERVICEERRORCONTROLSTRING 1965
-#define EXPORT_PHGETSERVICEFILENAME 1966
-#define EXPORT_PHGETSERVICENAMEFROMTAG 1967
-#define EXPORT_PHGETSERVICESTARTTYPEINTEGER 1968
-#define EXPORT_PHGETSERVICESTARTTYPESTRING 1969
-#define EXPORT_PHGETSERVICESTATESTRING 1970
-#define EXPORT_PHGETSERVICETYPEINTEGER 1971
-#define EXPORT_PHGETSERVICETYPESTRING 1972
-#define EXPORT_PHGETTHREADSERVICETAG 1973
-#define EXPORT_PHOPENSERVICE 1974
-#define EXPORT_PHOPENSERVICEKEY 1975
-#define EXPORT_PHQUERYSERVICECONFIG 1976
-#define EXPORT_PHQUERYSERVICECONFIG2 1977
-#define EXPORT_PHQUERYSERVICESTATUS 1978
-#define EXPORT_PHQUERYSERVICEVARIABLESIZE 1979
-#define EXPORT_PHSTARTSERVICE 1980
-#define EXPORT_PHSTOPSERVICE 1981
-#define EXPORT_PHCREATESYMBOLPROVIDER 1982
-#define EXPORT_PHGETLINEFROMADDRESS 1983
-#define EXPORT_PHGETMODULEFROMADDRESS 1984
-#define EXPORT_PHGETSYMBOLFROMADDRESS 1985
-#define EXPORT_PHGETSYMBOLFROMNAME 1986
-#define EXPORT_PHLOADSYMBOLPROVIDERMODULES 1987
-#define EXPORT_PHLOADMODULESYMBOLPROVIDER 1988
-#define EXPORT_PHLOADMODULESFORVIRTUALSYMBOLPROVIDER 1989
-#define EXPORT_PHSETOPTIONSSYMBOLPROVIDER 1990
-#define EXPORT_PHSETSEARCHPATHSYMBOLPROVIDER 1991
-#define EXPORT_PHSTACKWALK 1992
-#define EXPORT_PHWALKTHREADSTACK 1993
-#define EXPORT_PHWRITEMINIDUMPPROCESS 1994
-#define EXPORT_PHVERIFYFILE 1995
-#define EXPORT_PHVERIFYFILEISCHAINEDTOMICROSOFT 1996
-#define EXPORT_PHDELETEWORKQUEUE 1997
-#define EXPORT_PHGETGLOBALWORKQUEUE 1998
-#define EXPORT_PHINITIALIZEWORKQUEUE 1999
-#define EXPORT_PHINITIALIZEWORKQUEUEENVIRONMENT 2000
-#define EXPORT_PHQUEUEITEMWORKQUEUE 2001
-#define EXPORT_PHQUEUEITEMWORKQUEUEEX 2002
-#define EXPORT_PHWAITFORWORKQUEUE 2003
-#define EXPORT_PHADDJSONARRAYOBJECT 2004
-#define EXPORT_PHADDJSONOBJECT 2005
-#define EXPORT_PHADDJSONOBJECT2 2006
-#define EXPORT_PHADDJSONOBJECTINT64 2007
-#define EXPORT_PHADDJSONOBJECTUINT64 2008
-#define EXPORT_PHADDJSONOBJECTVALUE 2009
-#define EXPORT_PHCREATEJSONARRAY 2010
-#define EXPORT_PHCREATEJSONOBJECT 2011
-#define EXPORT_PHCREATEJSONPARSER 2012
-#define EXPORT_PHCREATEJSONPARSEREX 2013
-#define EXPORT_PHFREEJSONOBJECT 2014
-#define EXPORT_PHGETJSONARRAYINDEXOBJECT 2015
-#define EXPORT_PHGETJSONARRAYLENGTH 2016
-#define EXPORT_PHGETJSONARRAYLONG64 2017
-#define EXPORT_PHGETJSONARRAYSTRING 2018
-#define EXPORT_PHGETJSONOBJECT 2019
-#define EXPORT_PHGETJSONOBJECTASARRAYLIST 2020
-#define EXPORT_PHGETJSONOBJECTBOOL 2021
-#define EXPORT_PHGETJSONOBJECTLENGTH 2022
-#define EXPORT_PHGETJSONOBJECTTYPE 2023
-#define EXPORT_PHGETJSONVALUEASINT64 2024
-#define EXPORT_PHGETJSONVALUEASSTRING 2025
-#define EXPORT_PHGETJSONVALUEASUINT64 2026
-#define EXPORT_PHCREATEXMLNODE 2027
-#define EXPORT_PHCREATEXMLOPAQUENODE 2028
-#define EXPORT_PHFINDXMLOBJECT 2029
-#define EXPORT_PHFREEXMLOBJECT 2030
-#define EXPORT_PHGETXMLINTERFACE 2031
-#define EXPORT_PHGETXMLNODEATTRIBUTEBYINDEX 2032
-#define EXPORT_PHGETXMLNODEATTRIBUTECOUNT 2033
-#define EXPORT_PHGETXMLNODEATTRIBUTETEXT 2034
-#define EXPORT_PHGETXMLNODEELEMENTTEXT 2035
-#define EXPORT_PHGETXMLNODEFIRSTCHILD 2036
-#define EXPORT_PHGETXMLNODENEXTCHILD 2037
-#define EXPORT_PHGETXMLNODEOPAQUETEXT 2038
-#define EXPORT_PHGETXMLOBJECT 2039
-#define EXPORT_PHLOADXMLOBJECTFROMFILE 2040
-#define EXPORT_PHLOADXMLOBJECTFROMSTRING 2041
-#define EXPORT_PHSAVEXMLOBJECTTOFILE 2042
-#define EXPORT_PHSETXMLNODEATTRIBUTETEXT 2043
-#define EXPORT_PHCLEARCACHEDIRECTORY 2044
-#define EXPORT_PHCREATECACHEFILE 2045
-#define EXPORT_PHDELETECACHEFILE 2046
-#define EXPORT_PHAPPRESOLVERGETAPPIDFORWINDOW 2047
-#define EXPORT_PHGETPROCESSPACKAGEFULLNAME 2048
-#define EXPORT_PHDNSFREE 2049
-#define EXPORT_PHDNSQUERY 2050
-#define EXPORT_PHDNSQUERY2 2051
-#define EXPORT_PHHTTPDNSQUERY 2052
-#define EXPORT_PHHTTPSOCKETADDREQUESTHEADERS 2053
-#define EXPORT_PHHTTPSOCKETBEGINREQUEST 2054
-#define EXPORT_PHHTTPSOCKETCLOSE 2055
-#define EXPORT_PHHTTPSOCKETCONNECT 2056
-#define EXPORT_PHHTTPSOCKETCREATE 2057
-#define EXPORT_PHHTTPSOCKETDESTROY 2058
-#define EXPORT_PHHTTPSOCKETDOWNLOADSTRING 2059
-#define EXPORT_PHHTTPSOCKETENDREQUEST 2060
-#define EXPORT_PHHTTPSOCKETGETERRORMESSAGE 2061
-#define EXPORT_PHHTTPSOCKETPARSEURL 2062
-#define EXPORT_PHHTTPSOCKETQUERYHEADERSTRING 2063
-#define EXPORT_PHHTTPSOCKETQUERYHEADERULONG 2064
-#define EXPORT_PHHTTPSOCKETQUERYHEADERULONG64 2065
-#define EXPORT_PHHTTPSOCKETQUERYHEADERS 2066
-#define EXPORT_PHHTTPSOCKETQUERYOPTIONSTRING 2067
-#define EXPORT_PHHTTPSOCKETREADDATA 2068
-#define EXPORT_PHHTTPSOCKETREADDATATOBUFFER 2069
-#define EXPORT_PHHTTPSOCKETSENDREQUEST 2070
-#define EXPORT_PHHTTPSOCKETSETCREDENTIALS 2071
-#define EXPORT_PHHTTPSOCKETSETFEATURE 2072
-#define EXPORT_PHHTTPSOCKETSETSECURITY 2073
-#define EXPORT_PHHTTPSOCKETWRITEDATA 2074
-#define EXPORT_KSILEVEL 2075
-#define EXPORT_KPHALPCQUERYINFORMATION 2076
-#define EXPORT_KPHDUPLICATEOBJECT 2077
-#define EXPORT_KPHOPENDEVICE 2078
-#define EXPORT_KPHOPENDEVICEBASEDEVICE 2079
-#define EXPORT_KPHOPENDEVICEDRIVER 2080
-#define EXPORT_KPHQUERYINFORMATIONDRIVER 2081
-#define EXPORT_KPHQUERYINFORMATIONOBJECT 2082
-#define EXPORT_KSIENUMERATEPROCESSHANDLES 2083
-#define EXPORT_KSIQUERYHASHINFORMATIONFILE 2084
+#define EXPORT_PHADDPROCESSPROPPAGE 1001
+#define EXPORT_PHADDPROCESSPROPPAGE2 1002
+#define EXPORT_PHADDPROPPAGELAYOUTITEM 1003
+#define EXPORT_PHADDTREENEWFILTER 1004
+#define EXPORT_PHAPPLYTREENEWFILTERS 1005
+#define EXPORT_PHAPPLYTREENEWFILTERSTONODE 1006
+#define EXPORT_PHCHOICEDIALOG 1007
+#define EXPORT_PHCMLOADSETTINGS 1008
+#define EXPORT_PHCMSAVESETTINGS 1009
+#define EXPORT_PHCOPYLISTVIEW 1010
+#define EXPORT_PHCOPYLISTVIEWINFOTIP 1011
+#define EXPORT_PHCREATEKSISETTINGSBLOB 1012
+#define EXPORT_PHCREATEPROCESSPROPCONTEXT 1013
+#define EXPORT_PHCREATEPROCESSPROPPAGECONTEXT 1014
+#define EXPORT_PHCREATEPROCESSPROPPAGECONTEXTEX 1015
+#define EXPORT_PHCREATESEARCHCONTROL 1016
+#define EXPORT_PHCREATESERVICELISTCONTROL 1017
+#define EXPORT_PHDELETEMEMORYITEMLIST 1018
+#define EXPORT_PHDELETESTATICWINDOWICON 1019
+#define EXPORT_PHDELETETREENEWCOLUMNMENU 1020
+#define EXPORT_PHDELETETREENEWFILTERSUPPORT 1021
+#define EXPORT_PHDEREFERENCEPROCESSRECORD 1022
+#define EXPORT_PHDESELECTALLPROCESSNODES 1023
+#define EXPORT_PHDESELECTALLSERVICENODES 1024
+#define EXPORT_PHDESTROYWINDOWICON 1025
+#define EXPORT_PHDEVICEPROVIDERINITIALIZATION 1026
+#define EXPORT_PHDOPROPPAGELAYOUT 1027
+#define EXPORT_PHDUPLICATEPROCESSINFORMATION 1028
+#define EXPORT_PHDUPLICATEPROCESSNODELIST 1029
+#define EXPORT_PHENUMNETWORKITEMS 1030
+#define EXPORT_PHENUMNETWORKITEMSBYPROCESSID 1031
+#define EXPORT_PHENUMPROCESSITEMS 1032
+#define EXPORT_PHEXECUTERUNASCOMMAND2 1033
+#define EXPORT_PHEXECUTERUNASCOMMAND3 1034
+#define EXPORT_PHEXPANDALLPROCESSNODES 1035
+#define EXPORT_PHFINDNETWORKNODE 1036
+#define EXPORT_PHFINDPROCESSNODE 1037
+#define EXPORT_PHFINDPROCESSRECORD 1038
+#define EXPORT_PHFINDSERVICENODE 1039
+#define EXPORT_PHFORMATLOGENTRY 1040
+#define EXPORT_PHGETAPPLICATIONICON 1041
+#define EXPORT_PHGETAPPLICATIONICONEX 1042
+#define EXPORT_PHGETCLIENTIDNAME 1043
+#define EXPORT_PHGETCLIENTIDNAMEEX 1044
+#define EXPORT_PHGETDEVICEICON 1045
+#define EXPORT_PHGETDEVICEPROPERTY 1046
+#define EXPORT_PHGETFILTERSUPPORTNETWORKTREELIST 1047
+#define EXPORT_PHGETFILTERSUPPORTPROCESSTREELIST 1048
+#define EXPORT_PHGETFILTERSUPPORTSERVICETREELIST 1049
+#define EXPORT_PHGETGENERALCALLBACK 1050
+#define EXPORT_PHGETIMAGELISTICON 1051
+#define EXPORT_PHGETLISTVIEWCONTEXTMENUPOINT 1052
+#define EXPORT_PHGETPHRELEASECHANNEL 1053
+#define EXPORT_PHGETPHRELEASECHANNELSTRING 1054
+#define EXPORT_PHGETPHVERSION 1055
+#define EXPORT_PHGETPHVERSIONHASH 1056
+#define EXPORT_PHGETPHVERSIONNUMBERS 1057
+#define EXPORT_PHGETPROCESSISSUSPENDED 1058
+#define EXPORT_PHGETPROCESSKNOWNTYPE 1059
+#define EXPORT_PHGETPROCESSKNOWNTYPEEX 1060
+#define EXPORT_PHGETPROCESSPRIORITYCLASSSTRING 1061
+#define EXPORT_PHGETPROCESSSMALLIMAGELIST 1062
+#define EXPORT_PHGETPROTOCOLTYPENAME 1063
+#define EXPORT_PHGETSELECTEDANDPROPAGATEPROCESSITEMS 1064
+#define EXPORT_PHGETSELECTEDPROCESSITEM 1065
+#define EXPORT_PHGETSELECTEDPROCESSITEMS 1066
+#define EXPORT_PHGETSELECTEDPROCESSNODES 1067
+#define EXPORT_PHGETSELECTEDSERVICEITEM 1068
+#define EXPORT_PHGETSELECTEDSERVICEITEMS 1069
+#define EXPORT_PHGETSERVICECHANGE 1070
+#define EXPORT_PHGETSHIELDBITMAP 1071
+#define EXPORT_PHGETSTATISTICSTIME 1072
+#define EXPORT_PHGETSTATISTICSTIMESTRING 1073
+#define EXPORT_PHGETTCPSTATENAME 1074
+#define EXPORT_PHHANDLECOPYCELLEMENUITEM 1075
+#define EXPORT_PHHANDLECOPYLISTVIEWEMENUITEM 1076
+#define EXPORT_PHHANDLELISTVIEWNOTIFYBEHAVIORS 1077
+#define EXPORT_PHHANDLELISTVIEWNOTIFYFORCOPY 1078
+#define EXPORT_PHHANDLETREENEWCOLUMNMENU 1079
+#define EXPORT_PHIMAGELISTEXTRACTICON 1080
+#define EXPORT_PHIMAGELISTFLUSHCACHE 1081
+#define EXPORT_PHINITIALIZETREENEWCOLUMNMENU 1082
+#define EXPORT_PHINITIALIZETREENEWCOLUMNMENUEX 1083
+#define EXPORT_PHINITIALIZETREENEWFILTERSUPPORT 1084
+#define EXPORT_PHINSERTCOPYCELLEMENUITEM 1085
+#define EXPORT_PHINSERTCOPYLISTVIEWEMENUITEM 1086
+#define EXPORT_PHINSERTHANDLEOBJECTPROPERTIESEMENUITEMS 1087
+#define EXPORT_PHINVALIDATEALLPROCESSNODES 1088
+#define EXPORT_PHISPROCESSSUSPENDED 1089
+#define EXPORT_PHLOADSYMBOLPROVIDEROPTIONS 1090
+#define EXPORT_PHLOGMESSAGEENTRY 1091
+#define EXPORT_PHLOOKUPDEVICEITEM 1092
+#define EXPORT_PHLOOKUPDEVICEITEMBYHASH 1093
+#define EXPORT_PHLOOKUPDEVICEPROPERTYCLASS 1094
+#define EXPORT_PHLOOKUPMEMORYITEMLIST 1095
+#define EXPORT_PHPROCESSIMAGELISTINITIALIZATION 1096
+#define EXPORT_PHPROPPAGEDLGPROCHEADER 1097
+#define EXPORT_PHQUERYMEMORYITEMLIST 1098
+#define EXPORT_PHREFERENCEDEVICEITEM 1099
+#define EXPORT_PHREFERENCEDEVICEITEM2 1100
+#define EXPORT_PHREFERENCEDEVICEITEMBYHASH 1101
+#define EXPORT_PHREFERENCEDEVICETREE 1102
+#define EXPORT_PHREFERENCEDEVICETREEEX 1103
+#define EXPORT_PHREFERENCENETWORKITEM 1104
+#define EXPORT_PHREFERENCEPROCESSITEM 1105
+#define EXPORT_PHREFERENCEPROCESSITEMFORPARENT 1106
+#define EXPORT_PHREFERENCEPROCESSITEMFORRECORD 1107
+#define EXPORT_PHREFERENCEPROCESSRECORD 1108
+#define EXPORT_PHREFERENCEPROCESSRECORDFORSTATISTICS 1109
+#define EXPORT_PHREFERENCEPROCESSRECORDSAFE 1110
+#define EXPORT_PHREFERENCESERVICEITEM 1111
+#define EXPORT_PHREGISTERDIALOG 1112
+#define EXPORT_PHREGISTERMESSAGELOOPFILTER 1113
+#define EXPORT_PHREMOVETREENEWFILTER 1114
+#define EXPORT_PHSEARCHCONTROLMATCH 1115
+#define EXPORT_PHSEARCHCONTROLMATCHLONGHINTZ 1116
+#define EXPORT_PHSEARCHCONTROLMATCHPOINTER 1117
+#define EXPORT_PHSEARCHCONTROLMATCHPOINTERRANGE 1118
+#define EXPORT_PHSEARCHCONTROLMATCHZ 1119
+#define EXPORT_PHSEARCHONLINESTRING 1120
+#define EXPORT_PHSELECTANDENSUREVISIBLEPROCESSNODE 1121
+#define EXPORT_PHSELECTANDENSUREVISIBLESERVICENODE 1122
+#define EXPORT_PHSETAPPLICATIONWINDOWICON 1123
+#define EXPORT_PHSETAPPLICATIONWINDOWICONEX 1124
+#define EXPORT_PHSETPROCESSITEMAFFINITYMASK 1125
+#define EXPORT_PHSETPROCESSITEMIOPRIORITY 1126
+#define EXPORT_PHSETPROCESSITEMPAGEPRIORITY 1127
+#define EXPORT_PHSETPROCESSITEMPRIORITY 1128
+#define EXPORT_PHSETPROCESSITEMPRIORITYBOOST 1129
+#define EXPORT_PHSETPROCESSITEMTHROTTLINGSTATE 1130
+#define EXPORT_PHSETSELECTTHREADIDPROCESSPROPCONTEXT 1131
+#define EXPORT_PHSETSTATICWINDOWICON 1132
+#define EXPORT_PHSETWINDOWICON 1133
+#define EXPORT_PHSHELLEXECUTEUSERSTRING 1134
+#define EXPORT_PHSHELLOPENKEY 1135
+#define EXPORT_PHSHELLOPENKEY2 1136
+#define EXPORT_PHSHELLPROCESSHACKER 1137
+#define EXPORT_PHSHOWCHOOSEPROCESSDIALOG 1138
+#define EXPORT_PHSHOWHANDLEOBJECTPROPERTIES1 1139
+#define EXPORT_PHSHOWHANDLEOBJECTPROPERTIES2 1140
+#define EXPORT_PHSHOWICONNOTIFICATION 1141
+#define EXPORT_PHSHOWPROCESSAFFINITYDIALOG2 1142
+#define EXPORT_PHSHOWPROCESSPROPERTIES 1143
+#define EXPORT_PHSHOWPROCESSRECORDDIALOG 1144
+#define EXPORT_PHSHOWSYSTEMINFORMATIONDIALOG 1145
+#define EXPORT_PHSHOWTHREADAFFINITYDIALOG 1146
+#define EXPORT_PHSIDOUBLELABELYFUNCTION 1147
+#define EXPORT_PHSISETCOLORSGRAPHDRAWINFO 1148
+#define EXPORT_PHSISIZELABELYFUNCTION 1149
+#define EXPORT_PHSIUINT64LABELYFUNCTION 1150
+#define EXPORT_PHUNREGISTERDIALOG 1151
+#define EXPORT_PHUNREGISTERMESSAGELOOPFILTER 1152
+#define EXPORT_PHUPDATEPROCESSNODE 1153
+#define EXPORT_PHUPDATESERVICENODE 1154
+#define EXPORT_PHWORDMATCHSTRINGREF 1155
+#define EXPORT_PHWRITEPHTEXTHEADER 1156
+#define EXPORT_PHACHOICEDIALOG 1157
+#define EXPORT_PHAGETPROCESSKNOWNCOMMANDLINE 1158
+#define EXPORT_PHCREATEHANDLEITEM 1159
+#define EXPORT_PHSHOWHANDLEPROPERTIESEX 1160
+#define EXPORT_PHENUMERATEPLUGINS 1161
+#define EXPORT_PHFINDPLUGIN2 1162
+#define EXPORT_PHGETPLUGINCALLBACK 1163
+#define EXPORT_PHGETPLUGINFILENAME 1164
+#define EXPORT_PHGETPLUGININFORMATION 1165
+#define EXPORT_PHGETPLUGININTERFACE 1166
+#define EXPORT_PHGETPLUGINNAME 1167
+#define EXPORT_PHPLUGINADDMENUHOOK 1168
+#define EXPORT_PHPLUGINADDTREENEWCOLUMN 1169
+#define EXPORT_PHPLUGINCALLPHSVC 1170
+#define EXPORT_PHPLUGINCREATEEMENUITEM 1171
+#define EXPORT_PHPLUGINCREATETABPAGE 1172
+#define EXPORT_PHPLUGINENABLETREENEWNOTIFY 1173
+#define EXPORT_PHPLUGINGETOBJECTEXTENSION 1174
+#define EXPORT_PHPLUGINGETSYSTEMSTATISTICS 1175
+#define EXPORT_PHPLUGININVOKEWINDOWCALLBACK 1176
+#define EXPORT_PHPLUGINQUERYPHSVC 1177
+#define EXPORT_PHPLUGINRESERVEIDS 1178
+#define EXPORT_PHPLUGINSETOBJECTEXTENSION 1179
+#define EXPORT_PHREGISTERPLUGIN 1180
+#define EXPORT_PHSVCCALLCHANGESERVICECONFIG 1181
+#define EXPORT_PHSVCCALLCHANGESERVICECONFIG2 1182
+#define EXPORT_PHSVCCALLPOSTMESSAGE 1183
+#define EXPORT_PHSVCCALLSENDMESSAGE 1184
+#define EXPORT_PHUICLOSECONNECTIONS 1185
+#define EXPORT_PHUICLOSEHANDLES 1186
+#define EXPORT_PHUICONNECTSESSION 1187
+#define EXPORT_PHUICONNECTTOPHSVC 1188
+#define EXPORT_PHUICONNECTTOPHSVCEX 1189
+#define EXPORT_PHUICONTINUESERVICE 1190
+#define EXPORT_PHUICONTINUESERVICES 1191
+#define EXPORT_PHUIDEBUGPROCESS 1192
+#define EXPORT_PHUIDELETESERVICE 1193
+#define EXPORT_PHUIDETACHFROMDEBUGGERPROCESS 1194
+#define EXPORT_PHUIDISCONNECTFROMPHSVC 1195
+#define EXPORT_PHUIDISCONNECTSESSION 1196
+#define EXPORT_PHUIFLUSHHEAPPROCESSES 1197
+#define EXPORT_PHUIFREEMEMORY 1198
+#define EXPORT_PHUIFREEZETREEPROCESS 1199
+#define EXPORT_PHUIHIBERNATECOMPUTER 1200
+#define EXPORT_PHUILOADDLLPROCESS 1201
+#define EXPORT_PHUILOCKCOMPUTER 1202
+#define EXPORT_PHUILOGOFFCOMPUTER 1203
+#define EXPORT_PHUILOGOFFSESSION 1204
+#define EXPORT_PHUIPAUSESERVICE 1205
+#define EXPORT_PHUIPAUSESERVICES 1206
+#define EXPORT_PHUIREDUCEWORKINGSETPROCESSES 1207
+#define EXPORT_PHUIRESTARTCOMPUTER 1208
+#define EXPORT_PHUIRESTARTPROCESS 1209
+#define EXPORT_PHUIRESUMEPROCESSES 1210
+#define EXPORT_PHUIRESUMETHREADS 1211
+#define EXPORT_PHUIRESUMETREEPROCESS 1212
+#define EXPORT_PHUISETATTRIBUTESHANDLE 1213
+#define EXPORT_PHUISETBOOSTPRIORITYPROCESS 1214
+#define EXPORT_PHUISETBOOSTPRIORITYPROCESSES 1215
+#define EXPORT_PHUISETBOOSTPRIORITYTHREAD 1216
+#define EXPORT_PHUISETBOOSTPRIORITYTHREADS 1217
+#define EXPORT_PHUISETCRITICALPROCESS 1218
+#define EXPORT_PHUISETECOMODEPROCESS 1219
+#define EXPORT_PHUISETEXECUTIONREQUIREDPROCESS 1220
+#define EXPORT_PHUISETIOPRIORITYPROCESSES 1221
+#define EXPORT_PHUISETIOPRIORITYTHREAD 1222
+#define EXPORT_PHUISETPAGEPRIORITYPROCESS 1223
+#define EXPORT_PHUISETPAGEPRIORITYTHREAD 1224
+#define EXPORT_PHUISETPRIORITYPROCESSES 1225
+#define EXPORT_PHUISETPRIORITYTHREAD 1226
+#define EXPORT_PHUISETPRIORITYTHREADS 1227
+#define EXPORT_PHUISETVIRTUALIZATIONPROCESS 1228
+#define EXPORT_PHUISHUTDOWNCOMPUTER 1229
+#define EXPORT_PHUISLEEPCOMPUTER 1230
+#define EXPORT_PHUISTARTSERVICE 1231
+#define EXPORT_PHUISTARTSERVICES 1232
+#define EXPORT_PHUISTOPSERVICE 1233
+#define EXPORT_PHUISTOPSERVICES 1234
+#define EXPORT_PHUISUSPENDPROCESSES 1235
+#define EXPORT_PHUISUSPENDTHREADS 1236
+#define EXPORT_PHUISUSPENDTREEPROCESS 1237
+#define EXPORT_PHUITERMINATEPROCESSES 1238
+#define EXPORT_PHUITERMINATETHREADS 1239
+#define EXPORT_PHUITERMINATETREEPROCESS 1240
+#define EXPORT_PHUITHAWTREEPROCESS 1241
+#define EXPORT_PHUIUNLOADMODULE 1242
+#define EXPORT_PHAUTODEREFERENCEOBJECT 1243
+#define EXPORT_PHCREATEALLOC 1244
+#define EXPORT_PHCREATEOBJECT 1245
+#define EXPORT_PHCREATEOBJECTTYPE 1246
+#define EXPORT_PHCREATEOBJECTTYPEEX 1247
+#define EXPORT_PHDELETEAUTOPOOL 1248
+#define EXPORT_PHDEREFERENCEOBJECT 1249
+#define EXPORT_PHDEREFERENCEOBJECTDEFERDELETE 1250
+#define EXPORT_PHDEREFERENCEOBJECTEX 1251
+#define EXPORT_PHDRAINAUTOPOOL 1252
+#define EXPORT_PHGETOBJECTTYPE 1253
+#define EXPORT_PHGETOBJECTTYPEINFORMATION 1254
+#define EXPORT_PHINITIALIZEAUTOPOOL 1255
+#define EXPORT_PHREFERENCEOBJECT 1256
+#define EXPORT_PHREFERENCEOBJECTEX 1257
+#define EXPORT_PHREFERENCEOBJECTSAFE 1258
+#define EXPORT_PHFACQUIREQUEUEDLOCKEXCLUSIVE 1259
+#define EXPORT_PHFACQUIREQUEUEDLOCKSHARED 1260
+#define EXPORT_PHFPULSEALLCONDITION 1261
+#define EXPORT_PHFPULSECONDITION 1262
+#define EXPORT_PHFQUEUEWAKEEVENT 1263
+#define EXPORT_PHFRELEASEQUEUEDLOCKEXCLUSIVE 1264
+#define EXPORT_PHFRELEASEQUEUEDLOCKSHARED 1265
+#define EXPORT_PHFSETWAKEEVENT 1266
+#define EXPORT_PHFWAITFORCONDITION 1267
+#define EXPORT_PHFWAITFORCONDITIONEX 1268
+#define EXPORT_PHFWAITFORWAKEEVENT 1269
+#define EXPORT_PHFWAKEFORRELEASEQUEUEDLOCK 1270
+#define EXPORT_PHISEXECUTINGINWOW64 1271
+#define EXPORT_PHSYSTEMBASICINFORMATION 1272
+#define EXPORT_PHADDELEMENTAVLTREE 1273
+#define EXPORT_PHADDENTRYHASHTABLE 1274
+#define EXPORT_PHADDENTRYHASHTABLEEX 1275
+#define EXPORT_PHADDITEMARRAY 1276
+#define EXPORT_PHADDITEMLIST 1277
+#define EXPORT_PHADDITEMPOINTERLIST 1278
+#define EXPORT_PHADDITEMSIMPLEHASHTABLE 1279
+#define EXPORT_PHADDITEMSARRAY 1280
+#define EXPORT_PHADDITEMSLIST 1281
+#define EXPORT_PHADDPLUSMAXMEMORYSINGLES 1282
+#define EXPORT_PHALLOCATE 1283
+#define EXPORT_PHALLOCATEEXSAFE 1284
+#define EXPORT_PHALLOCATEFROMFREELIST 1285
+#define EXPORT_PHALLOCATEPAGE 1286
+#define EXPORT_PHALLOCATESAFE 1287
+#define EXPORT_PHAPPENDBYTESBUILDER 1288
+#define EXPORT_PHAPPENDBYTESBUILDER2 1289
+#define EXPORT_PHAPPENDBYTESBUILDEREX 1290
+#define EXPORT_PHAPPENDCHARSTRINGBUILDER 1291
+#define EXPORT_PHAPPENDCHARSTRINGBUILDER2 1292
+#define EXPORT_PHAPPENDFORMATSTRINGBUILDER 1293
+#define EXPORT_PHAPPENDFORMATSTRINGBUILDER_V 1294
+#define EXPORT_PHAPPENDSTRINGBUILDEREX 1295
+#define EXPORT_PHBUFFERTOHEXSTRING 1296
+#define EXPORT_PHBUFFERTOHEXSTRINGEX 1297
+#define EXPORT_PHCLEARARRAY 1298
+#define EXPORT_PHCLEARHASHTABLE 1299
+#define EXPORT_PHCLEARLIST 1300
+#define EXPORT_PHCOMPARESTRINGREF 1301
+#define EXPORT_PHCOMPARESTRINGZNATURAL 1302
+#define EXPORT_PHCONCATSTRINGREF2 1303
+#define EXPORT_PHCONCATSTRINGREF3 1304
+#define EXPORT_PHCONCATSTRINGREF4 1305
+#define EXPORT_PHCONCATSTRINGS 1306
+#define EXPORT_PHCONCATSTRINGS2 1307
+#define EXPORT_PHCONCATSTRINGS_V 1308
+#define EXPORT_PHCONVERTMULTIBYTETOUTF16 1309
+#define EXPORT_PHCONVERTMULTIBYTETOUTF16EX 1310
+#define EXPORT_PHCONVERTUTF16TOASCIIEX 1311
+#define EXPORT_PHCONVERTUTF16TOMULTIBYTE 1312
+#define EXPORT_PHCONVERTUTF16TOMULTIBYTEEX 1313
+#define EXPORT_PHCONVERTUTF16TOUTF8 1314
+#define EXPORT_PHCONVERTUTF16TOUTF8BUFFER 1315
+#define EXPORT_PHCONVERTUTF16TOUTF8EX 1316
+#define EXPORT_PHCONVERTUTF16TOUTF8SIZE 1317
+#define EXPORT_PHCONVERTUTF8TOUTF16 1318
+#define EXPORT_PHCONVERTUTF8TOUTF16BUFFER 1319
+#define EXPORT_PHCONVERTUTF8TOUTF16EX 1320
+#define EXPORT_PHCONVERTUTF8TOUTF16SIZE 1321
+#define EXPORT_PHCOPYBYTESZ 1322
+#define EXPORT_PHCOPYCONVERTCIRCULARBUFFERULONG 1323
+#define EXPORT_PHCOPYSTRINGZ 1324
+#define EXPORT_PHCOPYSTRINGZFROMBYTES 1325
+#define EXPORT_PHCOPYSTRINGZFROMMULTIBYTE 1326
+#define EXPORT_PHCOUNTSTRINGZ 1327
+#define EXPORT_PHCREATEBYTES 1328
+#define EXPORT_PHCREATEBYTESEX 1329
+#define EXPORT_PHCREATEHASHTABLE 1330
+#define EXPORT_PHCREATELIST 1331
+#define EXPORT_PHCREATEPOINTERLIST 1332
+#define EXPORT_PHCREATESIMPLEHASHTABLE 1333
+#define EXPORT_PHCREATESTRING3 1334
+#define EXPORT_PHCREATESTRINGEX 1335
+#define EXPORT_PHCREATETHREAD 1336
+#define EXPORT_PHCREATETHREAD2 1337
+#define EXPORT_PHCREATETHREADEX 1338
+#define EXPORT_PHDECODEUNICODEDECODER 1339
+#define EXPORT_PHDELAYEXECUTION 1340
+#define EXPORT_PHDELETEARRAY 1341
+#define EXPORT_PHDELETEBYTESBUILDER 1342
+#define EXPORT_PHDELETECALLBACK 1343
+#define EXPORT_PHDELETEFREELIST 1344
+#define EXPORT_PHDELETESTRINGBUILDER 1345
+#define EXPORT_PHDIVIDESINGLESBYSINGLE 1346
+#define EXPORT_PHDOSERRORTONTSTATUS 1347
+#define EXPORT_PHDUPLICATEBYTESZ 1348
+#define EXPORT_PHDUPLICATEBYTESZSAFE 1349
+#define EXPORT_PHDUPLICATESTRINGZ 1350
+#define EXPORT_PHENCODEUNICODE 1351
+#define EXPORT_PHENUMAVLTREE 1352
+#define EXPORT_PHENUMHASHTABLE 1353
+#define EXPORT_PHENUMPOINTERLISTEX 1354
+#define EXPORT_PHEQUALSTRINGREF 1355
+#define EXPORT_PHEXPONENTIATE 1356
+#define EXPORT_PHEXPONENTIATE64 1357
+#define EXPORT_PHEXTRACTICON 1358
+#define EXPORT_PHEXTRACTICONEX 1359
+#define EXPORT_PHFILLMEMORYULONG 1360
+#define EXPORT_PHFINALBYTESBUILDERBYTES 1361
+#define EXPORT_PHFINALSTRINGBUILDERSTRING 1362
+#define EXPORT_PHFINDCHARINSTRINGREF 1363
+#define EXPORT_PHFINDELEMENTAVLTREE 1364
+#define EXPORT_PHFINDENTRYHASHTABLE 1365
+#define EXPORT_PHFINDITEMLIST 1366
+#define EXPORT_PHFINDITEMPOINTERLIST 1367
+#define EXPORT_PHFINDITEMSIMPLEHASHTABLE 1368
+#define EXPORT_PHFINDLASTCHARINSTRINGREF 1369
+#define EXPORT_PHFINDSTRINGINSTRINGREF 1370
+#define EXPORT_PHFORMAT 1371
+#define EXPORT_PHFORMATBYTES 1372
+#define EXPORT_PHFORMATBYTES_V 1373
+#define EXPORT_PHFORMATSTRING 1374
+#define EXPORT_PHFORMATSTRING_V 1375
+#define EXPORT_PHFORMATTOBUFFER 1376
+#define EXPORT_PHFREE 1377
+#define EXPORT_PHFREEPAGE 1378
+#define EXPORT_PHFREETOFREELIST 1379
+#define EXPORT_PHGETLASTERROR 1380
+#define EXPORT_PHGETPRIMENUMBER 1381
+#define EXPORT_PHHASHBYTES 1382
+#define EXPORT_PHHASHSTRINGREF 1383
+#define EXPORT_PHHASHSTRINGREFEX 1384
+#define EXPORT_PHHEXSTRINGTOBUFFER 1385
+#define EXPORT_PHHEXSTRINGTOBUFFEREX 1386
+#define EXPORT_PHHUNGWINDOWFROMGHOSTWINDOW 1387
+#define EXPORT_PHINITIALIZEARRAY 1388
+#define EXPORT_PHINITIALIZEAVLTREE 1389
+#define EXPORT_PHINITIALIZEBYTESBUILDER 1390
+#define EXPORT_PHINITIALIZECALLBACK 1391
+#define EXPORT_PHINITIALIZEFREELIST 1392
+#define EXPORT_PHINITIALIZESTRINGBUILDER 1393
+#define EXPORT_PHINSERTITEMLIST 1394
+#define EXPORT_PHINSERTITEMSLIST 1395
+#define EXPORT_PHINSERTSTRINGBUILDER 1396
+#define EXPORT_PHINSERTSTRINGBUILDER2 1397
+#define EXPORT_PHINSERTSTRINGBUILDEREX 1398
+#define EXPORT_PHINTEGERTOSTRING64 1399
+#define EXPORT_PHINVOKECALLBACK 1400
+#define EXPORT_PHLOADINDIRECTSTRING 1401
+#define EXPORT_PHLOADRESOURCE 1402
+#define EXPORT_PHLOCALTIMETOSYSTEMTIME 1403
+#define EXPORT_PHLOWERBOUNDELEMENTAVLTREE 1404
+#define EXPORT_PHLOWERDUALBOUNDELEMENTAVLTREE 1405
+#define EXPORT_PHMAXMEMORYSINGLES 1406
+#define EXPORT_PHMAXIMUMELEMENTAVLTREE 1407
+#define EXPORT_PHMINIMUMELEMENTAVLTREE 1408
+#define EXPORT_PHNTSTATUSFILENOTFOUND 1409
+#define EXPORT_PHNTSTATUSTODOSERROR 1410
+#define EXPORT_PHPREDECESSORELEMENTAVLTREE 1411
+#define EXPORT_PHPRINTTIMESPAN 1412
+#define EXPORT_PHQUERYPERFORMANCECOUNTER 1413
+#define EXPORT_PHQUERYPERFORMANCEFREQUENCY 1414
+#define EXPORT_PHQUERYSYSTEMTIME 1415
+#define EXPORT_PHQUERYTIMEZONEBIAS 1416
+#define EXPORT_PHREALLOCATE 1417
+#define EXPORT_PHREALLOCATESAFE 1418
+#define EXPORT_PHREADTIMESTAMPCOUNTER 1419
+#define EXPORT_PHREFERENCEEMPTYSTRING 1420
+#define EXPORT_PHREGISTERCALLBACK 1421
+#define EXPORT_PHREGISTERCALLBACKEX 1422
+#define EXPORT_PHREMOVEELEMENTAVLTREE 1423
+#define EXPORT_PHREMOVEENTRYHASHTABLE 1424
+#define EXPORT_PHREMOVEITEMARRAY 1425
+#define EXPORT_PHREMOVEITEMLIST 1426
+#define EXPORT_PHREMOVEITEMPOINTERLIST 1427
+#define EXPORT_PHREMOVEITEMSIMPLEHASHTABLE 1428
+#define EXPORT_PHREMOVEITEMSARRAY 1429
+#define EXPORT_PHREMOVEITEMSLIST 1430
+#define EXPORT_PHREMOVESTRINGBUILDER 1431
+#define EXPORT_PHRESIZEARRAY 1432
+#define EXPORT_PHRESIZELIST 1433
+#define EXPORT_PHROUNDUPTOPOWEROFTWO 1434
+#define EXPORT_PHSECONDSSINCE1970TOTIME 1435
+#define EXPORT_PHSPLITSTRINGREFATCHAR 1436
+#define EXPORT_PHSPLITSTRINGREFATLASTCHAR 1437
+#define EXPORT_PHSPLITSTRINGREFATSTRING 1438
+#define EXPORT_PHSPLITSTRINGREFEX 1439
+#define EXPORT_PHSTRINGTODOUBLE 1440
+#define EXPORT_PHSTRINGTOINTEGER64 1441
+#define EXPORT_PHSTRINGTOUINT64 1442
+#define EXPORT_PHSUCCESSORELEMENTAVLTREE 1443
+#define EXPORT_PHSYSTEMTIMETOLOCALTIME 1444
+#define EXPORT_PHTIMETOSECONDSSINCE1970 1445
+#define EXPORT_PHTRIMSTRINGREF 1446
+#define EXPORT_PHUNREGISTERCALLBACK 1447
+#define EXPORT_PHUPPERBOUNDELEMENTAVLTREE 1448
+#define EXPORT_PHUPPERDUALBOUNDELEMENTAVLTREE 1449
+#define EXPORT_PHWRITEUNICODEDECODER 1450
+#define EXPORT_PHZEROEXTENDTOUTF16BUFFER 1451
+#define EXPORT_PHZEROEXTENDTOUTF16EX 1452
+#define EXPORT_PHFACQUIRERUNDOWNPROTECTION 1453
+#define EXPORT_PHFBEGININITONCE 1454
+#define EXPORT_PHFENDINITONCE 1455
+#define EXPORT_PHFINITIALIZEBARRIER 1456
+#define EXPORT_PHFINITIALIZEEVENT 1457
+#define EXPORT_PHFINITIALIZEINITONCE 1458
+#define EXPORT_PHFINITIALIZERUNDOWNPROTECTION 1459
+#define EXPORT_PHFRELEASERUNDOWNPROTECTION 1460
+#define EXPORT_PHFRESETEVENT 1461
+#define EXPORT_PHFSETEVENT 1462
+#define EXPORT_PHFWAITFORBARRIER 1463
+#define EXPORT_PHFWAITFOREVENT 1464
+#define EXPORT_PHFWAITFORRUNDOWNPROTECTION 1465
+#define EXPORT_PHENUMSMBIOS 1466
+#define EXPORT_PHGETSMBIOSSTRING 1467
+#define EXPORT_PHADJUSTPRIVILEGE 1468
+#define EXPORT_PHCONNECTPIPE 1469
+#define EXPORT_PHCREATEDIRECTORYFULLPATHWIN32 1470
+#define EXPORT_PHCREATEDIRECTORYWIN32 1471
+#define EXPORT_PHCREATEEVENT 1472
+#define EXPORT_PHCREATEFILE 1473
+#define EXPORT_PHCREATEFILEWIN32 1474
+#define EXPORT_PHCREATEFILEWIN32EX 1475
+#define EXPORT_PHCREATEKEY 1476
+#define EXPORT_PHCREATENAMEDPIPE 1477
+#define EXPORT_PHCREATEPIPE 1478
+#define EXPORT_PHDELETEDIRECTORYWIN32 1479
+#define EXPORT_PHDELETEFILE 1480
+#define EXPORT_PHDELETEFILEWIN32 1481
+#define EXPORT_PHDELETEVALUEKEY 1482
+#define EXPORT_PHDESTROYWINDOWREMOTE 1483
+#define EXPORT_PHDETERMINEDOSPATHNAMETYPE 1484
+#define EXPORT_PHDEVICEIOCONTROLFILE 1485
+#define EXPORT_PHDISCONNECTNAMEDPIPE 1486
+#define EXPORT_PHDOESFILEEXIST 1487
+#define EXPORT_PHDOESFILEEXISTWIN32 1488
+#define EXPORT_PHDOSPATHNAMETONTPATHNAME 1489
+#define EXPORT_PHENUMBIGPOOLINFORMATION 1490
+#define EXPORT_PHENUMDIRECTORYFILE 1491
+#define EXPORT_PHENUMDIRECTORYOBJECTS 1492
+#define EXPORT_PHENUMFILESTREAMS 1493
+#define EXPORT_PHENUMFIRMWAREENVIRONMENTVALUES 1494
+#define EXPORT_PHENUMGENERICMODULES 1495
+#define EXPORT_PHENUMHANDLESEX 1496
+#define EXPORT_PHENUMKERNELMODULES 1497
+#define EXPORT_PHENUMNEXTPROCESS 1498
+#define EXPORT_PHENUMNEXTTHREAD 1499
+#define EXPORT_PHENUMOBJECTIDINFORMATION 1500
+#define EXPORT_PHENUMPAGEFILES 1501
+#define EXPORT_PHENUMPOOLTAGINFORMATION 1502
+#define EXPORT_PHENUMPROCESSENVIRONMENTVARIABLES 1503
+#define EXPORT_PHENUMPROCESSES 1504
+#define EXPORT_PHENUMPROCESSESEX 1505
+#define EXPORT_PHENUMPROCESSHANDLES 1506
+#define EXPORT_PHENUMREPARSEPOINTINFORMATION 1507
+#define EXPORT_PHENUMERATEKEY 1508
+#define EXPORT_PHENUMERATEVALUEKEY 1509
+#define EXPORT_PHFILTERCONNECTCOMMUNICATIONPORT 1510
+#define EXPORT_PHFINDPROCESSINFORMATION 1511
+#define EXPORT_PHFINDPROCESSINFORMATIONBYIMAGENAME 1512
+#define EXPORT_PHGETACTIVEPROCESSORCOUNT 1513
+#define EXPORT_PHGETCONTEXTTHREAD 1514
+#define EXPORT_PHGETDEVICETYPE 1515
+#define EXPORT_PHGETDLLHANDLE 1516
+#define EXPORT_PHGETDRIVERIMAGEFILENAME 1517
+#define EXPORT_PHGETDRIVERNAME 1518
+#define EXPORT_PHGETDRIVERSERVICEKEYNAME 1519
+#define EXPORT_PHGETFILEFULLATTRIBUTESINFORMATION 1520
+#define EXPORT_PHGETFILENAME 1521
+#define EXPORT_PHGETFILEPOSITION 1522
+#define EXPORT_PHGETFILESIZE 1523
+#define EXPORT_PHGETFIRMWAREENVIRONMENTVARIABLE 1524
+#define EXPORT_PHGETJOBPROCESSIDLIST 1525
+#define EXPORT_PHGETKERNELFILENAME 1526
+#define EXPORT_PHGETKERNELFILENAME2 1527
+#define EXPORT_PHGETKERNELFILENAMEEX 1528
+#define EXPORT_PHGETMODULEPROCADDRESS 1529
+#define EXPORT_PHGETNAMEDPIPECLIENTCOMPUTERNAME 1530
+#define EXPORT_PHGETNAMEDPIPECLIENTPROCESSID 1531
+#define EXPORT_PHGETNAMEDPIPESERVERPROCESSID 1532
+#define EXPORT_PHGETOBJECTSECURITY 1533
+#define EXPORT_PHGETOBJECTTYPEINDEXNAME 1534
+#define EXPORT_PHGETOBJECTTYPENUMBER 1535
+#define EXPORT_PHGETOWNTOKENATTRIBUTES 1536
+#define EXPORT_PHGETPNPDEVICENAME 1537
+#define EXPORT_PHGETPROCEDUREADDRESS 1538
+#define EXPORT_PHGETPROCEDUREADDRESSREMOTE 1539
+#define EXPORT_PHGETPROCESSCOMMANDLINE 1540
+#define EXPORT_PHGETPROCESSDEPSTATUS 1541
+#define EXPORT_PHGETPROCESSDEVICEMAP 1542
+#define EXPORT_PHGETPROCESSENVIRONMENT 1543
+#define EXPORT_PHGETPROCESSIMAGEFILENAME 1544
+#define EXPORT_PHGETPROCESSIMAGEFILENAMEBYPROCESSID 1545
+#define EXPORT_PHGETPROCESSIMAGEFILENAMEWIN32 1546
+#define EXPORT_PHGETPROCESSISDOTNET 1547
+#define EXPORT_PHGETPROCESSISDOTNETEX 1548
+#define EXPORT_PHGETPROCESSMAPPEDFILENAME 1549
+#define EXPORT_PHGETPROCESSPEBSTRING 1550
+#define EXPORT_PHGETPROCESSPRIORITYCLASS 1551
+#define EXPORT_PHGETPROCESSUNLOADEDDLLS 1552
+#define EXPORT_PHGETPROCESSWINDOWTITLE 1553
+#define EXPORT_PHGETPROCESSWORKINGSETINFORMATION 1554
+#define EXPORT_PHGETPROCESSWSCOUNTERS 1555
+#define EXPORT_PHGETSECTIONFILENAME 1556
+#define EXPORT_PHGETTOKENGROUPS 1557
+#define EXPORT_PHGETTOKENINTEGRITYLEVEL 1558
+#define EXPORT_PHGETTOKENINTEGRITYLEVELRID 1559
+#define EXPORT_PHGETTOKENOWNER 1560
+#define EXPORT_PHGETTOKENPRIMARYGROUP 1561
+#define EXPORT_PHGETTOKENPRIVILEGES 1562
+#define EXPORT_PHGETTOKENUSER 1563
+#define EXPORT_PHIMPERSONATETOKEN 1564
+#define EXPORT_PHISDEBUGGERPRESENT 1565
+#define EXPORT_PHISFIRMWARESUPPORTED 1566
+#define EXPORT_PHLISTENNAMEDPIPE 1567
+#define EXPORT_PHLOADAPPKEY 1568
+#define EXPORT_PHMOVEFILEWIN32 1569
+#define EXPORT_PHOPENDIRECTORYOBJECT 1570
+#define EXPORT_PHOPENDRIVER 1571
+#define EXPORT_PHOPENFILE 1572
+#define EXPORT_PHOPENFILEBYID 1573
+#define EXPORT_PHOPENKEY 1574
+#define EXPORT_PHOPENPROCESS 1575
+#define EXPORT_PHOPENPROCESSCLIENTID 1576
+#define EXPORT_PHOPENPROCESSTOKEN 1577
+#define EXPORT_PHOPENTHREAD 1578
+#define EXPORT_PHOPENTHREADPROCESS 1579
+#define EXPORT_PHPEEKNAMEDPIPE 1580
+#define EXPORT_PHQUERYENVIRONMENTVARIABLE 1581
+#define EXPORT_PHQUERYFULLATTRIBUTESFILEWIN32 1582
+#define EXPORT_PHQUERYKEY 1583
+#define EXPORT_PHQUERYSYMBOLICLINKOBJECT 1584
+#define EXPORT_PHQUERYTOKENVARIABLESIZE 1585
+#define EXPORT_PHQUERYVALUEKEY 1586
+#define EXPORT_PHQUEUEUSERWORKITEM 1587
+#define EXPORT_PHREADFILE 1588
+#define EXPORT_PHRESOLVEDEVICEPREFIX 1589
+#define EXPORT_PHREVERTIMPERSONATIONTOKEN 1590
+#define EXPORT_PHSETFILEALLOCATIONSIZE 1591
+#define EXPORT_PHSETFILEPOSITION 1592
+#define EXPORT_PHSETFILESIZE 1593
+#define EXPORT_PHSETFIRMWAREENVIRONMENTVARIABLE 1594
+#define EXPORT_PHSETOBJECTSECURITY 1595
+#define EXPORT_PHSETPROCESSPOWERTHROTTLINGSTATE 1596
+#define EXPORT_PHSETPROCESSPRIORITYBOOST 1597
+#define EXPORT_PHSETPROCESSPRIORITYCLASS 1598
+#define EXPORT_PHSETTHREADBASEPRIORITY 1599
+#define EXPORT_PHSETTHREADIOPRIORITY 1600
+#define EXPORT_PHSETTHREADNAME 1601
+#define EXPORT_PHSETTOKENISVIRTUALIZATIONENABLED 1602
+#define EXPORT_PHSETTOKENPRIVILEGE 1603
+#define EXPORT_PHSETTOKENPRIVILEGE2 1604
+#define EXPORT_PHSETTOKENSESSIONID 1605
+#define EXPORT_PHSETVALUEKEY 1606
+#define EXPORT_PHTERMINATEPROCESS 1607
+#define EXPORT_PHTRACECONTROL 1608
+#define EXPORT_PHTRANSCEIVENAMEDPIPE 1609
+#define EXPORT_PHUNLOADDLLPROCESS 1610
+#define EXPORT_PHUNLOADDRIVER 1611
+#define EXPORT_PHUPDATEDOSDEVICEPREFIXES 1612
+#define EXPORT_PHUPDATEMUPDEVICEPREFIXES 1613
+#define EXPORT_PHWAITFORNAMEDPIPE 1614
+#define EXPORT_PHWRITEFILE 1615
+#define EXPORT_PHADJUSTRECTANGLETOBOUNDS 1616
+#define EXPORT_PHADJUSTRECTANGLETOWORKINGAREA 1617
+#define EXPORT_PHCENTERRECTANGLE 1618
+#define EXPORT_PHCENTERWINDOW 1619
+#define EXPORT_PHCOMPAREUNICODESTRINGZIGNOREMENUPREFIX 1620
+#define EXPORT_PHCONSOLESETFOREGROUND 1621
+#define EXPORT_PHCONSOLESETWINDOW 1622
+#define EXPORT_PHCREATEOPENFILEDIALOG 1623
+#define EXPORT_PHCREATEPROCESS 1624
+#define EXPORT_PHCREATEPROCESSASUSER 1625
+#define EXPORT_PHCREATEPROCESSREDIRECTION 1626
+#define EXPORT_PHCREATEPROCESSWIN32 1627
+#define EXPORT_PHCREATEPROCESSWIN32EX 1628
+#define EXPORT_PHCREATESAVEFILEDIALOG 1629
+#define EXPORT_PHDELETEIMAGEVERSIONINFO 1630
+#define EXPORT_PHDEVFREEOBJECTPROPERTIES 1631
+#define EXPORT_PHDEVFREEOBJECTS 1632
+#define EXPORT_PHDEVGETOBJECTPROPERTIES 1633
+#define EXPORT_PHDEVGETOBJECTS 1634
+#define EXPORT_PHELLIPSISSTRING 1635
+#define EXPORT_PHELLIPSISSTRINGPATH 1636
+#define EXPORT_PHESCAPECOMMANDLINEPART 1637
+#define EXPORT_PHESCAPESTRINGFORMENUPREFIX 1638
+#define EXPORT_PHEXPANDENVIRONMENTSTRINGS 1639
+#define EXPORT_PHFILEREADALLTEXTWIN32 1640
+#define EXPORT_PHFINALHASH 1641
+#define EXPORT_PHFORMATDATE 1642
+#define EXPORT_PHFORMATDATETIME 1643
+#define EXPORT_PHFORMATDECIMAL 1644
+#define EXPORT_PHFORMATGUID 1645
+#define EXPORT_PHFORMATIMAGEVERSIONINFO 1646
+#define EXPORT_PHFORMATSIZE 1647
+#define EXPORT_PHFORMATTIME 1648
+#define EXPORT_PHFORMATTIMESPAN 1649
+#define EXPORT_PHFORMATTIMESPANRELATIVE 1650
+#define EXPORT_PHFORMATUINT64 1651
+#define EXPORT_PHFREEFILEDIALOG 1652
+#define EXPORT_PHFREELIBRARY 1653
+#define EXPORT_PHFREELIBRARYASIMAGERESOURCE 1654
+#define EXPORT_PHGENERATEGUID 1655
+#define EXPORT_PHGENERATEGUIDFROMNAME 1656
+#define EXPORT_PHGENERATERANDOMALPHASTRING 1657
+#define EXPORT_PHGENERATERANDOMNUMBER64 1658
+#define EXPORT_PHGETAPPLICATIONDATAFILENAME 1659
+#define EXPORT_PHGETAPPLICATIONDIRECTORY 1660
+#define EXPORT_PHGETAPPLICATIONDIRECTORYFILENAME 1661
+#define EXPORT_PHGETAPPLICATIONDIRECTORYWIN32 1662
+#define EXPORT_PHGETAPPLICATIONFILENAMEWIN32 1663
+#define EXPORT_PHGETBASEDIRECTORY 1664
+#define EXPORT_PHGETBASENAME 1665
+#define EXPORT_PHGETCLASSOBJECT 1666
+#define EXPORT_PHGETDLLFILENAME 1667
+#define EXPORT_PHGETCLIENTRECT 1668
+#define EXPORT_PHGETDPI 1669
+#define EXPORT_PHGETDPIVALUE 1670
+#define EXPORT_PHGETFILEDIALOGFILENAME 1671
+#define EXPORT_PHGETFILEDIALOGFILTERINDEX 1672
+#define EXPORT_PHGETFILEDIALOGOPTIONS 1673
+#define EXPORT_PHGETFILEVERSIONFIXEDINFO 1674
+#define EXPORT_PHGETFILEVERSIONINFO 1675
+#define EXPORT_PHGETFILEVERSIONINFOEX 1676
+#define EXPORT_PHGETFILEVERSIONINFOLANGCODEPAGE 1677
+#define EXPORT_PHGETFILEVERSIONINFOSTRING 1678
+#define EXPORT_PHGETFILEVERSIONINFOSTRING2 1679
+#define EXPORT_PHGETFULLPATH 1680
+#define EXPORT_PHGETKNOWNFOLDERPATH 1681
+#define EXPORT_PHGETKNOWNLOCATION 1682
+#define EXPORT_PHGETMESSAGE 1683
+#define EXPORT_PHGETMONITORDPI 1684
+#define EXPORT_PHGETNTMESSAGE 1685
+#define EXPORT_PHGETNTSYSTEMROOT 1686
+#define EXPORT_PHGETSIZEDPIVALUE 1687
+#define EXPORT_PHGETSTATUSMESSAGE 1688
+#define EXPORT_PHGETSYSTEMDIRECTORY 1689
+#define EXPORT_PHGETSYSTEMDPI 1690
+#define EXPORT_PHGETSYSTEMMETRICS 1691
+#define EXPORT_PHGETSYSTEMPARAMETERSINFO 1692
+#define EXPORT_PHGETSYSTEMROOT 1693
+#define EXPORT_PHGETTASKBARDPI 1694
+#define EXPORT_PHGETTEMPORARYDIRECTORYRANDOMALPHAFILENAME 1695
+#define EXPORT_PHGETUSERLOCALEINFOBOOL 1696
+#define EXPORT_PHGETWIN32MESSAGE 1697
+#define EXPORT_PHGETWINDOWDPI 1698
+#define EXPORT_PHINITIALIZEHASH 1699
+#define EXPORT_PHINITIALIZEIMAGEVERSIONINFO 1700
+#define EXPORT_PHINITIALIZEIMAGEVERSIONINFOEX 1701
+#define EXPORT_PHINITIALIZEPROCTHREADATTRIBUTELIST 1702
+#define EXPORT_PHLARGEINTEGERTOLOCALSYSTEMTIME 1703
+#define EXPORT_PHLARGEINTEGERTOSYSTEMTIME 1704
+#define EXPORT_PHLOADLIBRARY 1705
+#define EXPORT_PHLOADLIBRARYASIMAGERESOURCE 1706
+#define EXPORT_PHMAPFLAGS1 1707
+#define EXPORT_PHMAPFLAGS2 1708
+#define EXPORT_PHMATCHWILDCARDS 1709
+#define EXPORT_PHPARSECOMMANDLINE 1710
+#define EXPORT_PHPARSECOMMANDLINEFUZZY 1711
+#define EXPORT_PHPARSECOMMANDLINEPART 1712
+#define EXPORT_PHQUERYREGISTRYSTRING 1713
+#define EXPORT_PHQUERYREGISTRYULONG 1714
+#define EXPORT_PHQUERYREGISTRYULONG64 1715
+#define EXPORT_PHSETFILEDIALOGFILENAME 1716
+#define EXPORT_PHSETFILEDIALOGFILTER 1717
+#define EXPORT_PHSETFILEDIALOGOPTIONS 1718
+#define EXPORT_PHSHELLEXECUTE 1719
+#define EXPORT_PHSHELLEXECUTEEX 1720
+#define EXPORT_PHSHELLEXPLOREFILE 1721
+#define EXPORT_PHSHELLPROPERTIES 1722
+#define EXPORT_PHSHOWCONFIRMMESSAGE 1723
+#define EXPORT_PHSHOWCONTINUESTATUS 1724
+#define EXPORT_PHSHOWFILEDIALOG 1725
+#define EXPORT_PHSHOWMESSAGE 1726
+#define EXPORT_PHSHOWMESSAGE2 1727
+#define EXPORT_PHSHOWMESSAGEONETIME 1728
+#define EXPORT_PHSHOWSTATUS 1729
+#define EXPORT_PHSHOWTASKDIALOG 1730
+#define EXPORT_PHSTRINGTOGUID 1731
+#define EXPORT_PHSYSTEMTIMETOLARGEINTEGER 1732
+#define EXPORT_PHSYSTEMTIMETOTZSPECIFICLOCALTIME 1733
+#define EXPORT_PHTASKBARLISTCREATE 1734
+#define EXPORT_PHTASKBARLISTDESTROY 1735
+#define EXPORT_PHTASKBARLISTSETOVERLAYICON 1736
+#define EXPORT_PHTASKBARLISTSETPROGRESSSTATE 1737
+#define EXPORT_PHTASKBARLISTSETPROGRESSVALUE 1738
+#define EXPORT_PHUPDATEHASH 1739
+#define EXPORT_PHUPDATEPROCTHREADATTRIBUTE 1740
+#define EXPORT_PHWAITFORMULTIPLEOBJECTSANDPUMP 1741
+#define EXPORT_PHCLEARCIRCULARBUFFER_FLOAT 1742
+#define EXPORT_PHCLEARCIRCULARBUFFER_PVOID 1743
+#define EXPORT_PHCLEARCIRCULARBUFFER_ULONG 1744
+#define EXPORT_PHCLEARCIRCULARBUFFER_ULONG64 1745
+#define EXPORT_PHCOPYCIRCULARBUFFER_FLOAT 1746
+#define EXPORT_PHCOPYCIRCULARBUFFER_PVOID 1747
+#define EXPORT_PHCOPYCIRCULARBUFFER_ULONG 1748
+#define EXPORT_PHCOPYCIRCULARBUFFER_ULONG64 1749
+#define EXPORT_PHDELETECIRCULARBUFFER_FLOAT 1750
+#define EXPORT_PHDELETECIRCULARBUFFER_PVOID 1751
+#define EXPORT_PHDELETECIRCULARBUFFER_ULONG 1752
+#define EXPORT_PHDELETECIRCULARBUFFER_ULONG64 1753
+#define EXPORT_PHINITIALIZECIRCULARBUFFER_FLOAT 1754
+#define EXPORT_PHINITIALIZECIRCULARBUFFER_PVOID 1755
+#define EXPORT_PHINITIALIZECIRCULARBUFFER_ULONG 1756
+#define EXPORT_PHINITIALIZECIRCULARBUFFER_ULONG64 1757
+#define EXPORT_PHRESIZECIRCULARBUFFER_FLOAT 1758
+#define EXPORT_PHRESIZECIRCULARBUFFER_PVOID 1759
+#define EXPORT_PHRESIZECIRCULARBUFFER_ULONG 1760
+#define EXPORT_PHRESIZECIRCULARBUFFER_ULONG64 1761
+#define EXPORT_PHGETGENERICTREENEWLINES 1762
+#define EXPORT_PHGETLISTVIEWITEMTEXT 1763
+#define EXPORT_PHGETILISTVIEWITEMTEXT 1764
+#define EXPORT_PHGETLISTVIEWSELECTEDITEMTEXT 1765
+#define EXPORT_PHGETTREENEWTEXT 1766
+#define EXPORT_PHCREATEEMENU 1767
+#define EXPORT_PHCREATEEMENUITEM 1768
+#define EXPORT_PHDESTROYEMENU 1769
+#define EXPORT_PHDESTROYEMENUITEM 1770
+#define EXPORT_PHFINDEMENUITEM 1771
+#define EXPORT_PHINDEXOFEMENUITEM 1772
+#define EXPORT_PHINSERTEMENUITEM 1773
+#define EXPORT_PHLOADRESOURCEEMENUITEM 1774
+#define EXPORT_PHMODIFYEMENUITEM 1775
+#define EXPORT_PHREMOVEALLEMENUITEMS 1776
+#define EXPORT_PHREMOVEEMENUITEM 1777
+#define EXPORT_PHSETFLAGSALLEMENUITEMS 1778
+#define EXPORT_PHSETFLAGSEMENUITEM 1779
+#define EXPORT_PHSHOWEMENU 1780
+#define EXPORT_PHDELETEFASTLOCK 1781
+#define EXPORT_PHINITIALIZEFASTLOCK 1782
+#define EXPORT_PHFACQUIREFASTLOCKEXCLUSIVE 1783
+#define EXPORT_PHFACQUIREFASTLOCKSHARED 1784
+#define EXPORT_PHFRELEASEFASTLOCKEXCLUSIVE 1785
+#define EXPORT_PHFRELEASEFASTLOCKSHARED 1786
+#define EXPORT_PHFTRYACQUIREFASTLOCKEXCLUSIVE 1787
+#define EXPORT_PHFTRYACQUIREFASTLOCKSHARED 1788
+#define EXPORT_PHCREATEFILESTREAM 1789
+#define EXPORT_PHCREATEFILESTREAM2 1790
+#define EXPORT_PHFLUSHFILESTREAM 1791
+#define EXPORT_PHGETPOSITIONFILESTREAM 1792
+#define EXPORT_PHLOCKFILESTREAM 1793
+#define EXPORT_PHREADFILESTREAM 1794
+#define EXPORT_PHSEEKFILESTREAM 1795
+#define EXPORT_PHUNLOCKFILESTREAM 1796
+#define EXPORT_PHVERIFYFILESTREAM 1797
+#define EXPORT_PHWRITEFILESTREAM 1798
+#define EXPORT_PHWRITESTRINGASUTF8FILESTREAM 1799
+#define EXPORT_PHWRITESTRINGASUTF8FILESTREAMEX 1800
+#define EXPORT_PHWRITESTRINGFORMATASUTF8FILESTREAM 1801
+#define EXPORT_PHWRITESTRINGFORMATASUTF8FILESTREAM_V 1802
+#define EXPORT_PHDELETEGRAPHSTATE 1803
+#define EXPORT_PHDRAWGRAPHDIRECT 1804
+#define EXPORT_PHDRAWTRAYICONTEXT 1805
+#define EXPORT_PHGETDRAWINFOGRAPHBUFFERS 1806
+#define EXPORT_PHGRAPHSTATEGETDRAWINFO 1807
+#define EXPORT_PHINITIALIZEGRAPHSTATE 1808
+#define EXPORT_PHNFGETTRAYICONFONT 1809
+#define EXPORT_PHSETGRAPHTEXT 1810
+#define EXPORT_PHADDLAYOUTITEM 1811
+#define EXPORT_PHADDLAYOUTITEMEX 1812
+#define EXPORT_PHADDLISTVIEWCOLUMN 1813
+#define EXPORT_PHADDILISTVIEWCOLUMN 1814
+#define EXPORT_PHADDILISTVIEWGROUP 1815
+#define EXPORT_PHADDILISTVIEWGROUPITEM 1816
+#define EXPORT_PHADDLISTVIEWGROUP 1817
+#define EXPORT_PHADDLISTVIEWGROUPITEM 1818
+#define EXPORT_PHADDLISTVIEWITEM 1819
+#define EXPORT_PHADDILISTVIEWITEM 1820
+#define EXPORT_PHADDTABCONTROLTAB 1821
+#define EXPORT_PHBITMAPSETALPHA 1822
+#define EXPORT_PHCREATEDIALOG 1823
+#define EXPORT_PHCREATEWINDOWEX 1824
+#define EXPORT_PHDELETELAYOUTMANAGER 1825
+#define EXPORT_PHDIALOGBOX 1826
+#define EXPORT_PHENUMCHILDWINDOWS 1827
+#define EXPORT_PHENUMWINDOWS 1828
+#define EXPORT_PHFINDILISTVIEWITEMBYFLAGS 1829
+#define EXPORT_PHFINDLISTVIEWITEMBYFLAGS 1830
+#define EXPORT_PHFINDLISTVIEWITEMBYPARAM 1831
+#define EXPORT_PHFINDILISTVIEWITEMBYPARAM 1832
+#define EXPORT_PHGETCOMBOBOXSTRING 1833
+#define EXPORT_PHGETDIALOGITEMVALUE 1834
+#define EXPORT_PHGETILISTVIEWITEMPARAM 1835
+#define EXPORT_PHGETLISTBOXSTRING 1836
+#define EXPORT_PHGETLISTVIEWITEMIMAGEINDEX 1837
+#define EXPORT_PHGETLISTVIEWITEMPARAM 1838
+#define EXPORT_PHGETSELECTEDLISTVIEWITEMPARAM 1839
+#define EXPORT_PHGETSELECTEDILISTVIEWITEMPARAM 1840
+#define EXPORT_PHGETSELECTEDLISTVIEWITEMPARAMS 1841
+#define EXPORT_PHGETSELECTEDILISTVIEWITEMPARAMS 1842
+#define EXPORT_PHGETSTOCKAPPLICATIONICON 1843
+#define EXPORT_PHGETSTOCKOBJECT 1844
+#define EXPORT_PHGETWINDOWCLIENTID 1845
+#define EXPORT_PHGETWINDOWCONTEXT 1846
+#define EXPORT_PHGETWINDOWTEXT 1847
+#define EXPORT_PHGETWINDOWTEXTEX 1848
+#define EXPORT_PHICONTOBITMAP 1849
+#define EXPORT_PHIMAGELISTADDBITMAP 1850
+#define EXPORT_PHIMAGELISTADDICON 1851
+#define EXPORT_PHIMAGELISTCREATE 1852
+#define EXPORT_PHIMAGELISTDESTROY 1853
+#define EXPORT_PHIMAGELISTDRAWEX 1854
+#define EXPORT_PHIMAGELISTDRAWICON 1855
+#define EXPORT_PHIMAGELISTGETICON 1856
+#define EXPORT_PHIMAGELISTREMOVEICON 1857
+#define EXPORT_PHIMAGELISTREPLACE 1858
+#define EXPORT_PHIMAGELISTSETBKCOLOR 1859
+#define EXPORT_PHIMAGELISTSETICONSIZE 1860
+#define EXPORT_PHIMAGELISTSETIMAGECOUNT 1861
+#define EXPORT_PHINITIALIZELAYOUTMANAGER 1862
+#define EXPORT_PHLAYOUTMANAGERLAYOUT 1863
+#define EXPORT_PHLOADICON 1864
+#define EXPORT_PHLOADIMAGEFORMATFROMRESOURCE 1865
+#define EXPORT_PHMODALPROPERTYSHEET 1866
+#define EXPORT_PHQUERYDIRECTXEXCLUSIVEOWNERSHIP 1867
+#define EXPORT_PHINITIALIZEWINDOWTHEME 1868
+#define EXPORT_PHREINITIALIZETHEME 1869
+#define EXPORT_PHREGISTERWINDOWCALLBACK 1870
+#define EXPORT_PHREMOVELISTVIEWITEM 1871
+#define EXPORT_PHREMOVEILISTVIEWITEM 1872
+#define EXPORT_PHREMOVEWINDOWCONTEXT 1873
+#define EXPORT_PHSELECTCOMBOBOXSTRING 1874
+#define EXPORT_PHSETCLIPBOARDSTRING 1875
+#define EXPORT_PHSETCONTROLTHEME 1876
+#define EXPORT_PHSETDIALOGITEMTEXT 1877
+#define EXPORT_PHSETDIALOGITEMVALUE 1878
+#define EXPORT_PHSETEXTENDEDLISTVIEW 1879
+#define EXPORT_PHSETGROUPBOXTEXT 1880
+#define EXPORT_PHSETHEADERSORTICON 1881
+#define EXPORT_PHSETIMAGELISTBITMAP 1882
+#define EXPORT_PHSETLISTVIEWITEMIMAGEINDEX 1883
+#define EXPORT_PHSETILISTVIEWITEMIMAGEINDEX 1884
+#define EXPORT_PHSETLISTVIEWITEMPARAM 1885
+#define EXPORT_PHSETLISTVIEWSUBITEM 1886
+#define EXPORT_PHSETILISTVIEWSUBITEM 1887
+#define EXPORT_PHSETSTATEALLLISTVIEWITEMS 1888
+#define EXPORT_PHSETWINDOWCONTEXT 1889
+#define EXPORT_PHSETWINDOWTEXT 1890
+#define EXPORT_PHTHEMEWINDOWDRAWBUTTON 1891
+#define EXPORT_PHTHEMEWINDOWDRAWREBAR 1892
+#define EXPORT_PHTHEMEWINDOWDRAWTOOLBAR 1893
+#define EXPORT_PHUNREGISTERWINDOWCALLBACK 1894
+#define EXPORT_PHWINDOWTHEMECONTROLCOLOR 1895
+#define EXPORT_PHISTHEMESUPPORTENABLED 1896
+#define EXPORT_PHWINDOWTHEMESETDARKMODE 1897
+#define EXPORT_PHREINITIALIZESTREAMERMODE 1898
+#define EXPORT_PHCALLKPHQUERYFILEINFORMATIONWITHTIMEOUT 1899
+#define EXPORT_PHCOMPAREOBJECTS 1900
+#define EXPORT_PHENUMOBJECTTYPES 1901
+#define EXPORT_PHFORMATNATIVEKEYNAME 1902
+#define EXPORT_PHGETETWPUBLISHERNAME 1903
+#define EXPORT_PHGETHANDLEINFORMATION 1904
+#define EXPORT_PHGETHANDLEINFORMATIONEX 1905
+#define EXPORT_PHGETOBJECTTYPENAME 1906
+#define EXPORT_PHQUERYOBJECTNAME 1907
+#define EXPORT_PHSTDGETCLIENTIDNAME 1908
+#define EXPORT_PHENUMERATEPRIVILEGES 1909
+#define EXPORT_PHGETSIDFULLNAME 1910
+#define EXPORT_PHLOOKUPNAME 1911
+#define EXPORT_PHLOOKUPPRIVILEGEDISPLAYNAME 1912
+#define EXPORT_PHLOOKUPPRIVILEGENAME 1913
+#define EXPORT_PHLOOKUPPRIVILEGEVALUE 1914
+#define EXPORT_PHLOOKUPSID 1915
+#define EXPORT_PHOPENLSAPOLICY 1916
+#define EXPORT_PHSIDTOSTRINGSID 1917
+#define EXPORT_PHLOADMAPPEDIMAGE 1918
+#define EXPORT_PHLOADMAPPEDIMAGEEX 1919
+#define EXPORT_PHLOADMAPPEDIMAGEHEADERPAGESIZE 1920
+#define EXPORT_PHUNLOADMAPPEDIMAGE 1921
+#define EXPORT_PHBOOSTPROVIDER 1922
+#define EXPORT_PHDELETEPROVIDERTHREAD 1923
+#define EXPORT_PHGETENABLEDPROVIDER 1924
+#define EXPORT_PHINITIALIZEPROVIDERTHREAD 1925
+#define EXPORT_PHREGISTERPROVIDER 1926
+#define EXPORT_PHSETENABLEDPROVIDER 1927
+#define EXPORT_PHSETINTERVALPROVIDERTHREAD 1928
+#define EXPORT_PHSTARTPROVIDERTHREAD 1929
+#define EXPORT_PHSTOPPROVIDERTHREAD 1930
+#define EXPORT_PHUNREGISTERPROVIDER 1931
+#define EXPORT_PHADDSETTING 1932
+#define EXPORT_PHADDSETTINGS 1933
+#define EXPORT_PHCLEARIGNOREDSETTINGS 1934
+#define EXPORT_PHCONVERTIGNOREDSETTINGS 1935
+#define EXPORT_PHGETINTEGERPAIRSTRINGREFSETTING 1936
+#define EXPORT_PHGETINTEGERSTRINGREFSETTING 1937
+#define EXPORT_PHGETSCALABLEINTEGERPAIRSTRINGREFSETTING 1938
+#define EXPORT_PHGETSTRINGREFSETTING 1939
+#define EXPORT_PHLOADCUSTOMCOLORLIST 1940
+#define EXPORT_PHLOADLISTVIEWCOLUMNSETTINGS 1941
+#define EXPORT_PHLOADLISTVIEWCOLUMNSFROMSETTING 1942
+#define EXPORT_PHLOADLISTVIEWGROUPSTATESFROMSETTING 1943
+#define EXPORT_PHLOADLISTVIEWSORTCOLUMNSFROMSETTING 1944
+#define EXPORT_PHLOADSETTINGS 1945
+#define EXPORT_PHLOADWINDOWPLACEMENTFROMSETTING 1946
+#define EXPORT_PHRESETSETTINGS 1947
+#define EXPORT_PHSAVECUSTOMCOLORLIST 1948
+#define EXPORT_PHSAVELISTVIEWCOLUMNSETTINGS 1949
+#define EXPORT_PHSAVELISTVIEWCOLUMNSTOSETTING 1950
+#define EXPORT_PHSAVELISTVIEWGROUPSTATESTOSETTING 1951
+#define EXPORT_PHSAVELISTVIEWSORTCOLUMNSTOSETTING 1952
+#define EXPORT_PHSAVESETTINGS 1953
+#define EXPORT_PHSAVEWINDOWPLACEMENTTOSETTING 1954
+#define EXPORT_PHSETINTEGERPAIRSTRINGREFSETTING 1955
+#define EXPORT_PHSETINTEGERSTRINGREFSETTING 1956
+#define EXPORT_PHSETSCALABLEINTEGERPAIRSTRINGREFSETTING 1957
+#define EXPORT_PHSETSCALABLEINTEGERPAIRSTRINGREFSETTING2 1958
+#define EXPORT_PHSETSTRINGREFSETTING 1959
+#define EXPORT_PHUPDATECACHEDSETTINGS 1960
+#define EXPORT_PHCREATESECURITYPAGE 1961
+#define EXPORT_PHEDITSECURITY 1962
+#define EXPORT_PHGETACCESSENTRIES 1963
+#define EXPORT_PHGETACCESSSTRING 1964
+#define EXPORT_PHGETSEOBJECTSECURITY 1965
+#define EXPORT_PHSETSEOBJECTSECURITY 1966
+#define EXPORT_PHSTDGETOBJECTSECURITY 1967
+#define EXPORT_PHSTDSETOBJECTSECURITY 1968
+#define EXPORT_PHCHANGESERVICECONFIG2 1969
+#define EXPORT_PHCLOSESERVICEHANDLE 1970
+#define EXPORT_PHENUMDEPENDENTSERVICES 1971
+#define EXPORT_PHGETSERVICECONFIG 1972
+#define EXPORT_PHGETSERVICECONFIGFILENAME 1973
+#define EXPORT_PHGETSERVICEDESCRIPTION 1974
+#define EXPORT_PHGETSERVICEDLLPARAMETER 1975
+#define EXPORT_PHGETSERVICEERRORCONTROLINTEGER 1976
+#define EXPORT_PHGETSERVICEERRORCONTROLSTRING 1977
+#define EXPORT_PHGETSERVICEFILENAME 1978
+#define EXPORT_PHGETSERVICENAMEFROMTAG 1979
+#define EXPORT_PHGETSERVICESTARTTYPEINTEGER 1980
+#define EXPORT_PHGETSERVICESTARTTYPESTRING 1981
+#define EXPORT_PHGETSERVICESTATESTRING 1982
+#define EXPORT_PHGETSERVICETYPEINTEGER 1983
+#define EXPORT_PHGETSERVICETYPESTRING 1984
+#define EXPORT_PHGETTHREADSERVICETAG 1985
+#define EXPORT_PHOPENSERVICE 1986
+#define EXPORT_PHOPENSERVICEKEY 1987
+#define EXPORT_PHQUERYSERVICECONFIG 1988
+#define EXPORT_PHQUERYSERVICECONFIG2 1989
+#define EXPORT_PHQUERYSERVICESTATUS 1990
+#define EXPORT_PHQUERYSERVICEVARIABLESIZE 1991
+#define EXPORT_PHSTARTSERVICE 1992
+#define EXPORT_PHSTOPSERVICE 1993
+#define EXPORT_PHCREATESYMBOLPROVIDER 1994
+#define EXPORT_PHGETLINEFROMADDRESS 1995
+#define EXPORT_PHGETMODULEFROMADDRESS 1996
+#define EXPORT_PHGETSYMBOLFROMADDRESS 1997
+#define EXPORT_PHGETSYMBOLFROMNAME 1998
+#define EXPORT_PHLOADSYMBOLPROVIDERMODULES 1999
+#define EXPORT_PHLOADMODULESYMBOLPROVIDER 2000
+#define EXPORT_PHLOADMODULESFORVIRTUALSYMBOLPROVIDER 2001
+#define EXPORT_PHSETOPTIONSSYMBOLPROVIDER 2002
+#define EXPORT_PHSETSEARCHPATHSYMBOLPROVIDER 2003
+#define EXPORT_PHSTACKWALK 2004
+#define EXPORT_PHWALKTHREADSTACK 2005
+#define EXPORT_PHWRITEMINIDUMPPROCESS 2006
+#define EXPORT_PHVERIFYFILE 2007
+#define EXPORT_PHVERIFYFILEISCHAINEDTOMICROSOFT 2008
+#define EXPORT_PHDELETEWORKQUEUE 2009
+#define EXPORT_PHGETGLOBALWORKQUEUE 2010
+#define EXPORT_PHINITIALIZEWORKQUEUE 2011
+#define EXPORT_PHINITIALIZEWORKQUEUEENVIRONMENT 2012
+#define EXPORT_PHQUEUEITEMWORKQUEUE 2013
+#define EXPORT_PHQUEUEITEMWORKQUEUEEX 2014
+#define EXPORT_PHWAITFORWORKQUEUE 2015
+#define EXPORT_PHADDJSONARRAYOBJECT 2016
+#define EXPORT_PHADDJSONOBJECT 2017
+#define EXPORT_PHADDJSONOBJECT2 2018
+#define EXPORT_PHADDJSONOBJECTINT64 2019
+#define EXPORT_PHADDJSONOBJECTUINT64 2020
+#define EXPORT_PHADDJSONOBJECTVALUE 2021
+#define EXPORT_PHCREATEJSONARRAY 2022
+#define EXPORT_PHCREATEJSONOBJECT 2023
+#define EXPORT_PHCREATEJSONPARSER 2024
+#define EXPORT_PHCREATEJSONPARSEREX 2025
+#define EXPORT_PHFREEJSONOBJECT 2026
+#define EXPORT_PHGETJSONARRAYINDEXOBJECT 2027
+#define EXPORT_PHGETJSONARRAYLENGTH 2028
+#define EXPORT_PHGETJSONARRAYLONG64 2029
+#define EXPORT_PHGETJSONARRAYSTRING 2030
+#define EXPORT_PHGETJSONOBJECT 2031
+#define EXPORT_PHGETJSONOBJECTASARRAYLIST 2032
+#define EXPORT_PHGETJSONOBJECTBOOL 2033
+#define EXPORT_PHGETJSONOBJECTLENGTH 2034
+#define EXPORT_PHGETJSONOBJECTTYPE 2035
+#define EXPORT_PHGETJSONVALUEASINT64 2036
+#define EXPORT_PHGETJSONVALUEASSTRING 2037
+#define EXPORT_PHGETJSONVALUEASUINT64 2038
+#define EXPORT_PHCREATEXMLNODE 2039
+#define EXPORT_PHCREATEXMLOPAQUENODE 2040
+#define EXPORT_PHFINDXMLOBJECT 2041
+#define EXPORT_PHFREEXMLOBJECT 2042
+#define EXPORT_PHGETXMLINTERFACE 2043
+#define EXPORT_PHGETXMLNODEATTRIBUTEBYINDEX 2044
+#define EXPORT_PHGETXMLNODEATTRIBUTECOUNT 2045
+#define EXPORT_PHGETXMLNODEATTRIBUTETEXT 2046
+#define EXPORT_PHGETXMLNODEELEMENTTEXT 2047
+#define EXPORT_PHGETXMLNODEFIRSTCHILD 2048
+#define EXPORT_PHGETXMLNODENEXTCHILD 2049
+#define EXPORT_PHGETXMLNODEOPAQUETEXT 2050
+#define EXPORT_PHGETXMLOBJECT 2051
+#define EXPORT_PHLOADXMLOBJECTFROMFILE 2052
+#define EXPORT_PHLOADXMLOBJECTFROMSTRING 2053
+#define EXPORT_PHSAVEXMLOBJECTTOFILE 2054
+#define EXPORT_PHSETXMLNODEATTRIBUTETEXT 2055
+#define EXPORT_PHCLEARCACHEDIRECTORY 2056
+#define EXPORT_PHCREATECACHEFILE 2057
+#define EXPORT_PHDELETECACHEFILE 2058
+#define EXPORT_PHAPPRESOLVERGETAPPIDFORWINDOW 2059
+#define EXPORT_PHGETPROCESSPACKAGEFULLNAME 2060
+#define EXPORT_PHDNSFREE 2061
+#define EXPORT_PHDNSQUERY 2062
+#define EXPORT_PHDNSQUERY2 2063
+#define EXPORT_PHHTTPDNSQUERY 2064
+#define EXPORT_PHHTTPSOCKETADDREQUESTHEADERS 2065
+#define EXPORT_PHHTTPSOCKETBEGINREQUEST 2066
+#define EXPORT_PHHTTPSOCKETCLOSE 2067
+#define EXPORT_PHHTTPSOCKETCONNECT 2068
+#define EXPORT_PHHTTPSOCKETCREATE 2069
+#define EXPORT_PHHTTPSOCKETDESTROY 2070
+#define EXPORT_PHHTTPSOCKETDOWNLOADSTRING 2071
+#define EXPORT_PHHTTPSOCKETENDREQUEST 2072
+#define EXPORT_PHHTTPSOCKETGETERRORMESSAGE 2073
+#define EXPORT_PHHTTPSOCKETPARSEURL 2074
+#define EXPORT_PHHTTPSOCKETQUERYHEADERSTRING 2075
+#define EXPORT_PHHTTPSOCKETQUERYHEADERULONG 2076
+#define EXPORT_PHHTTPSOCKETQUERYHEADERULONG64 2077
+#define EXPORT_PHHTTPSOCKETQUERYHEADERS 2078
+#define EXPORT_PHHTTPSOCKETQUERYOPTIONSTRING 2079
+#define EXPORT_PHHTTPSOCKETREADDATA 2080
+#define EXPORT_PHHTTPSOCKETREADDATATOBUFFER 2081
+#define EXPORT_PHHTTPSOCKETSENDREQUEST 2082
+#define EXPORT_PHHTTPSOCKETSETCREDENTIALS 2083
+#define EXPORT_PHHTTPSOCKETSETFEATURE 2084
+#define EXPORT_PHHTTPSOCKETSETSECURITY 2085
+#define EXPORT_PHHTTPSOCKETWRITEDATA 2086
+#define EXPORT_KSILEVEL 2087
+#define EXPORT_KPHALPCQUERYINFORMATION 2088
+#define EXPORT_KPHDUPLICATEOBJECT 2089
+#define EXPORT_KPHOPENDEVICE 2090
+#define EXPORT_KPHOPENDEVICEBASEDEVICE 2091
+#define EXPORT_KPHOPENDEVICEDRIVER 2092
+#define EXPORT_KPHQUERYINFORMATIONDRIVER 2093
+#define EXPORT_KPHQUERYINFORMATIONOBJECT 2094
+#define EXPORT_KSIENUMERATEPROCESSHANDLES 2095
+#define EXPORT_KSIQUERYHASHINFORMATIONFILE 2096
-#endif _PH_EXPORT_DEF_H
\ No newline at end of file
+#endif _PH_EXPORT_DEF_H
diff --git a/SystemInformer/SystemInformer.rc b/SystemInformer/SystemInformer.rc
index 25249c591d09..bf12081492b9 100644
--- a/SystemInformer/SystemInformer.rc
+++ b/SystemInformer/SystemInformer.rc
@@ -1425,9 +1425,9 @@ BEGIN
DEFPUSHBUTTON "OK",IDOK,62,82,50,14
PUSHBUTTON "Cancel",IDCANCEL,116,82,50,14
PUSHBUTTON "&Browse...",IDC_BROWSE,170,82,50,14
- CONTROL "Create this task with TrustedInstaller privileges.",IDC_TRUSTEDINSTALLER,
+ CONTROL "Create this task with &TrustedInstaller privileges.",IDC_TRUSTEDINSTALLER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,62,180,10
- CONTROL "Create this task with Administrative privileges.",IDC_TOGGLEELEVATION,
+ CONTROL "Create this task with &Administrative privileges.",IDC_TOGGLEELEVATION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,51,180,10
END
diff --git a/SystemInformer/SystemInformer.vcxproj b/SystemInformer/SystemInformer.vcxproj
index 1c28b7dafd53..a10c2ad43f33 100644
--- a/SystemInformer/SystemInformer.vcxproj
+++ b/SystemInformer/SystemInformer.vcxproj
@@ -231,8 +231,6 @@
-
-
@@ -339,6 +337,7 @@
+
diff --git a/SystemInformer/SystemInformer.vcxproj.filters b/SystemInformer/SystemInformer.vcxproj.filters
index 35d8d0002268..68cdc8e04c65 100644
--- a/SystemInformer/SystemInformer.vcxproj.filters
+++ b/SystemInformer/SystemInformer.vcxproj.filters
@@ -306,18 +306,12 @@
System Informer
-
- System Informer
-
System Informer
System Informer
-
- System Informer
-
System Informer
@@ -500,6 +494,9 @@
Headers
+
+ Headers
+
diff --git a/SystemInformer/about.c b/SystemInformer/about.c
index 0c7e89c3acf3..b104315f3da0 100644
--- a/SystemInformer/about.c
+++ b/SystemInformer/about.c
@@ -71,7 +71,7 @@ static INT_PTR CALLBACK PhpAboutDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
PhRegisterWindowCallback(hwndDlg, PH_PLUGIN_WINDOW_EVENT_TYPE_TOPMOST, NULL);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/actions.c b/SystemInformer/actions.c
index 94ee7c921b60..11ef225c0760 100644
--- a/SystemInformer/actions.c
+++ b/SystemInformer/actions.c
@@ -4142,8 +4142,6 @@ HRESULT CALLBACK PhpUiServiceInitializeDialogCallbackProc(
{
PhShowServiceProgressDialogStatusPage(context);
}
-
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
}
break;
}
@@ -6436,6 +6434,8 @@ BOOLEAN PhUiCloseHandles(
{
if (FlagOn(Handles[i]->Attributes, OBJ_PROTECT_CLOSE))
{
+ success = FALSE;
+
if (!PhpShowErrorHandle(
WindowHandle,
L"close",
@@ -6444,9 +6444,7 @@ BOOLEAN PhUiCloseHandles(
STATUS_HANDLE_NOT_CLOSABLE,
0
))
- {
break;
- }
}
status = NtDuplicateObject(
diff --git a/SystemInformer/affinity.c b/SystemInformer/affinity.c
index 3daec4dc937b..b6f22cfa71b5 100644
--- a/SystemInformer/affinity.c
+++ b/SystemInformer/affinity.c
@@ -497,7 +497,7 @@ INT_PTR CALLBACK PhpProcessAffinityDlgProc(
}
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/chcol.c b/SystemInformer/chcol.c
index 876ba32436e7..5e70f381a068 100644
--- a/SystemInformer/chcol.c
+++ b/SystemInformer/chcol.c
@@ -24,6 +24,10 @@ typedef struct _COLUMNS_DIALOG_CONTEXT
HBRUSH BrushPushed;
HBRUSH BrushHot;
COLORREF TextColor;
+ HBRUSH BrushNormalDark;
+ HBRUSH BrushPushedDark;
+ HBRUSH BrushHotDark;
+ COLORREF TextColorDark;
HWND InactiveWindowHandle;
HWND ActiveWindowHandle;
@@ -256,20 +260,15 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
Button_Enable(context->MoveUpHandle, FALSE);
Button_Enable(context->MoveDownHandle, FALSE);
- if (PhEnableThemeSupport)
- {
- context->BrushNormal = CreateSolidBrush(PhThemeWindowBackgroundColor);
- context->BrushHot = CreateSolidBrush(PhThemeWindowHighlightColor);
- context->BrushPushed = CreateSolidBrush(PhThemeWindowHighlight2Color);
- context->TextColor = PhThemeWindowTextColor;
- }
- else
- {
- context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
- context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
- context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
- context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
- }
+ context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
+ context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
+ context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
+ context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
+
+ context->BrushNormalDark = CreateSolidBrush(PhThemeWindowBackgroundColor);
+ context->BrushHotDark = CreateSolidBrush(PhThemeWindowHighlightColor);
+ context->BrushPushedDark = CreateSolidBrush(PhThemeWindowHighlight2Color);
+ context->TextColorDark = PhThemeWindowTextColor;
if (context->Type == PH_CONTROL_TYPE_TREE_NEW)
{
@@ -340,7 +339,7 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_INACTIVE, LBN_SELCHANGE), (LPARAM)context->InactiveWindowHandle);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ACTIVE, LBN_SELCHANGE), (LPARAM)context->ActiveWindowHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDCANCEL));
}
@@ -356,6 +355,12 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
DeleteBrush(context->BrushHot);
if (context->BrushPushed)
DeleteBrush(context->BrushPushed);
+ if (context->BrushNormalDark)
+ DeleteBrush(context->BrushNormalDark);
+ if (context->BrushHotDark)
+ DeleteBrush(context->BrushHotDark);
+ if (context->BrushPushedDark)
+ DeleteBrush(context->BrushPushedDark);
if (context->ControlFont)
DeleteFont(context->ControlFont);
if (context->InactiveListArray)
@@ -696,16 +701,15 @@ INT_PTR CALLBACK PhpColumnsDlgProc(
if (isSelected || isFocused)
{
- FillRect(bufferDc, &bufferRect, context->BrushHot);
+ FillRect(bufferDc, &bufferRect, PhEnableThemeSupport ? context->BrushHotDark : context->BrushHot);
//FrameRect(bufferDc, &bufferRect, PhGetStockBrush(BLACK_BRUSH));
- SetTextColor(bufferDc, context->TextColor);
}
else
{
- FillRect(bufferDc, &bufferRect, context->BrushNormal);
+ FillRect(bufferDc, &bufferRect, PhEnableThemeSupport ? context->BrushNormalDark : context->BrushNormal);
//FrameRect(bufferDc, &bufferRect, GetSysColorBrush(COLOR_HIGHLIGHTTEXT));
- SetTextColor(bufferDc, context->TextColor);
}
+ SetTextColor(bufferDc, PhEnableThemeSupport ? context->TextColorDark : context->TextColor);
bufferRect.left += 5;
DrawText(
diff --git a/SystemInformer/chdlg.c b/SystemInformer/chdlg.c
index 8269f5d179c9..627a4940691f 100644
--- a/SystemInformer/chdlg.c
+++ b/SystemInformer/chdlg.c
@@ -220,7 +220,7 @@ INT_PTR CALLBACK PhChoiceDlgProc(
SWP_NOACTIVATE | SWP_NOZORDER);
}
- PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(WindowHandle);
PhSetDialogFocus(WindowHandle, comboBoxHandle);
}
@@ -430,9 +430,12 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc(
PhSetDialogFocus(WindowHandle, context->ComboBoxHandle);
- if (PhEnableThemeSupport)
- ShowWindow(GetDlgItem(WindowHandle, IDC_SIZE_), SW_HIDE);
- PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(WindowHandle);
+ }
+ break;
+ case WM_THEMECHANGED:
+ {
+ ShowWindow(GetDlgItem(WindowHandle, IDC_SIZE_), PhEnableThemeSupport ? SW_HIDE : SW_SHOW);
}
break;
case WM_DESTROY:
@@ -541,7 +544,7 @@ INT_PTR CALLBACK PhChooseNewPageDlgProc(
if (PhEnableThemeSupport)
{
- SetDCBrushColor(hdc, RGB(50, 50, 50));
+ SetDCBrushColor(hdc, PhMakeColorBrighter(PhThemeWindowBackgroundColor, 7)); // RGB(50, 50, 50)
FillRect(hdc, &clientRect, PhGetStockBrush(DC_BRUSH));
clientRect.bottom = clientRect.top + 1;
SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
diff --git a/SystemInformer/chproc.c b/SystemInformer/chproc.c
index d3966962a909..6bb6cf858362 100644
--- a/SystemInformer/chproc.c
+++ b/SystemInformer/chproc.c
@@ -262,7 +262,7 @@ INT_PTR CALLBACK PhpChooseProcessDlgProc(
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/colsetmgr.c b/SystemInformer/colsetmgr.c
index 86643254a1ba..ac1ce28c77db 100644
--- a/SystemInformer/colsetmgr.c
+++ b/SystemInformer/colsetmgr.c
@@ -400,7 +400,7 @@ INT_PTR CALLBACK PhpColumnSetEditorDlgProc(
Button_Enable(context->MoveDownButtonHandle, FALSE);
Button_Enable(context->RemoveButtonHandle, FALSE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/delayload.c b/SystemInformer/delayload.c
deleted file mode 100644
index 5a53be117c79..000000000000
--- a/SystemInformer/delayload.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
- *
- * This file is part of System Informer.
- *
- * Authors:
- *
- * dmex 2021-2023
- *
- */
-
-#include
-#include
-
-// CRT delayload support
-// The msvc delayload handler throws exceptions when
-// imports are unavailable instead of returning NULL (dmex)
-
-#ifndef PH_NATIVE_DELAYLOAD
-PH_QUEUED_LOCK PhDelayLoadImportLock = PH_QUEUED_LOCK_INIT;
-ULONG PhDelayLoadOldProtection = PAGE_WRITECOPY;
-ULONG PhDelayLoadLockCount = 0;
-
-// based on \MSVC\14.31.31103\include\dloadsup.h (dmex)
-VOID PhDelayLoadImportAcquire(
- _In_ PVOID ImportDirectorySectionAddress,
- _In_ SIZE_T ImportDirectorySectionSize
- )
-{
- PhAcquireQueuedLockExclusive(&PhDelayLoadImportLock);
- PhDelayLoadLockCount += 1;
-
- if (PhDelayLoadLockCount == 1)
- {
- NTSTATUS status;
-
- if (!NT_SUCCESS(status = PhProtectVirtualMemory(
- NtCurrentProcess(),
- ImportDirectorySectionAddress,
- ImportDirectorySectionSize,
- PAGE_READWRITE,
- &PhDelayLoadOldProtection
- )))
- {
- PhRaiseStatus(status);
- }
- }
-
- PhReleaseQueuedLockExclusive(&PhDelayLoadImportLock);
-}
-
-VOID PhDelayLoadImportRelease(
- _In_ PVOID ImportDirectorySectionAddress,
- _In_ SIZE_T ImportDirectorySectionSize
- )
-{
- PhAcquireQueuedLockExclusive(&PhDelayLoadImportLock);
- PhDelayLoadLockCount -= 1;
-
- if (PhDelayLoadLockCount == 0)
- {
- ULONG importSectionOldProtection;
- PhProtectVirtualMemory(
- NtCurrentProcess(),
- ImportDirectorySectionAddress,
- ImportDirectorySectionSize,
- PhDelayLoadOldProtection,
- &importSectionOldProtection
- );
-
-#ifdef _M_ARM64
- NtFlushInstructionCache(
- NtCurrentProcess(),
- ImportDirectorySectionAddress,
- ImportDirectorySectionSize
- );
-#endif
- }
-
- PhReleaseQueuedLockExclusive(&PhDelayLoadImportLock);
-}
-#endif
-
-PVOID WINAPI __delayLoadHelper2(
- _In_ PIMAGE_DELAYLOAD_DESCRIPTOR DelayloadDescriptor,
- _In_ PIMAGE_THUNK_DATA ThunkAddress
- )
-{
-#if !defined(PH_NATIVE_DELAYLOAD)
- BOOLEAN importNeedsFree = FALSE;
- PCSTR importDllName;
- PVOID procedureAddress;
- PVOID moduleHandle;
- PVOID* importHandle;
- PIMAGE_THUNK_DATA importEntry;
- PIMAGE_THUNK_DATA importTable;
- PIMAGE_THUNK_DATA importNameTable;
- PIMAGE_NT_HEADERS imageNtHeaders;
- SIZE_T importDirectorySectionSize;
- PVOID importDirectorySectionAddress;
-
- importDllName = PTR_ADD_OFFSET(NtCurrentImageBase(), DelayloadDescriptor->DllNameRVA);
- importHandle = PTR_ADD_OFFSET(NtCurrentImageBase(), DelayloadDescriptor->ModuleHandleRVA);
- importTable = PTR_ADD_OFFSET(NtCurrentImageBase(), DelayloadDescriptor->ImportAddressTableRVA);
- importNameTable = PTR_ADD_OFFSET(NtCurrentImageBase(), DelayloadDescriptor->ImportNameTableRVA);
-
- if (!(moduleHandle = InterlockedCompareExchangePointer(importHandle, NULL, NULL)))
- {
- WCHAR importDllNameBuffer[DOS_MAX_PATH_LENGTH] = L"";
-
- PhZeroExtendToUtf16Buffer(importDllName, strlen(importDllName), importDllNameBuffer);
-
- if (!(moduleHandle = PhLoadLibrary(importDllNameBuffer)))
- {
- return NULL;
- }
-
- importNeedsFree = TRUE;
- }
-
- importEntry = PTR_ADD_OFFSET(importNameTable, PTR_SUB_OFFSET(ThunkAddress, importTable));
-
- if (IMAGE_SNAP_BY_ORDINAL(importEntry->u1.Ordinal))
- {
- USHORT procedureOrdinal = IMAGE_ORDINAL(importEntry->u1.Ordinal);
- procedureAddress = PhGetDllBaseProcedureAddress(moduleHandle, NULL, procedureOrdinal);
- }
- else
- {
- PIMAGE_IMPORT_BY_NAME importByName = PTR_ADD_OFFSET(NtCurrentImageBase(), importEntry->u1.AddressOfData);
- procedureAddress = PhGetDllBaseProcedureAddressWithHint(moduleHandle, importByName->Name, importByName->Hint);
- }
-
- if (!procedureAddress)
- return NULL;
-
- if (!NT_SUCCESS(PhGetLoaderEntryImageNtHeaders(
- NtCurrentImageBase(),
- &imageNtHeaders
- )))
- {
- return NULL;
- }
-
- if (!NT_SUCCESS(PhGetLoaderEntryImageVaToSection(
- NtCurrentImageBase(),
- imageNtHeaders,
- importTable,
- &importDirectorySectionAddress,
- &importDirectorySectionSize
- )))
- {
- return NULL;
- }
-
- PhDelayLoadImportAcquire(importDirectorySectionAddress, importDirectorySectionSize);
- InterlockedExchangePointer((PVOID)ThunkAddress, procedureAddress);
- PhDelayLoadImportRelease(importDirectorySectionAddress, importDirectorySectionSize);
-
- if ((InterlockedExchangePointer(importHandle, moduleHandle) == moduleHandle) && importNeedsFree)
- {
- PhFreeLibrary(moduleHandle); // already updated the cache (dmex)
- }
-
- return procedureAddress;
-#else
- static PH_INITONCE initOnce = PH_INITONCE_INIT;
- static PVOID (WINAPI* DelayLoadFailureHook)(
- _In_ PCSTR DllName,
- _In_ PCSTR ProcName
- ) = NULL;
-
- if (PhBeginInitOnce(&initOnce))
- {
- DelayLoadFailureHook = PhGetModuleProcAddress(L"kernel32.dll", "DelayLoadFailureHook"); // kernelbase.dll
- PhEndInitOnce(&initOnce);
- }
-
- return LdrResolveDelayLoadedAPI(
- NtCurrentImageBase(),
- DelayloadDescriptor,
- NULL,
- DelayLoadFailureHook,
- ThunkAddress,
- 0
- );
-#endif
-}
diff --git a/SystemInformer/findobj.c b/SystemInformer/findobj.c
index 835fdabad1f8..350170679cf1 100644
--- a/SystemInformer/findobj.c
+++ b/SystemInformer/findobj.c
@@ -1251,7 +1251,7 @@ INT_PTR CALLBACK PhFindObjectsDlgProc(
Edit_SetSel(context->SearchWindowHandle, 0, -1);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/gdihndl.c b/SystemInformer/gdihndl.c
index 8b399981d40a..e3ed59caf7f9 100644
--- a/SystemInformer/gdihndl.c
+++ b/SystemInformer/gdihndl.c
@@ -386,7 +386,7 @@ INT_PTR CALLBACK PhpGdiHandlesDlgProc(
PhpRefreshGdiHandles(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/heapinfo.c b/SystemInformer/heapinfo.c
index 611e39d8ed23..37d12c51240a 100644
--- a/SystemInformer/heapinfo.c
+++ b/SystemInformer/heapinfo.c
@@ -740,7 +740,7 @@ INT_PTR CALLBACK PhpProcessHeapsDlgProc(
else
PhCenterWindow(hwndDlg, context->ParentWindowHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -1550,7 +1550,7 @@ INT_PTR CALLBACK PhProcessLocksDlgProc(
else
PhCenterWindow(WindowHandle, context->ParentWindowHandle);
- PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(WindowHandle);
ShowWindow(GetDlgItem(WindowHandle, IDC_SIZESINBYTES), SW_HIDE);
}
diff --git a/SystemInformer/hidnproc.c b/SystemInformer/hidnproc.c
index 6003482a8aa2..05f33e77e7e1 100644
--- a/SystemInformer/hidnproc.c
+++ b/SystemInformer/hidnproc.c
@@ -228,7 +228,7 @@ INT_PTR CALLBACK PhpZombieProcessesDlgProc(
EnableWindow(GetDlgItem(hwndDlg, IDC_TERMINATE), FALSE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/hndlprp.c b/SystemInformer/hndlprp.c
index 0cb1122549fd..46dac327dc46 100644
--- a/SystemInformer/hndlprp.c
+++ b/SystemInformer/hndlprp.c
@@ -5,12 +5,14 @@
*
* Authors:
*
- * wj32 2010-2013
- * dmex 2018-2024
+ * wj32 2010-2013
+ * dmex 2018-2024
+ * Dart Vanya 2024
*
*/
#include
+#include
#include
#include
#include
@@ -23,92 +25,7 @@
#include
#include
-typedef enum _PHP_HANDLE_GENERAL_CATEGORY
-{
- // common
- PH_HANDLE_GENERAL_CATEGORY_BASICINFO,
- PH_HANDLE_GENERAL_CATEGORY_REFERENCES,
- PH_HANDLE_GENERAL_CATEGORY_QUOTA,
- // extra
- PH_HANDLE_GENERAL_CATEGORY_ALPC,
- PH_HANDLE_GENERAL_CATEGORY_FILE,
- PH_HANDLE_GENERAL_CATEGORY_SECTION,
- PH_HANDLE_GENERAL_CATEGORY_MUTANT,
- PH_HANDLE_GENERAL_CATEGORY_PROCESSTHREAD,
- PH_HANDLE_GENERAL_CATEGORY_ETW,
- PH_HANDLE_GENERAL_CATEGORY_SYMBOLICLINK,
-
- PH_HANDLE_GENERAL_CATEGORY_MAXIMUM
-} PHP_HANDLE_GENERAL_CATEGORY;
-
-typedef enum _PHP_HANDLE_GENERAL_INDEX
-{
- PH_HANDLE_GENERAL_INDEX_NAME,
- PH_HANDLE_GENERAL_INDEX_TYPE,
- PH_HANDLE_GENERAL_INDEX_OBJECT,
- PH_HANDLE_GENERAL_INDEX_ACCESSMASK,
-
- PH_HANDLE_GENERAL_INDEX_REFERENCES,
- PH_HANDLE_GENERAL_INDEX_HANDLES,
-
- PH_HANDLE_GENERAL_INDEX_PAGED,
- PH_HANDLE_GENERAL_INDEX_NONPAGED,
-
- PH_HANDLE_GENERAL_INDEX_FLAGS,
- PH_HANDLE_GENERAL_INDEX_SEQUENCENUMBER,
- PH_HANDLE_GENERAL_INDEX_PORTCONTEXT,
-
- PH_HANDLE_GENERAL_INDEX_FILETYPE,
- PH_HANDLE_GENERAL_INDEX_FILEMODE,
- PH_HANDLE_GENERAL_INDEX_FILEPOSITION,
- PH_HANDLE_GENERAL_INDEX_FILESIZE,
- PH_HANDLE_GENERAL_INDEX_FILEPRIORITY,
- PH_HANDLE_GENERAL_INDEX_FILEDRIVER,
- PH_HANDLE_GENERAL_INDEX_FILEDRIVERIMAGE,
-
- PH_HANDLE_GENERAL_INDEX_SECTIONTYPE,
- PH_HANDLE_GENERAL_INDEX_SECTIONFILE,
- PH_HANDLE_GENERAL_INDEX_SECTIONSIZE,
-
- PH_HANDLE_GENERAL_INDEX_MUTANTCOUNT,
- PH_HANDLE_GENERAL_INDEX_MUTANTABANDONED,
- PH_HANDLE_GENERAL_INDEX_MUTANTOWNER,
-
- PH_HANDLE_GENERAL_INDEX_ALPCCONNECTION,
- PH_HANDLE_GENERAL_INDEX_ALPCSERVER,
- PH_HANDLE_GENERAL_INDEX_ALPCCLIENT,
- PH_HANDLE_GENERAL_INDEX_ALPCOWNER,
-
- PH_HANDLE_GENERAL_INDEX_PROCESSTHREADNAME,
- PH_HANDLE_GENERAL_INDEX_PROCESSTHREADCREATETIME,
- PH_HANDLE_GENERAL_INDEX_PROCESSTHREADEXITTIME,
- PH_HANDLE_GENERAL_INDEX_PROCESSTHREADEXITCODE,
-
- PH_HANDLE_GENERAL_INDEX_ETWORIGINALNAME,
- PH_HANDLE_GENERAL_INDEX_ETWGROUPNAME,
-
- PH_HANDLE_GENERAL_INDEX_SYMBOLICLINKLINK,
-
- PH_HANDLE_GENERAL_INDEX_MAXIMUM
-} PHP_HANDLE_GENERAL_INDEX;
-
-typedef struct _HANDLE_PROPERTIES_CONTEXT
-{
- HWND ListViewHandle;
- HWND ParentWindow;
- HANDLE ProcessId;
- IListView* ListViewClass;
- PPH_HANDLE_ITEM HandleItem;
- PH_LAYOUT_MANAGER LayoutManager;
- INT ListViewRowCache[PH_HANDLE_GENERAL_INDEX_MAXIMUM];
- PPH_PLUGIN OwnerPlugin;
-} HANDLE_PROPERTIES_CONTEXT, *PHANDLE_PROPERTIES_CONTEXT;
-
-#define PH_FILEMODE_ASYNC 0x01000000
-#define PhFileModeUpdAsyncFlag(mode) \
- ((mode) & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT) ? (mode) &~ PH_FILEMODE_ASYNC: (mode) | PH_FILEMODE_ASYNC)
-
-CONST PH_ACCESS_ENTRY FileModeAccessEntries[] =
+CONST PH_ACCESS_ENTRY FileModeAccessEntries[6] =
{
{ L"FILE_FLAG_OVERLAPPED", PH_FILEMODE_ASYNC, FALSE, FALSE, L"Asynchronous" },
{ L"FILE_FLAG_WRITE_THROUGH", FILE_WRITE_THROUGH, FALSE, FALSE, L"Write through" },
@@ -146,7 +63,7 @@ static NTSTATUS PhpDuplicateHandleFromProcess(
_In_ PVOID Context
)
{
- PHANDLE_PROPERTIES_CONTEXT context = Context;
+ PPH_HANDLE_PROPERTIES_CONTEXT context = Context;
NTSTATUS status;
HANDLE processHandle;
@@ -241,10 +158,10 @@ NTSTATUS PhpShowHandlePropertiesThread(
PROPSHEETHEADER propSheetHeader = { sizeof(PROPSHEETHEADER) };
PROPSHEETPAGE propSheetPage;
HPROPSHEETPAGE pages[16];
- HANDLE_PROPERTIES_CONTEXT context;
+ PH_HANDLE_PROPERTIES_CONTEXT context;
PH_AUTO_POOL autoPool;
- memset(&context, 0, sizeof(HANDLE_PROPERTIES_CONTEXT));
+ memset(&context, 0, sizeof(PH_HANDLE_PROPERTIES_CONTEXT));
context.ProcessId = handleContext->ProcessId;
context.HandleItem = handleContext->HandleItem;
context.OwnerPlugin = handleContext->OwnerPlugin;
@@ -258,7 +175,7 @@ NTSTATUS PhpShowHandlePropertiesThread(
PSH_NOCONTEXTHELP |
PSH_PROPTITLE;
propSheetHeader.hInstance = PhInstanceHandle;
- propSheetHeader.hwndParent = handleContext->ParentWindowHandle;
+ propSheetHeader.hwndParent = PhCsForceNoParent ? NULL : handleContext->ParentWindowHandle;
propSheetHeader.pszCaption = handleContext->Caption ? handleContext->Caption : L"Handle";
propSheetHeader.nPages = 0;
propSheetHeader.nStartPage = 0;
@@ -436,7 +353,7 @@ VOID PhAddHandleListViewItem(
}
VOID PhSetHandleListViewItem(
- _In_ PHANDLE_PROPERTIES_CONTEXT Context,
+ _In_ PPH_HANDLE_PROPERTIES_CONTEXT Context,
_In_ LONG Index,
_In_ LONG SubItemIndex,
_In_ PCWSTR Text
@@ -451,7 +368,7 @@ VOID PhSetHandleListViewItem(
}
VOID PhpUpdateHandleGeneralListViewGroups(
- _In_ PHANDLE_PROPERTIES_CONTEXT Context
+ _In_ PPH_HANDLE_PROPERTIES_CONTEXT Context
)
{
IListView_EnableGroupView(Context->ListViewClass, TRUE);
@@ -549,7 +466,7 @@ VOID PhpUpdateHandleGeneralListViewGroups(
}
VOID PhpUpdateHandleGeneral(
- _In_ PHANDLE_PROPERTIES_CONTEXT Context
+ _In_ PPH_HANDLE_PROPERTIES_CONTEXT Context
)
{
HANDLE processHandle;
@@ -1877,12 +1794,12 @@ INT_PTR CALLBACK PhpHandleGeneralDlgProc(
_In_ LPARAM lParam
)
{
- PHANDLE_PROPERTIES_CONTEXT context;
+ PPH_HANDLE_PROPERTIES_CONTEXT context;
if (uMsg == WM_INITDIALOG)
{
LPPROPSHEETPAGE propSheetPage = (LPPROPSHEETPAGE)lParam;
- context = (PHANDLE_PROPERTIES_CONTEXT)propSheetPage->lParam;
+ context = (PPH_HANDLE_PROPERTIES_CONTEXT)propSheetPage->lParam;
PhSetDialogContext(hwndDlg, context);
}
else
@@ -1899,6 +1816,7 @@ INT_PTR CALLBACK PhpHandleGeneralDlgProc(
{
PhSetApplicationWindowIcon(context->ParentWindow);
+ context->WindowHandle = hwndDlg;
context->ListViewHandle = GetDlgItem(hwndDlg, IDC_LIST);
context->ParentWindow = GetParent(hwndDlg);
context->ListViewClass = PhGetListViewInterface(context->ListViewHandle);
@@ -1929,16 +1847,10 @@ INT_PTR CALLBACK PhpHandleGeneralDlgProc(
if (PhPluginsEnabled)
{
- PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT Context;
- Context = (PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT)context;
-
- PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackHandlePropertiesWindowInitialized), Context);
+ PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackHandlePropertiesWindowInitialized), context);
}
- if (PhEnableThemeSupport) // TODO: Required for compat (dmex)
- PhInitializeWindowTheme(context->ParentWindow, PhEnableThemeSupport);
- else
- PhInitializeWindowTheme(hwndDlg, FALSE);
+ PhInitializeWindowTheme(context->ParentWindow);
}
break;
case WM_DESTROY:
@@ -1947,7 +1859,15 @@ INT_PTR CALLBACK PhpHandleGeneralDlgProc(
PhUnregisterWindowCallback(context->ParentWindow);
- PhSaveWindowPlacementToSetting(L"HandlePropertiesWindowPosition", NULL, context->ParentWindow);
+ if (!PhPluginsEnabled || !context->OwnerPlugin)
+ {
+ PhSaveWindowPlacementToSetting(L"HandlePropertiesWindowPosition", NULL, context->ParentWindow); // HACK
+ }
+ // Plugins perform uninitializing in GeneralCallbackHandlePropertiesWindowUninitializing, ex. Object Manager (Dart Vanya)
+ else if (PhPluginsEnabled)
+ {
+ PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackHandlePropertiesWindowUninitializing), context);
+ }
PhDeleteLayoutManager(&context->LayoutManager);
diff --git a/SystemInformer/hndlstat.c b/SystemInformer/hndlstat.c
index e3221178f5fd..f6dec95fc031 100644
--- a/SystemInformer/hndlstat.c
+++ b/SystemInformer/hndlstat.c
@@ -237,7 +237,7 @@ INT_PTR CALLBACK PhpHandleStatisticsDlgProc(
ExtendedListView_SortItems(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/include/hndlprp.h b/SystemInformer/include/hndlprp.h
new file mode 100644
index 000000000000..a5cb8e2ed6ab
--- /dev/null
+++ b/SystemInformer/include/hndlprp.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
+ *
+ * This file is part of System Informer.
+ *
+ * Authors:
+ *
+ * wj32 2010-2013
+ * dmex 2018-2024
+ * Dart Vanya 2024
+ *
+ */
+
+#ifndef PH_NNDLPRP_H
+#define PH_NNDLPRP_H
+
+#include
+
+#define PH_FILEMODE_ASYNC 0x01000000
+#define PhFileModeUpdAsyncFlag(mode) \
+ ((mode) & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT) ? (mode) &~ PH_FILEMODE_ASYNC: (mode) | PH_FILEMODE_ASYNC)
+
+ // begin_phapppub
+typedef enum _PHP_HANDLE_GENERAL_CATEGORY
+{
+ // common
+ PH_HANDLE_GENERAL_CATEGORY_BASICINFO,
+ PH_HANDLE_GENERAL_CATEGORY_REFERENCES,
+ PH_HANDLE_GENERAL_CATEGORY_QUOTA,
+ // extra
+ PH_HANDLE_GENERAL_CATEGORY_ALPC,
+ PH_HANDLE_GENERAL_CATEGORY_FILE,
+ PH_HANDLE_GENERAL_CATEGORY_SECTION,
+ PH_HANDLE_GENERAL_CATEGORY_MUTANT,
+ PH_HANDLE_GENERAL_CATEGORY_PROCESSTHREAD,
+ PH_HANDLE_GENERAL_CATEGORY_ETW,
+ PH_HANDLE_GENERAL_CATEGORY_SYMBOLICLINK,
+
+ PH_HANDLE_GENERAL_CATEGORY_MAXIMUM
+} PHP_HANDLE_GENERAL_CATEGORY;
+
+typedef enum _PHP_HANDLE_GENERAL_INDEX
+{
+ PH_HANDLE_GENERAL_INDEX_NAME,
+ PH_HANDLE_GENERAL_INDEX_TYPE,
+ PH_HANDLE_GENERAL_INDEX_OBJECT,
+ PH_HANDLE_GENERAL_INDEX_ACCESSMASK,
+
+ PH_HANDLE_GENERAL_INDEX_REFERENCES,
+ PH_HANDLE_GENERAL_INDEX_HANDLES,
+
+ PH_HANDLE_GENERAL_INDEX_PAGED,
+ PH_HANDLE_GENERAL_INDEX_NONPAGED,
+
+ PH_HANDLE_GENERAL_INDEX_FLAGS,
+ PH_HANDLE_GENERAL_INDEX_SEQUENCENUMBER,
+ PH_HANDLE_GENERAL_INDEX_PORTCONTEXT,
+
+ PH_HANDLE_GENERAL_INDEX_FILETYPE,
+ PH_HANDLE_GENERAL_INDEX_FILEMODE,
+ PH_HANDLE_GENERAL_INDEX_FILEPOSITION,
+ PH_HANDLE_GENERAL_INDEX_FILESIZE,
+ PH_HANDLE_GENERAL_INDEX_FILEPRIORITY,
+ PH_HANDLE_GENERAL_INDEX_FILEDRIVER,
+ PH_HANDLE_GENERAL_INDEX_FILEDRIVERIMAGE,
+
+ PH_HANDLE_GENERAL_INDEX_SECTIONTYPE,
+ PH_HANDLE_GENERAL_INDEX_SECTIONFILE,
+ PH_HANDLE_GENERAL_INDEX_SECTIONSIZE,
+
+ PH_HANDLE_GENERAL_INDEX_MUTANTCOUNT,
+ PH_HANDLE_GENERAL_INDEX_MUTANTABANDONED,
+ PH_HANDLE_GENERAL_INDEX_MUTANTOWNER,
+
+ PH_HANDLE_GENERAL_INDEX_ALPCCONNECTION,
+ PH_HANDLE_GENERAL_INDEX_ALPCSERVER,
+ PH_HANDLE_GENERAL_INDEX_ALPCCLIENT,
+ PH_HANDLE_GENERAL_INDEX_ALPCOWNER,
+
+ PH_HANDLE_GENERAL_INDEX_PROCESSTHREADNAME,
+ PH_HANDLE_GENERAL_INDEX_PROCESSTHREADCREATETIME,
+ PH_HANDLE_GENERAL_INDEX_PROCESSTHREADEXITTIME,
+ PH_HANDLE_GENERAL_INDEX_PROCESSTHREADEXITCODE,
+
+ PH_HANDLE_GENERAL_INDEX_ETWORIGINALNAME,
+ PH_HANDLE_GENERAL_INDEX_ETWGROUPNAME,
+
+ PH_HANDLE_GENERAL_INDEX_SYMBOLICLINKLINK,
+
+ PH_HANDLE_GENERAL_INDEX_MAXIMUM
+} PHP_HANDLE_GENERAL_INDEX;
+
+typedef struct _PH_HANDLE_PROPERTIES_CONTEXT
+{
+ HWND WindowHandle;
+ HWND ListViewHandle;
+ HWND ParentWindow;
+ HANDLE ProcessId;
+ IListView* ListViewClass;
+ PPH_HANDLE_ITEM HandleItem;
+ PH_LAYOUT_MANAGER LayoutManager;
+ INT ListViewRowCache[PH_HANDLE_GENERAL_INDEX_MAXIMUM];
+ PPH_PLUGIN OwnerPlugin;
+} PH_HANDLE_PROPERTIES_CONTEXT, *PPH_HANDLE_PROPERTIES_CONTEXT;
+
+PHAPPAPI
+VOID
+NTAPI
+PhShowHandlePropertiesEx(
+ _In_ HWND ParentWindowHandle,
+ _In_ HANDLE ProcessId,
+ _In_ PPH_HANDLE_ITEM HandleItem,
+ _In_opt_ PPH_PLUGIN OwnerPlugin,
+ _In_opt_ PWSTR Caption
+ );
+// end_phapppub
+
+INT_PTR CALLBACK PhpHandleGeneralDlgProc(
+ _In_ HWND hwndDlg,
+ _In_ UINT uMsg,
+ _In_ WPARAM wParam,
+ _In_ LPARAM lParam
+ );
+
+#endif
diff --git a/SystemInformer/include/phplug.h b/SystemInformer/include/phplug.h
index 97e6aa31d1f6..556bdff2564b 100644
--- a/SystemInformer/include/phplug.h
+++ b/SystemInformer/include/phplug.h
@@ -57,8 +57,8 @@ typedef enum _PH_GENERAL_CALLBACK
GeneralCallbackMiniInformationInitializing = 32, // PPH_PLUGIN_MINIINFO_POINTERS Data [main thread]
GeneralCallbackMiListSectionMenuInitializing = 33, // PPH_PLUGIN_MENU_INFORMATION Data [main thread]
GeneralCallbackOptionsWindowInitializing = 34, // PH_PLUGIN_OPTIONS_POINTERS Data [main thread]
- GeneralCallbackHandlePropertiesWindowInitialized = 35, // PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT Data [properties thread]
- GeneralCallbackHandlePropertiesWindowUninitializing = 36, // PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT Data [properties thread]
+ GeneralCallbackHandlePropertiesWindowInitialized = 35, // PPH_HANDLE_PROPERTIES_CONTEXT Data [properties thread]
+ GeneralCallbackHandlePropertiesWindowUninitializing = 36, // PPH_HANDLE_PROPERTIES_CONTEXT Data [properties thread]
GeneralCallbackProcessProviderAddedEvent, // [process provider thread]
GeneralCallbackProcessProviderModifiedEvent, // [process provider thread]
@@ -108,6 +108,9 @@ typedef struct _PH_PROCESS_PROVIDER_UPDATED_EVENT
ULONG RunCount;
} PH_PROCESS_PROVIDER_UPDATED_EVENT, *PPH_PROCESS_PROVIDER_UPDATED_EVENT;
+#define PH_PROCESS_PROVIDER_UPDATED_EVENT_PTR(RunCount) \
+ &(PH_PROCESS_PROVIDER_UPDATED_EVENT){ (RunCount) }
+
// Plugin events
typedef struct _PH_PLUGIN_GET_HIGHLIGHTING_COLOR
@@ -154,7 +157,7 @@ typedef struct _PH_PLUGIN_OBJECT_PROPERTIES
{
// Parameter is:
// PPH_SERVICE_ITEM for GeneralCallbackServicePropertiesInitializing
- // PPH_PLUGIN_HANDLE_PROPERTIES_CONTEXT for GeneralCallbackHandlePropertiesInitializing
+ // PPH_HANDLE_PROPERTIES_CONTEXT for GeneralCallbackHandlePropertiesInitializing
PVOID Parameter;
ULONG NumberOfPages;
@@ -166,89 +169,17 @@ typedef struct _PH_PLUGIN_IS_DANGEROUS_PROCESS
{
HANDLE ProcessId;
BOOLEAN DangerousProcess;
-} PH_PLUGIN_IS_DANGEROUS_PROCESS, *PPH_PLUGIN_IS_DANGEROUS_PROCESS;
-
-typedef enum _PH_PLUGIN_HANDLE_GENERAL_CATEGORY
-{
- // common
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_BASICINFO,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_REFERENCES,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_QUOTA,
- // extra
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_ALPC,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_FILE,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_SECTION,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_MUTANT,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_PROCESSTHREAD,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_ETW,
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_SYMBOLICLINK,
-
- PH_PLUGIN_HANDLE_GENERAL_CATEGORY_MAXIMUM
-} PH_PLUGIN_HANDLE_GENERAL_CATEGORY;
-
-typedef enum _PH_PLUGIN_HANDLE_GENERAL_INDEX
-{
- PH_PLUGIN_HANDLE_GENERAL_INDEX_NAME,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_TYPE,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_OBJECT,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_ACCESSMASK,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_REFERENCES,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_HANDLES,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_PAGED,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_NONPAGED,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FLAGS,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_SEQUENCENUMBER,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_PORTCONTEXT,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILETYPE,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILEMODE,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILEPOSITION,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILESIZE,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILEPRIORITY,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILEDRIVER,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_FILEDRIVERIMAGE,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_SECTIONTYPE,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_SECTIONFILE,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_SECTIONSIZE,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_MUTANTCOUNT,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_MUTANTABANDONED,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_MUTANTOWNER,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_ALPCCONNECTION,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_ALPCSERVER,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_ALPCCLIENT,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_PROCESSTHREADNAME,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_PROCESSTHREADCREATETIME,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_PROCESSTHREADEXITTIME,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_PROCESSTHREADEXITCODE,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_ETWORIGINALNAME,
- PH_PLUGIN_HANDLE_GENERAL_INDEX_ETWGROUPNAME,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_SYMBOLICLINKLINK,
-
- PH_PLUGIN_HANDLE_GENERAL_INDEX_MAXIMUM
-} PH_PLUGIN_HANDLE_GENERAL_INDEX;
+} PH_PLUGIN_IS_DANGEROUS_PROCESS, * PPH_PLUGIN_IS_DANGEROUS_PROCESS;
typedef struct _PH_PLUGIN PH_PLUGIN, *PPH_PLUGIN;
-typedef struct _PH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT
+typedef struct _PH_PLUGIN_HANDLE_PROPERTIES_CONTEXT
{
- HWND ListViewHandle;
- HWND ParentWindow;
+ HWND ParentWindowHandle;
HANDLE ProcessId;
- PVOID ListViewClass;
PPH_HANDLE_ITEM HandleItem;
- PH_LAYOUT_MANAGER LayoutManager;
- INT ListViewRowCache[PH_PLUGIN_HANDLE_GENERAL_INDEX_MAXIMUM];
PPH_PLUGIN OwnerPlugin;
-} PH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT, *PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT;
+} PH_PLUGIN_HANDLE_PROPERTIES_CONTEXT, * PPH_PLUGIN_HANDLE_PROPERTIES_CONTEXT;
typedef struct _PH_PLUGIN_PROCESS_STATS_EVENT
{
@@ -258,14 +189,6 @@ typedef struct _PH_PLUGIN_PROCESS_STATS_EVENT
PVOID Parameter;
} PH_PLUGIN_PROCESS_STATS_EVENT, *PPH_PLUGIN_PROCESS_STATS_EVENT;
-typedef struct _PH_PLUGIN_HANDLE_PROPERTIES_CONTEXT
-{
- HWND ParentWindowHandle;
- HANDLE ProcessId;
- PPH_HANDLE_ITEM HandleItem;
- PPH_PLUGIN OwnerPlugin;
-} PH_PLUGIN_HANDLE_PROPERTIES_CONTEXT, *PPH_PLUGIN_HANDLE_PROPERTIES_CONTEXT;
-
typedef struct _PH_EMENU_ITEM *PPH_EMENU_ITEM, *PPH_EMENU;
#define PH_PLUGIN_MENU_DISALLOW_HOOKS 0x1
@@ -954,17 +877,6 @@ PhEnumeratePlugins(
_In_ PPH_PLUGIN_ENUMERATE Callback,
_In_opt_ PVOID Context
);
-
-PHAPPAPI
-VOID
-NTAPI
-PhShowHandlePropertiesEx(
- _In_ HWND ParentWindowHandle,
- _In_ HANDLE ProcessId,
- _In_ PPH_HANDLE_ITEM HandleItem,
- _In_opt_ PPH_PLUGIN OwnerPlugin,
- _In_opt_ PWSTR Caption
- );
// end_phapppub
#endif
diff --git a/SystemInformer/infodlg.c b/SystemInformer/infodlg.c
index fc8c46885524..0a86b83c6b7e 100644
--- a/SystemInformer/infodlg.c
+++ b/SystemInformer/infodlg.c
@@ -79,7 +79,7 @@ static INT_PTR CALLBACK PhpInformationDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/jobprp.c b/SystemInformer/jobprp.c
index 85f2463fadb9..574189edd3fb 100644
--- a/SystemInformer/jobprp.c
+++ b/SystemInformer/jobprp.c
@@ -394,7 +394,7 @@ INT_PTR CALLBACK PhpJobPageProc(
NtClose(jobHandle);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -751,7 +751,7 @@ INT_PTR CALLBACK PhpJobStatisticsPageProc(
&jobPageContext->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -778,9 +778,9 @@ LONG CALLBACK PhpJobStatisticsSheetProc(
_In_ LPARAM lParam
)
{
- if (uMsg == PSCB_INITIALIZED && PhEnableThemeSupport)
+ if (uMsg == PSCB_INITIALIZED)
{
- PhInitializeWindowTheme(hwndDlg, TRUE);
+ PhInitializeWindowTheme(hwndDlg);
}
return 0;
}
diff --git a/SystemInformer/kdump.c b/SystemInformer/kdump.c
index f1fae2658cec..17845b16ceb3 100644
--- a/SystemInformer/kdump.c
+++ b/SystemInformer/kdump.c
@@ -372,7 +372,7 @@ INT_PTR CALLBACK PhpLiveDumpDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
diff --git a/SystemInformer/logwnd.c b/SystemInformer/logwnd.c
index cb9b065a91fc..a3fe36ea5971 100644
--- a/SystemInformer/logwnd.c
+++ b/SystemInformer/logwnd.c
@@ -201,7 +201,7 @@ INT_PTR CALLBACK PhpLogDlgProc(
PhRegisterCallback(PhGetGeneralCallback(GeneralCallbackLoggedEvent), LoggedCallback, NULL, &LoggedRegistration);
PhpUpdateLogList();
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/main.c b/SystemInformer/main.c
index 6676db4879e1..31ae2a173be0 100644
--- a/SystemInformer/main.c
+++ b/SystemInformer/main.c
@@ -42,10 +42,6 @@ VOID PhInitializeCommonControls(
VOID
);
-VOID PhInitializeSuperclassControls( // delayhook.c
- VOID
- );
-
BOOLEAN PhInitializeAppSystem(
VOID
);
@@ -1215,7 +1211,7 @@ VOID PhpInitializeSettings(
for (ULONG i = 0; i < PhMaxPrecisionUnit; i++)
PhMaxPrecisionLimit /= 10;
PhEnableWindowText = !!PhGetIntegerSetting(L"EnableWindowText");
- PhEnableThemeSupport = !!PhGetIntegerSetting(L"EnableThemeSupport");
+ PhEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");
PhThemeWindowForegroundColor = PhGetIntegerSetting(L"ThemeWindowForegroundColor");
PhThemeWindowBackgroundColor = PhGetIntegerSetting(L"ThemeWindowBackgroundColor");
PhThemeWindowBackground2Color = PhGetIntegerSetting(L"ThemeWindowBackground2Color");
@@ -1224,7 +1220,9 @@ VOID PhpInitializeSettings(
PhThemeWindowTextColor = PhGetIntegerSetting(L"ThemeWindowTextColor");
PhEnableThemeAcrylicSupport = WindowsVersion >= WINDOWS_11 && !!PhGetIntegerSetting(L"EnableThemeAcrylicSupport");
PhEnableThemeAcrylicWindowSupport = WindowsVersion >= WINDOWS_11 && !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
+ PhEnableThemeAnimation = !!PhGetIntegerSetting(L"EnableThemeAnimation");
PhEnableThemeNativeButtons = !!PhGetIntegerSetting(L"EnableThemeNativeButtons");
+ PhEnableThemeTabBorders = !!PhGetIntegerSetting(L"EnableThemeTabBorders");
PhEnableThemeListviewBorder = !!PhGetIntegerSetting(L"TreeListBorderEnable");
PhEnableDeferredLayout = !!PhGetIntegerSetting(L"EnableDeferredLayout");
PhEnableServiceNonPoll = !!PhGetIntegerSetting(L"EnableServiceNonPoll");
@@ -1234,6 +1232,24 @@ VOID PhpInitializeSettings(
PhEnableKsiWarnings = !!PhGetIntegerSetting(L"KsiEnableWarnings");
PhFontQuality = PhGetFontQualitySetting(PhGetIntegerSetting(L"FontQuality"));
+ // If AppMode is set to PreferredAppModeDarkOnDark, PhShouldAppsUseDarkMode should return current Windows app color mode.
+ // It's weird that sometimes it can return incorrect inverted value (idk why).
+ // In this case use PhGetAppsUseLightTheme() to retrieve raw value from registry.
+ //
+ // When app mode set to always dark/light all subsequent calls to PhShouldAppsUseDarkMode always ignore
+ // the current Windows app color mode. Possible return values are:
+ //
+ // ---PreferredAppMode--- | ---PhShouldAppsUseDarkMode()---
+ // -------------------------------|----------------------------------
+ // PreferredAppModeDisabled | Windows app color mode ?
+ // PreferredAppModeDarkOnDark | Windows app color mode
+ // PreferredAppModeDarkAlways | always return TRUE
+ // PreferredAppModeLightAlways | always return FALSE
+
+ PH_THEME_SET_PREFFEREDAPPMODE(L"EnableThemeSupport", L"EnableThemeUseWindowsTheme");
+
+ PhEnableThemeSupport = PH_THEME_GET_GENERAL_SWITCH(L"EnableThemeSupport");
+
if (PhGetIntegerSetting(L"SampleCountAutomatic"))
{
ULONG sampleCount;
diff --git a/SystemInformer/mainwnd.c b/SystemInformer/mainwnd.c
index 348e534bd025..109498a36938 100644
--- a/SystemInformer/mainwnd.c
+++ b/SystemInformer/mainwnd.c
@@ -131,12 +131,12 @@ BOOLEAN PhMainWndInitialization(
// Initialize window settings.
PhMwpLoadSettings(PhMainWndHandle);
- // Initialize window theme.
- PhInitializeWindowTheme(PhMainWndHandle, PhEnableThemeSupport);
-
// Initialize window menu.
PhMwpInitializeMainMenu(PhMainWndHandle);
+ // Initialize window theme.
+ PhInitializeWindowTheme(PhMainWndHandle);
+
// Initialize providers.
PhMwpInitializeProviders();
@@ -636,6 +636,34 @@ VOID PhMwpOnEndSession(
PhExitApplication(STATUS_SUCCESS);
}
+static NTSTATUS PhMwpReInitializeThemeThread(
+ _In_ PVOID Context
+ )
+{
+ BOOLEAN currentTheme;
+
+ //currentTheme = PhShouldAppsUseDarkMode();
+ currentTheme = PhGetAppsUseLightTheme();
+
+ dprintf("PhMwpPhReInitializeThemeThread: currentTheme = %d, PhEnableThemeSupport = %d\r\n", currentTheme, PhEnableThemeSupport);
+
+ if (PhEnableThemeSupport != currentTheme)
+ {
+ PhEnableThemeSupport = currentTheme;
+
+ PhEnableThemeAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport && PhEnableThemeSupport && PhIsThemeTransparencyEnabled();
+
+ PhSetIntegerSetting(L"GraphColorMode", PhEnableThemeSupport); // HACK switch to dark theme. (dmex)
+ PhCsGraphColorMode = PhGetIntegerSetting(L"GraphColorMode");
+
+ PhReInitializeTheme(PhEnableThemeSupport);
+
+ PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackSettingsUpdated), NULL);
+ };
+
+ return STATUS_SUCCESS;
+}
+
VOID PhMwpOnSettingChange(
_In_ HWND WindowHandle,
_In_opt_ ULONG Action,
@@ -669,10 +697,11 @@ VOID PhMwpOnSettingChange(
// Reload dark theme metrics
- //if (PhEqualStringZ(Metric, L"ImmersiveColorSet", TRUE))
- //{
- // NOTHING;
- //}
+ // Implemented (Dart Vanya)
+ if (HANDLE_COLORSCHEMECHANGE_MESSAGE(Action, Metric, L"EnableThemeSupport", L"EnableThemeUseWindowsTheme"))
+ {
+ PhCreateThread2(PhMwpReInitializeThemeThread, NULL);
+ }
}
//if (Action == SPI_SETNONCLIENTMETRICS && Metric && PhEqualStringZ(Metric, L"WindowMetrics", TRUE))
@@ -3212,7 +3241,6 @@ VOID PhMwpInitializeMainMenu(
return;
PhEMenuToHMenu2(menuHandle, PhpCreateMainMenu(ULONG_MAX), 0, NULL);
- PhInitializeWindowThemeMainMenu(menuHandle);
PhSetHMenuNotify(menuHandle);
SetMenu(WindowHandle, menuHandle);
diff --git a/SystemInformer/mdump.c b/SystemInformer/mdump.c
index 3088acf7f5a8..9a504f3f46d7 100644
--- a/SystemInformer/mdump.c
+++ b/SystemInformer/mdump.c
@@ -887,7 +887,7 @@ INT_PTR CALLBACK PhpProcDumpDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
diff --git a/SystemInformer/memedit.c b/SystemInformer/memedit.c
index 12edb71a2db0..0518ce04353d 100644
--- a/SystemInformer/memedit.c
+++ b/SystemInformer/memedit.c
@@ -318,7 +318,7 @@ INT_PTR CALLBACK PhpMemoryEditorDlgProc(
}
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
context->LoadCompleted = TRUE;
}
diff --git a/SystemInformer/memlists.c b/SystemInformer/memlists.c
index 56149ae7956d..2b218b619a24 100644
--- a/SystemInformer/memlists.c
+++ b/SystemInformer/memlists.c
@@ -624,7 +624,7 @@ INT_PTR CALLBACK PhpMemoryListsDlgProc(
PhLoadWindowPlacementFromSetting(L"MemoryListsWindowPosition", NULL, hwndDlg);
PhRegisterDialog(hwndDlg);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/memmod.c b/SystemInformer/memmod.c
index 23f20486156c..583a56403299 100644
--- a/SystemInformer/memmod.c
+++ b/SystemInformer/memmod.c
@@ -587,7 +587,7 @@ INT_PTR CALLBACK PhPageModifiedDlgProc(
PhSetTimer(WindowHandle, PH_WINDOW_TIMER_DEFAULT, 1000, NULL);
- PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(WindowHandle);
{
NTSTATUS status;
diff --git a/SystemInformer/memprot.c b/SystemInformer/memprot.c
index 23dc48be769c..79f1bf93893f 100644
--- a/SystemInformer/memprot.c
+++ b/SystemInformer/memprot.c
@@ -80,7 +80,7 @@ INT_PTR CALLBACK PhpMemoryProtectDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDC_VALUE));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/memrslt.c b/SystemInformer/memrslt.c
index 4045278d50c6..5b0718ae7d51 100644
--- a/SystemInformer/memrslt.c
+++ b/SystemInformer/memrslt.c
@@ -314,7 +314,7 @@ INT_PTR CALLBACK PhpMemoryResultsDlgProc(
PhSetScalableIntegerPairSetting2(L"MemResultsSize", windowRectangle.Size, dpiValue);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/memsrch.c b/SystemInformer/memsrch.c
index 284dfedcdcff..0e7e79b885fd 100644
--- a/SystemInformer/memsrch.c
+++ b/SystemInformer/memsrch.c
@@ -425,7 +425,7 @@ INT_PTR CALLBACK PhpMemoryStringDlgProc(
Button_SetCheck(GetDlgItem(hwndDlg, IDC_DETECTUNICODE), BST_CHECKED);
Button_SetCheck(GetDlgItem(hwndDlg, IDC_PRIVATE), BST_CHECKED);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/memsrcht.c b/SystemInformer/memsrcht.c
index 06c32a27622f..e6dc1d6f91cc 100644
--- a/SystemInformer/memsrcht.c
+++ b/SystemInformer/memsrcht.c
@@ -958,7 +958,7 @@ INT_PTR CALLBACK PhpMemoryStringsMinimumLengthDlgProc(
PhSetDialogItemText(hwndDlg, IDC_MINIMUMLENGTH, lengthString);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -1165,7 +1165,7 @@ INT_PTR CALLBACK PhpMemoryStringsDlgProc(
PhpSearchMemoryStrings(context);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/miniinfo.c b/SystemInformer/miniinfo.c
index 3a0124d92fc1..62e7b4a0c6f3 100644
--- a/SystemInformer/miniinfo.c
+++ b/SystemInformer/miniinfo.c
@@ -162,7 +162,7 @@ VOID PhPinMiniInformation(
SetWindowPos(PhMipContainerWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
}
- PhInitializeWindowTheme(PhMipContainerWindow, PhEnableThemeSupport);
+ PhInitializeWindowTheme(PhMipContainerWindow);
ShowWindow(PhMipContainerWindow, (Flags & PH_MINIINFO_ACTIVATE_WINDOW) ? SW_SHOW : SW_SHOWNOACTIVATE);
}
@@ -888,7 +888,7 @@ VOID PhMipCreateSectionDialog(
createDialog.Parameter
);
- PhInitializeWindowTheme(Section->DialogHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(Section->DialogHandle);
}
}
}
diff --git a/SystemInformer/mtgndlg.c b/SystemInformer/mtgndlg.c
index 508daa123575..a78b2944ff00 100644
--- a/SystemInformer/mtgndlg.c
+++ b/SystemInformer/mtgndlg.c
@@ -262,7 +262,7 @@ INT_PTR CALLBACK PhpProcessMitigationPolicyDlgProc(
PhSetDialogFocus(hwndDlg, lvHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/ntobjprp.c b/SystemInformer/ntobjprp.c
index b0a43f6dbb64..9c8c8348eff7 100644
--- a/SystemInformer/ntobjprp.c
+++ b/SystemInformer/ntobjprp.c
@@ -215,7 +215,7 @@ INT_PTR CALLBACK PhpEventPageProc(
case WM_INITDIALOG:
{
PhpRefreshEventPageInfo(hwndDlg, pageContext);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
@@ -406,7 +406,7 @@ INT_PTR CALLBACK PhpSemaphorePageProc(
case WM_INITDIALOG:
{
PhpRefreshSemaphorePageInfo(hwndDlg, pageContext);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
@@ -519,7 +519,7 @@ INT_PTR CALLBACK PhpTimerPageProc(
case WM_INITDIALOG:
{
PhpRefreshTimerPageInfo(hwndDlg, pageContext);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
@@ -713,7 +713,7 @@ INT_PTR CALLBACK PhpMappingsPageProc(
PhpEnumerateMappingsEntries(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -2120,7 +2120,7 @@ INT_PTR CALLBACK PhpAfdSocketPageProc(
PhAddSocketListViewItem(context->ListViewClass, PH_AFD_SOCKET_GROUP_HVSOCKET, PH_AFD_SOCKET_ITEM_HVSOCKET_CONNECTED_SUSPEND, L"Connected suspend");
PhAddSocketListViewItem(context->ListViewClass, PH_AFD_SOCKET_GROUP_HVSOCKET, PH_AFD_SOCKET_ITEM_HVSOCKET_HIGH_VTL, L"High VTL");
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
PhInitializeLayoutManager(&context->LayoutManager, hwndDlg);
PhAddLayoutItem(&context->LayoutManager, context->ListViewHandle, NULL, PH_ANCHOR_ALL);
diff --git a/SystemInformer/options.c b/SystemInformer/options.c
index 8b900f9443a8..0e4801345783 100644
--- a/SystemInformer/options.c
+++ b/SystemInformer/options.c
@@ -320,8 +320,7 @@ INT_PTR CALLBACK PhOptionsDialogProc(
PhRegisterWindowCallback(hwndDlg, PH_PLUGIN_WINDOW_EVENT_TYPE_TOPMOST, NULL);
- if (PhEnableThemeSupport) // TODO: fix options dialog theme (dmex)
- PhInitializeWindowTheme(hwndDlg, TRUE);
+ PhInitializeWindowTheme(hwndDlg);
{
PPH_OPTIONS_SECTION section;
@@ -705,7 +704,7 @@ VOID PhOptionsCreateSectionDialog(
Section->Parameter
);
- PhInitializeWindowTheme(Section->DialogHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(Section->DialogHandle);
}
#define SetDlgItemCheckForSetting(hwndDlg, Id, Name) \
@@ -1410,6 +1409,7 @@ typedef enum _PHP_OPTIONS_INDEX
PHP_OPTIONS_INDEX_ENABLE_MEMSTRINGS_TREE,
PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT,
PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT,
+ PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME,
PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN,
PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE,
PHP_OPTIONS_INDEX_ENABLE_NETWORK_RESOLVE,
@@ -1458,7 +1458,8 @@ static VOID PhpAdvancedPageLoad(
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MINIINFO_WINDOW, L"Enable tray information window", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MEMSTRINGS_TREE, L"Enable new memory strings dialog", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT, L"Remember last selected window", NULL);
- PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"Enable theme support (experimental)", NULL);
+ PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"Enable theme support", NULL);
+ PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"Use Windows app color mode", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"Enable start as admin (experimental)", NULL);
PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"Enable streamer mode (disable window capture) (experimental)", NULL);
//PhAddListViewItem(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_LINUX_SUPPORT, L"Enable Windows subsystem for Linux support", NULL);
@@ -1490,6 +1491,7 @@ static VOID PhpAdvancedPageLoad(
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_GRAPH_SCALING, L"EnableGraphMaxScale");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_CYCLE_CPU_USAGE, L"EnableCycleCpuUsage");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
+ SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"EnableThemeUseWindowsTheme");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"EnableStartAsAdmin");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
SetLvItemCheckForSetting(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MONOSPACE, L"EnableMonospaceFont");
@@ -1521,7 +1523,53 @@ static VOID PhpOptionsNotifyChangeCallback(
PhReloadSettingsProcessTreeList();
PhSiNotifyChangeSettings();
- //PhReInitializeWindowTheme(PhMainWndHandle);
+ PhThemeWindowForegroundColor = PhGetIntegerSetting(L"ThemeWindowForegroundColor");
+ COLORREF oldPhThemeWindowBackgroundColor = PhThemeWindowBackgroundColor;
+ PhThemeWindowBackgroundColor = PhGetIntegerSetting(L"ThemeWindowBackgroundColor");
+ PhThemeWindowBackground2Color = PhGetIntegerSetting(L"ThemeWindowBackground2Color");
+ PhThemeWindowHighlightColor = PhGetIntegerSetting(L"ThemeWindowHighlightColor");
+ PhThemeWindowHighlight2Color = PhGetIntegerSetting(L"ThemeWindowHighlight2Color");
+ PhThemeWindowTextColor = PhGetIntegerSetting(L"ThemeWindowTextColor");
+ PhEnableThemeNativeButtons = !!PhGetIntegerSetting(L"EnableThemeNativeButtons");
+ PhEnableThemeTabBorders = !!PhGetIntegerSetting(L"EnableThemeTabBorders");
+ PhEnableThemeAcrylicSupport = WindowsVersion >= WINDOWS_11 && !!PhGetIntegerSetting(L"EnableThemeAcrylicSupport");
+ BOOLEAN oldAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport;
+ PhEnableThemeAcrylicWindowSupport = WindowsVersion >= WINDOWS_11 && !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
+ BOOLEAN oldStreamerMode = PhEnableStreamerMode;
+ PhEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");
+
+ PH_THEME_SET_PREFFEREDAPPMODE(L"EnableThemeSupport", L"EnableThemeUseWindowsTheme");
+
+ BOOLEAN oldTheme = PhEnableThemeSupport;
+ PhEnableThemeSupport = PH_THEME_GET_GENERAL_SWITCH(L"EnableThemeSupport");
+ PhEnableThemeAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport && PhEnableThemeSupport && PhIsThemeTransparencyEnabled();
+
+ if (oldPhThemeWindowBackgroundColor != PhThemeWindowBackgroundColor && PhThemeWindowBackgroundBrush)
+ {
+ DeleteBrush(PhThemeWindowBackgroundBrush);
+ PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
+
+ if (PhEnableThemeSupport) // replace old destroyed menu brush with the new one
+ {
+ PhInitializeWindowThemeMenu(PhMainWndHandle, TRUE);
+ }
+ }
+
+ if (PhEnableThemeSupport != oldTheme || PhEnableThemeAcrylicWindowSupport != oldAcrylicWindowSupport)
+ {
+ if (PhEnableThemeSupport != oldTheme)
+ {
+ PhSetIntegerSetting(L"GraphColorMode", PhEnableThemeSupport); // HACK switch to dark theme. (dmex)
+ PhCsGraphColorMode = PhGetIntegerSetting(L"GraphColorMode");
+ }
+
+ PhReInitializeTheme(PhEnableThemeSupport);
+ }
+
+ if (PhEnableStreamerMode != oldStreamerMode)
+ {
+ PhReInitializeStreamerMode(PhEnableStreamerMode);
+ }
PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackSettingsUpdated), NULL);
@@ -1679,9 +1727,10 @@ static VOID PhpAdvancedPageSave(
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_COLUMN_HEADER_TOTALS, L"TreeListEnableHeaderTotals");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_GRAPH_SCALING, L"EnableGraphMaxScale");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_CYCLE_CPU_USAGE, L"EnableCycleCpuUsage");
- SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
+ SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
+ SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"EnableThemeUseWindowsTheme");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"EnableStartAsAdmin");
- SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
+ SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_MONOSPACE, L"EnableMonospaceFont");
//SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_LINUX_SUPPORT, L"EnableLinuxSubsystemSupport");
SetSettingForLvItemCheckRestartRequired(listViewHandle, PHP_OPTIONS_INDEX_ENABLE_NETWORK_RESOLVE, L"EnableNetworkResolve");
@@ -1695,11 +1744,6 @@ static VOID PhpAdvancedPageSave(
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_PROPAGATE_CPU_USAGE, L"PropagateCpuUsage");
SetSettingForLvItemCheck(listViewHandle, PHP_OPTIONS_INDEX_SHOW_ADVANCED_OPTIONS, L"EnableAdvancedOptions");
- if (PhGetIntegerSetting(L"EnableThemeSupport")) // PhGetIntegerSetting required (dmex)
- {
- PhSetIntegerSetting(L"GraphColorMode", 1); // HACK switch to dark theme. (dmex)
- }
-
WriteCurrentUserRun(
ListView_GetCheckState(listViewHandle, PHP_OPTIONS_INDEX_START_ATLOGON) == BST_CHECKED,
ListView_GetCheckState(listViewHandle, PHP_OPTIONS_INDEX_START_HIDDEN) == BST_CHECKED
@@ -1744,7 +1788,7 @@ UINT_PTR CALLBACK PhpChooseFontDlgHookProc(
{
PhCenterWindow(hwndDlg, PhOptionsWindowHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_CTLCOLORBTN:
@@ -2234,7 +2278,7 @@ static INT_PTR CALLBACK PhpOptionsAdvancedEditDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDCANCEL));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -3347,7 +3391,7 @@ UINT_PTR CALLBACK PhpColorDlgHookProc(
{
PhCenterWindow(hwndDlg, PhOptionsWindowHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_CTLCOLORBTN:
diff --git a/SystemInformer/pagfiles.c b/SystemInformer/pagfiles.c
index c8a5e942b4a6..50a4d389f55f 100644
--- a/SystemInformer/pagfiles.c
+++ b/SystemInformer/pagfiles.c
@@ -240,7 +240,7 @@ INT_PTR CALLBACK PhpPagefilesDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/plugman.c b/SystemInformer/plugman.c
index bba8089a07ac..efc04acfcf2c 100644
--- a/SystemInformer/plugman.c
+++ b/SystemInformer/plugman.c
@@ -664,7 +664,7 @@ INT_PTR CALLBACK PhPluginsDlgProc(
TreeNew_AutoSizeColumn(context->TreeNewHandle, PH_PLUGIN_TREE_COLUMN_ITEM_NAME, TN_AUTOSIZE_REMAINING_SPACE);
PhSetWindowText(GetDlgItem(hwndDlg, IDC_DISABLED), PhaFormatString(L"Disabled Plugins (%lu)", PhpDisabledPluginsCount())->Buffer);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -964,7 +964,7 @@ INT_PTR CALLBACK PhpPluginPropertiesDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
@@ -1128,7 +1128,7 @@ INT_PTR CALLBACK PhpPluginsDisabledDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDOK));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
diff --git a/SystemInformer/procprp.c b/SystemInformer/procprp.c
index 471b9074c336..48bc9a46706a 100644
--- a/SystemInformer/procprp.c
+++ b/SystemInformer/procprp.c
@@ -162,8 +162,7 @@ INT CALLBACK PhpPropSheetProc(
PhSetWindowContext(hwndDlg, 0xF, propSheetContext);
PhSetWindowProcedure(hwndDlg, PhpPropSheetWndProc);
- if (PhEnableThemeSupport) // NOTE: Required for compatibility. (dmex)
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
PhRegisterWindowCallback(hwndDlg, PH_PLUGIN_WINDOW_EVENT_TYPE_TOPMOST, NULL);
diff --git a/SystemInformer/procrec.c b/SystemInformer/procrec.c
index 21b8f0583e67..c5f539e884fe 100644
--- a/SystemInformer/procrec.c
+++ b/SystemInformer/procrec.c
@@ -204,7 +204,7 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
PhSetDialogItemValue(hwndDlg, IDC_SESSIONID, context->Record->SessionId, FALSE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgenv.c b/SystemInformer/prpgenv.c
index 0d27e646d2ce..426e523b337a 100644
--- a/SystemInformer/prpgenv.c
+++ b/SystemInformer/prpgenv.c
@@ -717,7 +717,7 @@ INT_PTR CALLBACK PhpEditEnvDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDCANCEL));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -1605,7 +1605,7 @@ INT_PTR CALLBACK PhpProcessEnvironmentDlgProc(
PhApplyTreeNewFilters(&context->TreeFilterSupport);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpggen.c b/SystemInformer/prpggen.c
index aa8cd18c3ec3..a7d10bf36fba 100644
--- a/SystemInformer/prpggen.c
+++ b/SystemInformer/prpggen.c
@@ -556,7 +556,7 @@ INT_PTR CALLBACK PhpProcessGeneralDlgProc(
if (PhEnableThemeSupport)
{
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
PhSetTimer(hwndDlg, PH_WINDOW_TIMER_DEFAULT, 1000, NULL);
diff --git a/SystemInformer/prpghndl.c b/SystemInformer/prpghndl.c
index 0db244a00e75..76f1fe1010ff 100644
--- a/SystemInformer/prpghndl.c
+++ b/SystemInformer/prpghndl.c
@@ -508,7 +508,7 @@ INT_PTR CALLBACK PhpProcessHandlesDlgProc(
&handlesContext->ChangedEventRegistration
);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgmem.c b/SystemInformer/prpgmem.c
index bf42c98cfc00..c74fd256f261 100644
--- a/SystemInformer/prpgmem.c
+++ b/SystemInformer/prpgmem.c
@@ -600,7 +600,7 @@ INT_PTR CALLBACK PhpProcessMemoryDlgProc(
PhpRefreshProcessMemoryList(propPageContext);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgmod.c b/SystemInformer/prpgmod.c
index 986566cc1f43..209e2a83ba56 100644
--- a/SystemInformer/prpgmod.c
+++ b/SystemInformer/prpgmod.c
@@ -733,7 +733,7 @@ INT_PTR CALLBACK PhpProcessModulesDlgProc(
&modulesContext->ChangedEventRegistration
);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgperf.c b/SystemInformer/prpgperf.c
index 7f5d2ca72595..99b4b1ecd891 100644
--- a/SystemInformer/prpgperf.c
+++ b/SystemInformer/prpgperf.c
@@ -94,7 +94,7 @@ INT_PTR CALLBACK PhpProcessPerformanceDlgProc(
Graph_SetTooltip(performanceContext->IoGraphHandle, TRUE);
BringWindowToTop(performanceContext->IoGraphHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgsrv.c b/SystemInformer/prpgsrv.c
index 64a967ebfdd8..5f009698b19b 100644
--- a/SystemInformer/prpgsrv.c
+++ b/SystemInformer/prpgsrv.c
@@ -88,7 +88,7 @@ INT_PTR CALLBACK PhpProcessServicesDlgProc(
propPageContext->Context = serviceListHandle;
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_SHOWWINDOW:
diff --git a/SystemInformer/prpgstat.c b/SystemInformer/prpgstat.c
index f58737b619a0..8853b0c6982b 100644
--- a/SystemInformer/prpgstat.c
+++ b/SystemInformer/prpgstat.c
@@ -740,7 +740,7 @@ INT_PTR CALLBACK PhpProcessStatisticsDlgProc(
PhpUpdateProcessStatistics(processItem, statisticsContext);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgthrd.c b/SystemInformer/prpgthrd.c
index e3cffbf3af37..02fd8a5a93cc 100644
--- a/SystemInformer/prpgthrd.c
+++ b/SystemInformer/prpgthrd.c
@@ -1056,7 +1056,7 @@ INT_PTR CALLBACK PhpProcessThreadsDlgProc(
);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgvdm.c b/SystemInformer/prpgvdm.c
index ede79d0d2b62..8ad2f61d5db5 100644
--- a/SystemInformer/prpgvdm.c
+++ b/SystemInformer/prpgvdm.c
@@ -288,7 +288,7 @@ INT_PTR CALLBACK PhpProcessVdmHostProcessDlgProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/prpgwmi.c b/SystemInformer/prpgwmi.c
index 09670f15486b..36d2c8fba2a1 100644
--- a/SystemInformer/prpgwmi.c
+++ b/SystemInformer/prpgwmi.c
@@ -1807,7 +1807,7 @@ INT_PTR CALLBACK PhpProcessWmiProvidersDlgProc(
PhpRefreshWmiProvidersList(context, processItem);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/runas.c b/SystemInformer/runas.c
index 414292ef5c8a..1e26956febc1 100644
--- a/SystemInformer/runas.c
+++ b/SystemInformer/runas.c
@@ -1319,7 +1319,7 @@ INT_PTR CALLBACK PhpRunAsDlgProc(
//if (!PhGetOwnTokenAttributes().Elevated)
// Button_SetElevationRequiredState(GetDlgItem(hwndDlg, IDOK), TRUE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -2647,7 +2647,7 @@ INT_PTR CALLBACK PhpRunFileWndProc(
PhpRunFileSetImageList(context);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -3546,7 +3546,7 @@ INT_PTR CALLBACK PhRunAsPackageWndProc(
context
);
- PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(WindowHandle);
PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDCANCEL));
diff --git a/SystemInformer/searchbox.c b/SystemInformer/searchbox.c
index f971dc5b9d08..bd461285ff9f 100644
--- a/SystemInformer/searchbox.c
+++ b/SystemInformer/searchbox.c
@@ -25,10 +25,14 @@ VOID PhCreateSearchControl(
WindowHandle,
BannerText,
PhInstanceHandle,
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_DARK),
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_DARK),
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_DARK),
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_DARK),
L"SearchControlRegex",
L"SearchControlCaseSensitive",
Callback,
diff --git a/SystemInformer/sessmsg.c b/SystemInformer/sessmsg.c
index c0768c06df3d..c42e3542e874 100644
--- a/SystemInformer/sessmsg.c
+++ b/SystemInformer/sessmsg.c
@@ -83,7 +83,7 @@ INT_PTR CALLBACK PhpSessionSendMessageDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDC_TEXT));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport); // HACK (dmex)
+ PhInitializeWindowTheme(hwndDlg); // HACK (dmex)
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/sessprp.c b/SystemInformer/sessprp.c
index 8d0416af413f..8bb7d93c92a0 100644
--- a/SystemInformer/sessprp.c
+++ b/SystemInformer/sessprp.c
@@ -281,7 +281,7 @@ INT_PTR CALLBACK PhpSessionPropertiesDlgProc(
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport); // HACK
+ PhInitializeWindowTheme(hwndDlg); // HACK
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/sessshad.c b/SystemInformer/sessshad.c
index d95bc7d9c780..c7fe518a4070 100644
--- a/SystemInformer/sessshad.c
+++ b/SystemInformer/sessshad.c
@@ -158,7 +158,7 @@ INT_PTR CALLBACK PhpSessionShadowDlgProc(
Button_SetCheck(GetDlgItem(hwndDlg, IDC_CTRL), hotkey.Y & KBDCTRL);
Button_SetCheck(GetDlgItem(hwndDlg, IDC_ALT), hotkey.Y & KBDALT);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/settings.c b/SystemInformer/settings.c
index f7933d1ca6c5..97a107238fd7 100644
--- a/SystemInformer/settings.c
+++ b/SystemInformer/settings.c
@@ -71,11 +71,13 @@ VOID PhAddDefaultSettings(
PhpAddIntegerSetting(L"EnableShutdownCriticalMenu", L"0");
PhpAddIntegerSetting(L"EnableShutdownBootMenu", L"1");
PhpAddIntegerSetting(L"EnableSilentCrashNotify", L"0");
- PhpAddIntegerSetting(L"EnableThemeSupport", L"0");
+ PhpAddIntegerSetting(L"EnableThemeSupport", L"1");
+ PhpAddIntegerSetting(L"EnableThemeUseWindowsTheme", L"1");
PhpAddIntegerSetting(L"EnableThemeAcrylicSupport", L"0");
PhpAddIntegerSetting(L"EnableThemeAcrylicWindowSupport", L"0");
PhpAddIntegerSetting(L"EnableThemeAnimation", L"1");
PhpAddIntegerSetting(L"EnableThemeNativeButtons", L"0");
+ PhpAddIntegerSetting(L"EnableThemeTabBorders", L"0");
PhpAddIntegerSetting(L"EnableThreadStackInlineSymbols", L"1");
PhpAddIntegerSetting(L"EnableThreadStackLineInformation", L"1");
PhpAddIntegerSetting(L"EnableTokenRemovedPrivileges", L"0");
diff --git a/SystemInformer/srvcr.c b/SystemInformer/srvcr.c
index ed8d7f2576bd..aa719da8ce9b 100644
--- a/SystemInformer/srvcr.c
+++ b/SystemInformer/srvcr.c
@@ -66,7 +66,7 @@ INT_PTR CALLBACK PhpCreateServiceDlgProc(
}
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDC_NAME));
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
diff --git a/SystemInformer/srvctl.c b/SystemInformer/srvctl.c
index 0461857bc2aa..fea8efc9029b 100644
--- a/SystemInformer/srvctl.c
+++ b/SystemInformer/srvctl.c
@@ -269,7 +269,7 @@ INT_PTR CALLBACK PhpServicesPageProc(
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_START), NULL, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDC_PAUSE), NULL, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/srvprp.c b/SystemInformer/srvprp.c
index 77b965f09592..8369473d766b 100644
--- a/SystemInformer/srvprp.c
+++ b/SystemInformer/srvprp.c
@@ -457,10 +457,7 @@ INT_PTR CALLBACK PhpServiceGeneralDlgProc(
context->Ready = TRUE;
- if (PhEnableThemeSupport) // TODO: Required for compat (dmex)
- PhInitializeWindowTheme(GetParent(hwndDlg), PhEnableThemeSupport); // HACK (GetParent)
- else
- PhInitializeWindowTheme(hwndDlg, FALSE);
+ PhInitializeWindowTheme(GetParent(hwndDlg)); // HACK (GetParent)
}
break;
case WM_DESTROY:
diff --git a/SystemInformer/sysinfo.c b/SystemInformer/sysinfo.c
index 0e7d24abe7ed..9e053459612c 100644
--- a/SystemInformer/sysinfo.c
+++ b/SystemInformer/sysinfo.c
@@ -246,17 +246,20 @@ INT_PTR CALLBACK PhSipSysInfoDialogProc(
if (PhEnableThemeSupport)
{
- switch (PhCsGraphColorMode)
- {
- case 0: // New colors
- SetTextColor((HDC)wParam, RGB(0x0, 0x0, 0x0));
- SetDCBrushColor((HDC)wParam, RGB(0xef, 0xef, 0xef)); // GetSysColor(COLOR_WINDOW)
- break;
- case 1: // Old colors
- SetTextColor((HDC)wParam, RGB(0xff, 0xff, 0xff));
- SetDCBrushColor((HDC)wParam, PhThemeWindowBackgroundColor); // RGB(30, 30, 30));
- break;
- }
+ //switch (PhCsGraphColorMode)
+ //{
+ //case 0: // New colors
+ // SetTextColor((HDC)wParam, RGB(0x0, 0x0, 0x0));
+ // SetDCBrushColor((HDC)wParam, RGB(0xef, 0xef, 0xef)); // GetSysColor(COLOR_WINDOW)
+ // break;
+ //case 1: // Old colors
+ // SetTextColor((HDC)wParam, RGB(0xff, 0xff, 0xff));
+ // SetDCBrushColor((HDC)wParam, PhThemeWindowBackgroundColor); // RGB(30, 30, 30));
+ // break;
+ //}
+
+ SetTextColor((HDC)wParam, PhThemeWindowTextColor);
+ SetDCBrushColor((HDC)wParam, PhThemeWindowBackgroundColor); // RGB(30, 30, 30));
}
else
{
@@ -327,17 +330,20 @@ INT_PTR CALLBACK PhSipContainerDialogProc(
if (PhEnableThemeSupport)
{
- switch (PhCsGraphColorMode)
- {
- case 0: // New colors
- SetTextColor((HDC)wParam, RGB(0x0, 0x0, 0x0));
- SetDCBrushColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
- break;
- case 1: // Old colors
- SetTextColor((HDC)wParam, RGB(0xff, 0xff, 0xff));
- SetDCBrushColor((HDC)wParam, PhThemeWindowBackgroundColor);
- break;
- }
+ //switch (PhCsGraphColorMode)
+ //{
+ //case 0: // New colors
+ // SetTextColor((HDC)wParam, RGB(0x0, 0x0, 0x0));
+ // SetDCBrushColor((HDC)wParam, GetSysColor(COLOR_WINDOW));
+ // break;
+ //case 1: // Old colors
+ // SetTextColor((HDC)wParam, RGB(0xff, 0xff, 0xff));
+ // SetDCBrushColor((HDC)wParam, PhThemeWindowBackgroundColor);
+ // break;
+ //}
+
+ SetTextColor((HDC)wParam, PhThemeWindowTextColor);
+ SetDCBrushColor((HDC)wParam, PhThemeWindowBackgroundColor); // RGB(30, 30, 30));
}
else
{
@@ -486,7 +492,7 @@ VOID PhSipOnInitDialog(
PhRegisterWindowCallback(PhSipWindow, PH_PLUGIN_WINDOW_EVENT_TYPE_TOPMOST, NULL);
- //PhInitializeWindowTheme(PhSipWindow, PhEnableThemeSupport);
+ //PhInitializeWindowTheme(PhSipWindow);
PhInitializeThemeWindowFrame(PhSipWindow);
PhSipOnSize(PhSipWindow, 0, 0, 0);
@@ -1068,15 +1074,15 @@ VOID PhSiSetColorsGraphDrawInfo(
DrawInfo->TextBoxColor = RGB(0xe7, 0xe7, 0xe7);
break;
case 1: // Old colors
- DrawInfo->BackColor = RGB(0x00, 0x00, 0x00);
+ DrawInfo->BackColor = PhThemeWindowForegroundColor;
DrawInfo->LineColor1 = Color1;
DrawInfo->LineBackColor1 = PhHalveColorBrightness(Color1);
DrawInfo->LineColor2 = Color2;
DrawInfo->LineBackColor2 = PhHalveColorBrightness(Color2);
- DrawInfo->GridColor = RGB(0x00, 0x57, 0x00);
+ DrawInfo->GridColor = PhThemeWindowBackground2Color;
DrawInfo->LabelYColor = RGB(0xd0, 0xa0, 0x70);
- DrawInfo->TextColor = RGB(0x00, 0xff, 0x00);
- DrawInfo->TextBoxColor = RGB(0x00, 0x22, 0x00);
+ DrawInfo->TextColor = PhMakeColorDarker(PhThemeWindowTextColor, 7);
+ DrawInfo->TextBoxColor = PhThemeWindowBackgroundColor;
break;
}
}
@@ -1427,19 +1433,22 @@ VOID PhSipDrawRestoreSummaryPanel(
if (PhEnableThemeSupport)
{
- switch (PhCsGraphColorMode)
- {
- case 0: // New colors
- SetTextColor(bufferDc, RGB(0x00, 0x00, 0x00));
- SetDCBrushColor(bufferDc, RGB(0xff, 0xff, 0xff));
- FillRect(bufferDc, &bufferRect, PhGetStockBrush(DC_BRUSH));
- break;
- case 1: // Old colors
- SetTextColor(bufferDc, PhThemeWindowTextColor);
- SetDCBrushColor(bufferDc, PhThemeWindowBackgroundColor);
- FillRect(bufferDc, &bufferRect, PhGetStockBrush(DC_BRUSH));
- break;
- }
+ //switch (PhCsGraphColorMode)
+ //{
+ //case 0: // New colors
+ // SetTextColor(bufferDc, RGB(0x00, 0x00, 0x00));
+ // SetDCBrushColor(bufferDc, RGB(0xff, 0xff, 0xff));
+ // FillRect(bufferDc, &bufferRect, PhGetStockBrush(DC_BRUSH));
+ // break;
+ //case 1: // Old colors
+ // SetTextColor(bufferDc, PhThemeWindowTextColor);
+ // SetDCBrushColor(bufferDc, PhThemeWindowBackgroundColor);
+ // FillRect(bufferDc, &bufferRect, PhGetStockBrush(DC_BRUSH));
+ // break;
+ //}
+
+ SetTextColor(bufferDc, PhThemeWindowTextColor);
+ FillRect(bufferDc, &bufferRect, PhThemeWindowBackgroundBrush);
}
else
{
@@ -1526,8 +1535,7 @@ VOID PhSipDrawSeparator(
break;
case 1: // Old colors
{
- SetDCBrushColor(bufferDc, PhThemeWindowBackgroundColor);
- FillRect(bufferDc, &bufferRect, PhGetStockBrush(DC_BRUSH));
+ FillRect(bufferDc, &bufferRect, PhThemeWindowBackgroundBrush);
}
break;
}
@@ -1574,17 +1582,19 @@ VOID PhSipDrawPanel(
{
if (PhEnableThemeSupport)
{
- switch (PhCsGraphColorMode)
- {
- case 0: // New colors
- SetDCBrushColor(hdc, RGB(0xff, 0xff, 0xff));
- FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
- break;
- case 1: // Old colors
- SetDCBrushColor(hdc, PhThemeWindowBackgroundColor);
- FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
- break;
- }
+ //switch (PhCsGraphColorMode)
+ //{
+ //case 0: // New colors
+ // SetDCBrushColor(hdc, RGB(0xff, 0xff, 0xff));
+ // FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
+ // break;
+ //case 1: // Old colors
+ // SetDCBrushColor(hdc, PhThemeWindowBackgroundColor);
+ // FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
+ // break;
+ //}
+
+ FillRect(hdc, Rect, PhThemeWindowBackgroundBrush);
}
else
{
@@ -1733,20 +1743,21 @@ VOID PhSipDefaultDrawPanel(
if (PhEnableThemeSupport)
{
- switch (PhCsGraphColorMode)
- {
- case 0: // New colors
- SetTextColor(hdc, RGB(0x00, 0x00, 0x00));
- //SetDCBrushColor(hdc, RGB(0xff, 0xff, 0xff));
- //FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
- break;
- case 1: // Old colors
- SetTextColor(hdc, RGB(0xff, 0xff, 0xff));
- //SetDCBrushColor(hdc, RGB(0xff, 0xff, 0x00));
- //FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
- break;
- }
+ //switch (PhCsGraphColorMode)
+ //{
+ //case 0: // New colors
+ // SetTextColor(hdc, RGB(0x00, 0x00, 0x00));
+ // //SetDCBrushColor(hdc, RGB(0xff, 0xff, 0xff));
+ // //FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
+ // break;
+ //case 1: // Old colors
+ // SetTextColor(hdc, RGB(0xff, 0xff, 0xff));
+ // //SetDCBrushColor(hdc, RGB(0xff, 0xff, 0x00));
+ // //FillRect(hdc, Rect, PhGetStockBrush(DC_BRUSH));
+ // break;
+ //}
+ SetTextColor(hdc, PhThemeWindowTextColor);
//SetTextColor(hdc, CurrentParameters.PanelForeColor);
}
else
@@ -2136,10 +2147,7 @@ VOID PhSipCreateSectionDialog(
createDialog.Parameter
);
- if (PhEnableThemeSupport)
- {
- PhInitializeWindowTheme(Section->DialogHandle, PhEnableThemeSupport);
- }
+ PhInitializeWindowTheme(Section->DialogHandle);
}
}
}
diff --git a/SystemInformer/thrdstk.c b/SystemInformer/thrdstk.c
index 1931f489a021..8c0b48aabf28 100644
--- a/SystemInformer/thrdstk.c
+++ b/SystemInformer/thrdstk.c
@@ -1002,7 +1002,7 @@ INT_PTR CALLBACK PhpThreadStackDlgProc(
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
PhSetDialogFocus(hwndDlg, context->TreeNewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
if (PhPluginsEnabled)
{
diff --git a/SystemInformer/thrdstks.c b/SystemInformer/thrdstks.c
index 199ca22c038a..ec5f1cd632b0 100644
--- a/SystemInformer/thrdstks.c
+++ b/SystemInformer/thrdstks.c
@@ -1672,7 +1672,7 @@ INT_PTR CALLBACK PhpThreadStacksDlgProc(
PhSetTimer(hwndDlg, PH_WINDOW_TIMER_DEFAULT, 200, NULL);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
PhpThreadStacksRefresh(context);
diff --git a/SystemInformer/tokprp.c b/SystemInformer/tokprp.c
index e0d7191c4288..fcbcd81045c2 100644
--- a/SystemInformer/tokprp.c
+++ b/SystemInformer/tokprp.c
@@ -342,7 +342,7 @@ INT CALLBACK PhpTokenSheetProc(
{
case PSCB_INITIALIZED:
{
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
}
@@ -1436,7 +1436,7 @@ INT_PTR CALLBACK PhpTokenPageProc(
PhSetDialogFocus(hwndDlg, tokenPageContext->ListViewHandle);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -2578,10 +2578,7 @@ INT_PTR CALLBACK PhpTokenGeneralPageProc(
EnableWindow(GetDlgItem(hwndDlg, IDC_LINKEDTOKEN), !!hasLinkedToken);
- if (PhEnableThemeSupport) // TODO: Required for compat (dmex)
- PhInitializeWindowTheme(GetParent(hwndDlg), PhEnableThemeSupport); // HACK (GetParent)
- else
- PhInitializeWindowTheme(hwndDlg, FALSE);
+ PhInitializeWindowTheme(GetParent(hwndDlg)); // HACK (GetParent)
}
break;
case WM_COMMAND:
@@ -2851,7 +2848,7 @@ INT_PTR CALLBACK PhpTokenAdvancedPageProc(
PhClearReference(&tokenNamedObjectPathString);
PhClearReference(&tokenSecurityDescriptorString);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -3297,7 +3294,7 @@ INT_PTR CALLBACK PhpTokenCapabilitiesPageProc(
TreeNew_NodesStructured(tnHandle);
TreeNew_SetRedraw(tnHandle, TRUE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -3846,7 +3843,7 @@ INT_PTR CALLBACK PhpTokenClaimsPageProc(
TreeNew_NodesStructured(tnHandle);
TreeNew_SetRedraw(tnHandle, TRUE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -4006,7 +4003,7 @@ INT_PTR CALLBACK PhpTokenAttributesPageProc(
TreeNew_NodesStructured(tnHandle);
TreeNew_SetRedraw(tnHandle, TRUE);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -4548,7 +4545,7 @@ INT_PTR CALLBACK PhpTokenContainerPageProc(
tokenPageContext->CloseObject(tokenHandle, FALSE, tokenPageContext->Context);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -6076,7 +6073,7 @@ INT_PTR CALLBACK PhpTokenAppPolicyPageProc(
PhCreateThread2(PhGetAppModelPolicySymbolDownloadThread, hwndDlg);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/phlib/colorbox.c b/phlib/colorbox.c
index 93c638b259f9..9925c62cbe67 100644
--- a/phlib/colorbox.c
+++ b/phlib/colorbox.c
@@ -94,7 +94,8 @@ UINT_PTR CALLBACK PhpColorBoxDlgHookProc(
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
- PhInitializeWindowTheme(hwndDlg, !!context->EnableThemeSupport);
+ //if (context->EnableThemeSupport)
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_CTLCOLORBTN:
diff --git a/SystemInformer/delayhook.c b/phlib/delayhook.c
similarity index 65%
rename from SystemInformer/delayhook.c
rename to phlib/delayhook.c
index b033c2820b2b..879f98c6a88e 100644
--- a/SystemInformer/delayhook.c
+++ b/phlib/delayhook.c
@@ -5,11 +5,14 @@
*
* Authors:
*
- * dmex 2022-2023
+ * dmex 2022-2023
+ * Dart Vanya 2024
*
*/
-#include
+#include
+#include
+#include
#include
#include
#include
@@ -20,17 +23,14 @@
#include "settings.h"
// https://learn.microsoft.com/en-us/windows/win32/winmsg/about-window-procedures#window-procedure-superclassing
-static WNDPROC PhDefaultMenuWindowProcedure = NULL;
static WNDPROC PhDefaultDialogWindowProcedure = NULL;
+static WNDPROC PhDefaultMenuWindowProcedure = NULL;
static WNDPROC PhDefaultRebarWindowProcedure = NULL;
-static WNDPROC PhDefaultComboBoxWindowProcedure = NULL;
static WNDPROC PhDefaultStaticWindowProcedure = NULL;
static WNDPROC PhDefaultStatusbarWindowProcedure = NULL;
static WNDPROC PhDefaultEditWindowProcedure = NULL;
static WNDPROC PhDefaultHeaderWindowProcedure = NULL;
-static BOOLEAN PhDefaultEnableStreamerMode = FALSE;
-static BOOLEAN PhDefaultEnableThemeAcrylicWindowSupport = FALSE;
-static BOOLEAN PhDefaultEnableThemeAnimation = FALSE;
+static WNDPROC PhDefaultToolTipWindowProcedure = NULL;
LRESULT CALLBACK PhMenuWindowHookProcedure(
_In_ HWND WindowHandle,
@@ -62,28 +62,24 @@ LRESULT CALLBACK PhMenuWindowHookProcedure(
{
//CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
- if (PhDefaultEnableStreamerMode)
+ if (PhEnableStreamerMode)
{
SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
}
- if (PhEnableThemeSupport)
+ if (PhEnableThemeSupport && PhEnableThemeAcrylicSupport)
{
- if (PhEnableThemeAcrylicSupport)
- {
- // Note: DWM crashes if called from WM_NCCREATE (dmex)
- PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
- }
+ // Note: DWM crashes if called from WM_NCCREATE (dmex)
+ PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)), TRUE);
}
}
break;
case WM_NCDESTROY:
{
- if (PhEnableThemeSupport)
- {
- HFONT fontHandle;
+ HFONT fontHandle;
- fontHandle = PhGetWindowContext(WindowHandle, (ULONG)'font');
+ if (fontHandle = PhGetWindowContext(WindowHandle, (ULONG)'font'))
+ {
PhRemoveWindowContext(WindowHandle, (ULONG)'font');
if (fontHandle)
@@ -114,19 +110,29 @@ LRESULT CALLBACK PhDialogWindowHookProcedure(
if (WindowHandle == GetAncestor(WindowHandle, GA_ROOT))
{
- if (PhDefaultEnableStreamerMode)
+ if (PhEnableStreamerMode)
{
SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
}
- if (PhEnableThemeSupport && PhDefaultEnableThemeAcrylicWindowSupport)
+ if (PhEnableThemeAcrylicWindowSupport)
{
// Note: DWM crashes if called from WM_NCCREATE (dmex)
- PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
+ PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)), TRUE);
}
}
}
break;
+ case WM_COMMAND:
+ if (PhEnableStreamerMode && GET_WM_COMMAND_CMD(wParam, lParam) == CBN_DROPDOWN)
+ {
+ COMBOBOXINFO info = { sizeof(COMBOBOXINFO) };
+ if (SendMessage(GET_WM_COMMAND_HWND(wParam, lParam), CB_GETCOMBOBOXINFO, 0, (LPARAM)&info) && info.hwndList)
+ {
+ SetWindowDisplayAffinity(info.hwndList, WDA_EXCLUDEFROMCAPTURE);
+ }
+ }
+ break;
}
return CallWindowProc(PhDefaultDialogWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
@@ -139,46 +145,43 @@ LRESULT CALLBACK PhRebarWindowHookProcedure(
_In_ LPARAM lParam
)
{
- switch (WindowMessage)
+ if (PhEnableThemeSupport)
{
- case WM_CTLCOLOREDIT:
+ switch (WindowMessage)
{
+ case WM_CTLCOLOREDIT:
HDC hdc = (HDC)wParam;
SetBkMode(hdc, TRANSPARENT);
SetTextColor(hdc, PhThemeWindowTextColor);
SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
return (INT_PTR)PhGetStockBrush(DC_BRUSH);
+ break;
}
- break;
}
return CallWindowProc(PhDefaultRebarWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
}
-LRESULT CALLBACK PhComboBoxWindowHookProcedure(
+LRESULT CALLBACK PhToolTipWindowHookProcedure(
_In_ HWND WindowHandle,
_In_ UINT WindowMessage,
_In_ WPARAM wParam,
_In_ LPARAM lParam
)
{
- LRESULT result = CallWindowProc(PhDefaultComboBoxWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
+ LRESULT result = CallWindowProc(PhDefaultToolTipWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
switch (WindowMessage)
{
case WM_NCCREATE:
+ if (PhEnableStreamerMode)
{
- //CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
- COMBOBOXINFO info = { sizeof(COMBOBOXINFO) };
-
- if (SendMessage(WindowHandle, CB_GETCOMBOBOXINFO, 0, (LPARAM)&info))
- {
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(info.hwndList, WDA_EXCLUDEFROMCAPTURE);
- }
- }
+ SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
+ }
+ if (PhEnableThemeSupport)
+ {
+ PhWindowThemeSetDarkMode(WindowHandle, TRUE);
}
break;
}
@@ -195,15 +198,28 @@ LRESULT CALLBACK PhStaticWindowHookProcedure(
{
if (WindowMessage == WM_NCCREATE)
{
+ CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
+ WCHAR windowClassName[MAX_PATH];
LONG_PTR style = PhGetWindowStyle(WindowHandle);
- if ((style & SS_ICON) == SS_ICON)
+ if (createStruct->hwndParent)
{
- PhSetWindowContext(WindowHandle, SCHAR_MAX, (PVOID)TRUE);
+ GETCLASSNAME_OR_NULL(createStruct->hwndParent, windowClassName);
+
+ if (PhEqualStringZ(windowClassName, PH_TREENEW_CLASSNAME, FALSE))
+ {
+ PhSetWindowContext(WindowHandle, SHRT_MAX, (PVOID)'TNSB');
+ }
+ else if (PhEqualStringZ(windowClassName, L"CHECKLIST_ACLUI", FALSE))
+ {
+ PhSetWindowContext(WindowHandle, SHRT_MAX, (PVOID)'ACLC');
+ }
}
}
- if (WindowMessage != WM_KILLFOCUS && !PhGetWindowContext(WindowHandle, SCHAR_MAX))
+ LONG contextTag = HandleToLong(PhGetWindowContext(WindowHandle, SHRT_MAX));
+
+ if (!(contextTag))
return CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
switch (WindowMessage)
@@ -212,21 +228,27 @@ LRESULT CALLBACK PhStaticWindowHookProcedure(
PhRemoveWindowContext(WindowHandle, SCHAR_MAX);
break;
case WM_ERASEBKGND:
- return TRUE;
+ if (contextTag == 'TNSB')
+ {
+ HDC hdc = (HDC)wParam;
+ RECT rect;
+
+ GetClipBox(hdc, &rect);
+ SetDCBrushColor(hdc, PhEnableThemeSupport ? RGB(23, 23, 23) : GetSysColor(COLOR_BTNFACE));
+ FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
+ return TRUE;
+ }
+ break;
case WM_KILLFOCUS:
+ if (contextTag == 'ACLC' && PhEnableThemeSupport)
{
- WCHAR windowClassName[MAX_PATH];
+ RECT rectClient;
HWND ParentHandle = GetParent(WindowHandle);
- if (!GetClassName(ParentHandle, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
- if (PhEqualStringZ(windowClassName, L"CHECKLIST_ACLUI", FALSE))
- {
- RECT rectClient;
- GetClientRect(WindowHandle, &rectClient);
- PhInflateRect(&rectClient, 2, 2);
- MapWindowRect(WindowHandle, ParentHandle, &rectClient);
- InvalidateRect(ParentHandle, &rectClient, TRUE); // fix the annoying white border left by the previous active control
- }
+
+ GetClientRect(WindowHandle, &rectClient);
+ PhInflateRect(&rectClient, 2, 2);
+ MapWindowRect(WindowHandle, ParentHandle, &rectClient);
+ InvalidateRect(ParentHandle, &rectClient, TRUE); // fix the annoying white border left by the previous active control
}
break;
case WM_PAINT:
@@ -234,13 +256,14 @@ LRESULT CALLBACK PhStaticWindowHookProcedure(
HICON iconHandle;
PAINTSTRUCT ps;
RECT clientRect;
- WCHAR windowClassName[MAX_PATH];
- if (!GetClassName(GetParent(WindowHandle), windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
- if (PhEqualStringZ(windowClassName, L"CHECKLIST_ACLUI", FALSE))
+ switch (contextTag)
{
- if (iconHandle = (HICON)(UINT_PTR)CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, STM_GETICON, 0, 0))
+ case 'TNSB':
+ return DefWindowProc(WindowHandle, WindowMessage, wParam, lParam);
+ case 'ACLC':
+ if (PhEnableThemeSupport &&
+ (iconHandle = (HICON)(UINT_PTR)CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, STM_GETICON, 0, 0)))
{
static PH_INITONCE initOnce = PH_INITONCE_INIT;
static HFONT hCheckFont = NULL;
@@ -289,7 +312,8 @@ LRESULT CALLBACK PhStaticWindowHookProcedure(
0, 0,
FW_BOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY,
- VARIABLE_PITCH, L"Segoe UI");
+ VARIABLE_PITCH, L"Segoe UI"
+ );
PhEndInitOnce(&initOnce);
}
@@ -309,34 +333,6 @@ LRESULT CALLBACK PhStaticWindowHookProcedure(
return 0;
}
}
- //else if (iconHandle = (HICON)(UINT_PTR)CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, STM_GETICON, 0, 0)) // Static_GetIcon(WindowHandle, 0)
- //{
- // PAINTSTRUCT ps;
- // if (PhGetWindowContext(GetParent(WindowHandle), LONG_MAX) &&
- // BeginPaint(WindowHandle, &ps))
- // {
- // // Fix artefacts when window moving back from off-screen (Dart Vanya)
- // hdc = GetDC(WindowHandle);
- // GetClientRect(WindowHandle, &clientRect);
-
- // FillRect(hdc, &clientRect, PhThemeWindowBackgroundBrush);
-
- // DrawIconEx(
- // hdc,
- // clientRect.left,
- // clientRect.top,
- // iconHandle,
- // clientRect.right - clientRect.left,
- // clientRect.bottom - clientRect.top,
- // 0,
- // NULL,
- // DI_NORMAL
- // );
-
- // ReleaseDC(WindowHandle, hdc);
- // EndPaint(WindowHandle, &ps);
- // }
- //}
}
}
@@ -569,7 +565,7 @@ LRESULT CALLBACK PhStatusBarWindowHookProcedure(
context->CursorPos.y = LONG_MIN;
PhSetWindowContext(WindowHandle, LONG_MAX, context);
}
- else
+ else if (PhEnableThemeSupport || WindowMessage == WM_NCDESTROY || WindowMessage == WM_THEMECHANGED) // don't handle any drawing-related messages if theme is off
{
context = PhGetWindowContext(WindowHandle, LONG_MAX);
}
@@ -719,8 +715,9 @@ LRESULT CALLBACK PhEditWindowHookProcedure(
RECT windowRect;
HRGN updateRegion;
- // The searchbox control does its own theme drawing.
- if (PhGetWindowContext(WindowHandle, SHRT_MAX))
+ if (!PhEnableThemeSupport ||
+ PhGetWindowContext(WindowHandle, SHRT_MAX) || // The searchbox control does its own theme drawing.
+ !PhIsDarkModeAllowedForWindow(WindowHandle)) // Unsupported system dialogs does its own drawing
break;
updateRegion = (HRGN)wParam;
@@ -765,6 +762,8 @@ typedef struct _PHP_THEME_WINDOW_HEADER_CONTEXT
HTHEME ThemeHandle;
BOOLEAN MouseActive;
POINT CursorPos;
+ HWND ParentWindow;
+ BOOLEAN ThemeEnabled;
} PHP_THEME_WINDOW_HEADER_CONTEXT, *PPHP_THEME_WINDOW_HEADER_CONTEXT;
VOID ThemeWindowRenderHeaderControl(
@@ -949,17 +948,14 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(
{
WCHAR windowClassName[MAX_PATH];
- if (!GetClassName(createStruct->hwndParent, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
+ GETCLASSNAME_OR_NULL(createStruct->hwndParent, windowClassName);
- if (PhEqualStringZ(windowClassName, L"PhTreeNew", FALSE))
+ if (PhEqualStringZ(windowClassName, PH_TREENEW_CLASSNAME, FALSE))
{
LONG_PTR windowStyle = PhGetWindowStyle(createStruct->hwndParent);
if (BooleanFlagOn(windowStyle, TN_STYLE_CUSTOM_HEADERDRAW))
{
- PhSetControlTheme(WindowHandle, L"DarkMode_ItemsView");
-
return CallWindowProc(PhDefaultHeaderWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
}
}
@@ -969,15 +965,16 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(
context->ThemeHandle = PhOpenThemeData(WindowHandle, VSCLASS_HEADER, PhGetWindowDpi(WindowHandle));
context->CursorPos.x = LONG_MIN;
context->CursorPos.y = LONG_MIN;
+ context->ParentWindow = createStruct->hwndParent;
PhSetWindowContext(WindowHandle, LONG_MAX, context);
-
- PhSetControlTheme(WindowHandle, L"DarkMode_ItemsView");
-
- InvalidateRect(WindowHandle, NULL, FALSE);
}
- else
+ else if (PhEnableThemeSupport || WindowMessage == WM_NCDESTROY || WindowMessage == WM_THEMECHANGED) // don't handle any drawing-related messages if theme is off
{
context = PhGetWindowContext(WindowHandle, LONG_MAX);
+
+ // Don't apply header theme for unsupported dialogs: Advanced Security, Digital Signature Details, etc. (Dart Vanya)
+ if (context && !context->ThemeEnabled && WindowMessage != WM_NCDESTROY && WindowMessage != WM_THEMECHANGED) // HACK
+ context = NULL;
}
if (context)
@@ -1005,6 +1002,8 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(
}
context->ThemeHandle = PhOpenThemeData(WindowHandle, VSCLASS_HEADER, PhGetWindowDpi(WindowHandle));
+
+ context->ThemeEnabled = PhIsDarkModeAllowedForWindow(context->ParentWindow);
}
break;
case WM_ERASEBKGND:
@@ -1058,17 +1057,6 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(
break;
case WM_PAINT:
{
- // Don't apply header theme for unsupported dialogs: Advanced Security, Digital Signature Details, etc. (Dart Vanya)
- if (!PhIsDarkModeAllowedForWindow(GetParent(WindowHandle)))
- {
- PhRemoveWindowContext(WindowHandle, LONG_MAX);
- if (context->ThemeHandle)
- PhCloseThemeData(context->ThemeHandle);
- PhFree(context);
- PhSetControlTheme(WindowHandle, L"Explorer");
- break;
- }
-
//PAINTSTRUCT ps;
//HDC BufferedHDC;
//HPAINTBUFFER BufferedPaint;
@@ -1109,170 +1097,32 @@ LRESULT CALLBACK PhHeaderWindowHookProcedure(
//EndPaint(WindowHandle, &ps);
}
- goto DefaultWndProc;
+ return DefWindowProc(WindowHandle, WindowMessage, wParam, lParam);
}
}
return CallWindowProc(PhDefaultHeaderWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
-DefaultWndProc:
- return DefWindowProc(WindowHandle, WindowMessage, wParam, lParam);
-}
-
-VOID PhRegisterDialogSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, L"#32770", &wcex))
- return;
-
- PhDefaultDialogWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhDialogWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(L"#32770", NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterMenuSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, L"#32768", &wcex))
- return;
-
- PhDefaultMenuWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhMenuWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(L"#32768", NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterRebarSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, REBARCLASSNAME, &wcex))
- return;
-
- PhDefaultRebarWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhRebarWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(REBARCLASSNAME, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterComboBoxSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_COMBOBOX, &wcex))
- return;
-
- PhDefaultComboBoxWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhComboBoxWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_COMBOBOX, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterStaticSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_STATIC, &wcex))
- return;
-
- PhDefaultStaticWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhStaticWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_STATIC, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
}
-VOID PhRegisterStatusBarSuperClass(
- VOID
+VOID PhRegisterSuperClassCommon(
+ _In_ PWSTR ClassName,
+ _In_ WNDPROC HookProc,
+ _Out_ WNDPROC *OldWndProc
)
{
WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
- if (!GetClassInfoEx(NULL, STATUSCLASSNAME, &wcex))
- return;
-
- PhDefaultStatusbarWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhStatusBarWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(STATUSCLASSNAME, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
+ if (!GetClassInfoEx(NULL, ClassName, &wcex))
{
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterEditSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_EDIT, &wcex))
+ *OldWndProc = NULL;
return;
-
- PhDefaultEditWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhEditWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_EDIT, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
}
-}
-
-VOID PhRegisterHeaderSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
- if (!GetClassInfoEx(NULL, WC_HEADER, &wcex))
- return;
-
- PhDefaultHeaderWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhHeaderWindowHookProcedure;
+ *OldWndProc = wcex.lpfnWndProc;
+ wcex.lpfnWndProc = HookProc;
wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
- UnregisterClass(WC_HEADER, NULL);
+ UnregisterClass(ClassName, NULL);
if (RegisterClassEx(&wcex) == INVALID_ATOM)
{
PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
@@ -1281,22 +1131,32 @@ VOID PhRegisterHeaderSuperClass(
// Detours export procedure hooks
+#define PH_THEMEAPI HRESULT STDAPICALLTYPE
+
static __typeof__(&DrawThemeBackground) DefaultDrawThemeBackground = NULL;
+
static __typeof__(&DrawThemeBackgroundEx) DefaultDrawThemeBackgroundEx = NULL;
+
static __typeof__(&DrawThemeText) DefaultDrawThemeText = NULL;
+
static __typeof__(&DrawThemeTextEx) DefaultDrawThemeTextEx = NULL;
+
static __typeof__(&DrawTextW) DefaultComCtl32DrawTextW = NULL;
+
static __typeof__(&TaskDialogIndirect) DefaultTaskDialogIndirect = NULL;
+
static __typeof__(&GetThemeColor) DefaultGetThemeColor = NULL;
-static __typeof__(&SystemParametersInfoW) DefaultSystemParametersInfo = NULL;
-static __typeof__(&CreateWindowExW) DefaultCreateWindowEx = NULL;
// uxtheme.dll ordinal 49
-static HTHEME(WINAPI* DefaultOpenNcThemeData)(
+static HTHEME(STDAPICALLTYPE* DefaultOpenNcThemeData)(
_In_ HWND hwnd,
_In_ LPCWSTR pszClassList
) = NULL;
+static __typeof__(&SystemParametersInfo) DefaultSystemParametersInfo = NULL;
+
+static __typeof__(&CreateWindowEx) DefaultCreateWindowEx = NULL;
+
typedef struct _TASKDIALOG_CALLBACK_WRAP
{
PFTASKDIALOGCALLBACK pfCallback;
@@ -1313,13 +1173,11 @@ typedef struct _TASKDIALOG_WINDOW_CONTEXT
{
WNDPROC DefaultWindowProc;
ULONG Painting;
- PTASKDIALOG_CALLBACK_WRAP CallbackData;
+ TASKDIALOG_CALLBACK_WRAP CallbackData;
} TASKDIALOG_WINDOW_CONTEXT, *PTASKDIALOG_WINDOW_CONTEXT;
#define TASKDIALOG_CONTEXT_TAG (ULONG)'TDLG'
-#define GETCLASSNAME_OR_NULL(WindowHandle, ClassName) if (!GetClassName(WindowHandle, ClassName, RTL_NUMBER_OF(ClassName))) ClassName[0] = UNICODE_NULL
-
HRESULT CALLBACK ThemeTaskDialogCallbackHook(
_In_ HWND hwndDlg,
_In_ UINT uMsg,
@@ -1336,129 +1194,141 @@ LRESULT CALLBACK ThemeTaskDialogMasterSubclass(
);
BOOLEAN CALLBACK PhInitializeTaskDialogTheme(
- _In_ HWND hwndDlg,
- _In_opt_ PVOID Context
+ _In_ HWND WindowHandle,
+ _In_opt_ PVOID RootDialogWindow
);
-HRESULT PhDrawThemeBackgroundHook(
- _In_ HTHEME Theme,
- _In_ HDC Hdc,
- _In_ LONG PartId,
- _In_ LONG StateId,
- _In_ LPCRECT Rect,
- _In_ LPCRECT ClipRect
+PH_THEMEAPI
+PhDrawThemeBackgroundHook(
+ _In_ HTHEME hTheme,
+ _In_ HDC hdc,
+ _In_ int iPartId,
+ _In_ int iStateId,
+ _In_ LPCRECT pRect,
+ _In_opt_ LPCRECT pClipRect
)
{
- WCHAR className[MAX_PATH];
- BOOLEAN hasThemeClass = PhGetThemeClass(Theme, className, RTL_NUMBER_OF(className));
-
- if (WindowsVersion >= WINDOWS_11 && hasThemeClass)
+ if (PhEnableThemeSupport)
{
- if (PhEqualStringZ(className, VSCLASS_MENU, TRUE))
+ WCHAR className[MAX_PATH];
+
+ if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)))
{
- if (PartId == MENU_POPUPGUTTER || PartId == MENU_POPUPBORDERS)
+ if (WindowsVersion >= WINDOWS_11)
{
- FillRect(Hdc, Rect, PhThemeWindowBackgroundBrush);
- return S_OK;
+ if (PhEqualStringZ(className, VSCLASS_MENU, TRUE))
+ {
+ if (iPartId == MENU_POPUPGUTTER || iPartId == MENU_POPUPBORDERS)
+ {
+ FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
+ return S_OK;
+ }
+ }
}
- }
- }
- if (hasThemeClass && PhEqualStringZ(className, VSCLASS_PROGRESS, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(Hdc) == NULL*/)
- {
- if (PartId == PP_TRANSPARENTBAR || PartId == PP_TRANSPARENTBARVERT) // Progress bar background
- {
- FillRect(Hdc, Rect, PhThemeWindowBackgroundBrush);
- SetDCBrushColor(Hdc, RGB(0x60, 0x60, 0x60));
- FrameRect(Hdc, Rect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
+ if (PhEqualStringZ(className, VSCLASS_PROGRESS, TRUE)
+ /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(Hdc) == NULL*/)
+ {
+ if (iPartId == PP_TRANSPARENTBAR || iPartId == PP_TRANSPARENTBARVERT) // Progress bar background
+ {
+ FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
+ SetDCBrushColor(hdc, RGB(0x60, 0x60, 0x60));
+ FrameRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
+ return S_OK;
+ }
+ }
}
}
- return DefaultDrawThemeBackground(Theme, Hdc, PartId, StateId, Rect, ClipRect);
+ return DefaultDrawThemeBackground(hTheme, hdc, iPartId, iStateId, pRect, pClipRect);
}
-HRESULT WINAPI PhDrawThemeBackgroundExHook(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCRECT pRect,
- _In_ const DTBGOPTS* pOptions
-)
+PH_THEMEAPI
+PhDrawThemeBackgroundExHook(
+ _In_ HTHEME hTheme,
+ _In_ HDC hdc,
+ _In_ int iPartId,
+ _In_ int iStateId,
+ _In_ LPCRECT pRect,
+ _In_opt_ const DTBGOPTS* pOptions
+ )
{
- WCHAR className[MAX_PATH];
-
- // Apply theme to ListView checkboxes
- if (iPartId == BP_CHECKBOX /*|| iPartId == BP_RADIOBUTTON*/)
+ if (PhEnableThemeSupport)
{
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) &&
- PhEqualStringZ(className, VSCLASS_BUTTON, TRUE))
+ WCHAR className[MAX_PATH];
+ // Apply theme to ListView checkboxes
+ if (iPartId == BP_CHECKBOX /*|| iPartId == BP_RADIOBUTTON*/)
{
- HTHEME darkButtonTheme = PhOpenThemeData(NULL, L"DarkMode_Explorer::Button", 0);
- HRESULT retVal = DefaultDrawThemeBackgroundEx(darkButtonTheme ? darkButtonTheme : hTheme, hdc, iPartId, iStateId, pRect, pOptions);
- if (darkButtonTheme)
- PhCloseThemeData(darkButtonTheme);
- return retVal;
+ if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) &&
+ PhEqualStringZ(className, VSCLASS_BUTTON, TRUE))
+ {
+ HTHEME darkButtonTheme = PhOpenThemeData(NULL, L"Explorer::Button", 0);
+ HRESULT result = DefaultDrawThemeBackgroundEx(darkButtonTheme ? darkButtonTheme : hTheme, hdc, iPartId, iStateId, pRect, pOptions);
+ if (darkButtonTheme) PhCloseThemeData(darkButtonTheme);
+ return result;
+ }
}
- }
- // Micro optimization
- if ((iPartId == TDLG_PRIMARYPANEL || iPartId == TDLG_FOOTNOTEPANE || iPartId == TDLG_SECONDARYPANEL || iPartId == TDLG_FOOTNOTESEPARATOR || iPartId == TDLG_EXPANDOBUTTON) &&
- PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOG, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
- {
- switch (iPartId)
- {
- case TDLG_PRIMARYPANEL:
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- case TDLG_FOOTNOTEPANE:
- FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
- return S_OK;
- case TDLG_SECONDARYPANEL:
- {
- FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
- RECT rect = *pRect;
- rect.bottom = rect.top + 1;
- SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- PhOffsetRect(&rect, 0, 1);
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- }
- case TDLG_FOOTNOTESEPARATOR:
+ // Micro optimization
+ if ((iPartId == TDLG_PRIMARYPANEL || iPartId == TDLG_FOOTNOTEPANE || iPartId == TDLG_SECONDARYPANEL ||
+ iPartId == TDLG_FOOTNOTESEPARATOR ||iPartId == TDLG_EXPANDOBUTTON) &&
+ PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOG, TRUE)
+ /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
{
- SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
- FillRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
- RECT rect = *pRect;
- rect.top += 1;
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- }
- case TDLG_EXPANDOBUTTON:
- if (WindowsVersion >= WINDOWS_11)
+ switch (iPartId)
{
- // In Windows 11, buttons lack background, making them indistinguishable on dark backgrounds.
- // To address this, we invert the button. This technique isn't applicable to Windows 10 as it causes the button's border to appear chipped.
- static enum { yes, no, unknown } mustInvertButton = unknown;
- if (mustInvertButton == unknown)
+ case TDLG_PRIMARYPANEL:
+ SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
+ FillRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
+ return S_OK;
+ case TDLG_FOOTNOTEPANE:
+ FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
+ return S_OK;
+ case TDLG_SECONDARYPANEL:
+ {
+ FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
+ RECT rect = *pRect;
+ rect.bottom = rect.top + 1;
+ SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
+ FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
+ PhOffsetRect(&rect, 0, 1);
+ SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
+ FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
+ return S_OK;
+ }
+ case TDLG_FOOTNOTESEPARATOR:
+ {
+ SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
+ FillRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
+ RECT rect = *pRect;
+ rect.top += 1;
+ SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
+ FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
+ return S_OK;
+ }
+ case TDLG_EXPANDOBUTTON:
+ if (WindowsVersion >= WINDOWS_11)
{
- DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
- int buttonCenterX = pOptions->rcClip.left + (pOptions->rcClip.right - pOptions->rcClip.left) / 2;
- int buttonCenterY = pOptions->rcClip.top + (pOptions->rcClip.bottom - pOptions->rcClip.top) / 2;
- COLORREF centerPixel = GetPixel(hdc, buttonCenterX, buttonCenterY);
- mustInvertButton = centerPixel == PhThemeWindowTextColor ? no : yes;
+ // In Windows 11, buttons lack background, making them indistinguishable on dark backgrounds.
+ // To address this, we invert the button. This technique isn't applicable to Windows 10 as it causes the button's border to appear chipped.
+ static enum { yes, no, unknown } mustInvertButton = unknown;
+ if (mustInvertButton == unknown)
+ {
+ DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
+ if (pOptions)
+ {
+ int buttonCenterX = pOptions->rcClip.left + (pOptions->rcClip.right - pOptions->rcClip.left) / 2;
+ int buttonCenterY = pOptions->rcClip.top + (pOptions->rcClip.bottom - pOptions->rcClip.top) / 2;
+ COLORREF centerPixel = GetPixel(hdc, buttonCenterX, buttonCenterY);
+ mustInvertButton = centerPixel == PhThemeWindowTextColor ? no : yes;
+ }
+ }
+ FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
+ if (mustInvertButton == yes) InvertRect(hdc, pRect);
+ HRESULT retVal = DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
+ if (mustInvertButton == yes) InvertRect(hdc, pRect);
+ return retVal;
}
- FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
- if (mustInvertButton == yes) InvertRect(hdc, pRect);
- HRESULT retVal = DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
- if (mustInvertButton == yes) InvertRect(hdc, pRect);
- return retVal;
}
}
}
@@ -1466,112 +1336,121 @@ HRESULT WINAPI PhDrawThemeBackgroundExHook(
return DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
}
-HWND PhCreateWindowExHook(
- _In_ ULONG ExStyle,
- _In_opt_ PCWSTR ClassName,
- _In_opt_ PCWSTR WindowName,
- _In_ ULONG Style,
- _In_ LONG X,
- _In_ LONG Y,
- _In_ LONG Width,
- _In_ LONG Height,
- _In_opt_ HWND Parent,
- _In_opt_ HMENU Menu,
- _In_opt_ PVOID Instance,
- _In_opt_ PVOID Param
+HWND
+WINAPI
+PhCreateWindowExHook(
+ _In_ DWORD dwExStyle,
+ _In_opt_ LPCWSTR lpClassName,
+ _In_opt_ LPCWSTR lpWindowName,
+ _In_ DWORD dwStyle,
+ _In_ int X,
+ _In_ int Y,
+ _In_ int nWidth,
+ _In_ int nHeight,
+ _In_opt_ HWND hWndParent,
+ _In_opt_ HMENU hMenu,
+ _In_opt_ HINSTANCE hInstance,
+ _In_opt_ LPVOID lpParam
)
{
HWND windowHandle = DefaultCreateWindowEx(
- ExStyle,
- ClassName,
- WindowName,
- Style,
+ dwExStyle,
+ lpClassName,
+ lpWindowName,
+ dwStyle,
X,
Y,
- Width,
- Height,
- Parent,
- Menu,
- Instance,
- Param
+ nWidth,
+ nHeight,
+ hWndParent,
+ hMenu,
+ hInstance,
+ lpParam
);
- if (Parent == NULL)
+ if (hWndParent == NULL)
{
- if (PhDefaultEnableStreamerMode)
+ if (PhEnableStreamerMode)
{
SetWindowDisplayAffinity(windowHandle, WDA_EXCLUDEFROMCAPTURE);
}
- if (PhEnableThemeSupport && PhDefaultEnableThemeAcrylicWindowSupport)
+ if (PhEnableThemeAcrylicWindowSupport)
{
- PhSetWindowAcrylicCompositionColor(windowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
+ PhSetWindowAcrylicCompositionColor(windowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)), TRUE);
}
}
- else if (PhEnableThemeSupport)
+ else
{
// Early subclassing of the SysLink control to eliminate blinking during page switches.
- if (!IS_INTRESOURCE(ClassName) && PhEqualStringZ(ClassName, WC_LINK, TRUE))
+ if (!IS_INTRESOURCE(lpClassName) && PhEqualStringZ(lpClassName, WC_LINK, FALSE))
{
- PhInitializeTaskDialogTheme(windowHandle, 0);
+ PhInitializeTaskDialogTheme(windowHandle, NULL);
}
- else if (!IS_INTRESOURCE(ClassName) && PhEqualStringZ(ClassName, WC_BUTTON, TRUE) &&
- PhGetWindowContext(GetAncestor(Parent, GA_ROOT), LONG_MAX))
+ else if (PhEnableThemeSupport &&
+ !IS_INTRESOURCE(lpClassName) && PhEqualStringZ(lpClassName, WC_BUTTON, FALSE) &&
+ PhGetWindowContext(hWndParent, LONG_MAX))
{
- PhSetControlTheme(windowHandle, L"DarkMode_Explorer");
+ PhWindowThemeSetDarkMode(windowHandle, TRUE);
}
}
return windowHandle;
}
-BOOL WINAPI PhSystemParametersInfoHook(
+_Success_(return != FALSE)
+BOOL
+WINAPI
+PhSystemParametersInfoHook(
_In_ UINT uiAction,
_In_ UINT uiParam,
_Pre_maybenull_ _Post_valid_ PVOID pvParam,
_In_ UINT fWinIni
)
{
- if (uiAction == SPI_GETMENUFADE && pvParam)
+ if (PhEnableThemeSupport && !PhEnableThemeAnimation)
{
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
+ if (uiAction == SPI_GETMENUFADE && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
- if (uiAction == SPI_GETCLIENTAREAANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
+ if (uiAction == SPI_GETCLIENTAREAANIMATION && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
- if (uiAction == SPI_GETCOMBOBOXANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
+ if (uiAction == SPI_GETCOMBOBOXANIMATION && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
- if (uiAction == SPI_GETTOOLTIPANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
+ if (uiAction == SPI_GETTOOLTIPANIMATION && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
- if (uiAction == SPI_GETMENUANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
+ if (uiAction == SPI_GETMENUANIMATION && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
- if (uiAction == SPI_GETTOOLTIPFADE && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
+ if (uiAction == SPI_GETTOOLTIPFADE && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
- if (uiAction == SPI_GETMOUSEVANISH && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
+ if (uiAction == SPI_GETMOUSEVANISH && pvParam)
+ {
+ *((PBOOL)pvParam) = FALSE;
+ return TRUE;
+ }
}
return DefaultSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
@@ -1625,103 +1504,121 @@ BOOL WINAPI PhSystemParametersInfoHook(
//#define RGB_FROM_COLOREF(cref) \
// ((((cref) & 0x000000FF) << 16) | (((cref) & 0x0000FF00)) | (((cref) & 0x00FF0000) >> 16))
-HRESULT WINAPI PhDrawThemeTextHook(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCWSTR pszText,
- _In_ int cchText,
- _In_ DWORD dwTextFlags,
- _In_ DWORD dwTextFlags2,
+PH_THEMEAPI
+PhDrawThemeTextHook(
+ _In_ HTHEME hTheme,
+ _In_ HDC hdc,
+ _In_ int iPartId,
+ _In_ int iStateId,
+ _In_reads_(cchText) LPCWSTR pszText,
+ _In_ int cchText,
+ _In_ DWORD dwTextFlags,
+ _In_ DWORD dwTextFlags2,
_In_ LPCRECT pRect
)
{
- if ((iPartId == BP_COMMANDLINK /*|| iPartId == BP_RADIOBUTTON*/) && iStateId != PBS_DISABLED)
+ if (PhEnableThemeSupport)
{
WCHAR className[MAX_PATH];
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_BUTTON, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
+
+ if ((iPartId == BP_COMMANDLINK /*|| iPartId == BP_RADIOBUTTON*/) && iStateId != PBS_DISABLED)
{
- DTTOPTS options = { sizeof(DTTOPTS), DTT_TEXTCOLOR, PhThemeWindowTextColor };
- return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, (LPRECT)pRect, &options);
+ if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_BUTTON, TRUE)
+ /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
+ {
+ DTTOPTS options = { sizeof(DTTOPTS), DTT_TEXTCOLOR, PhThemeWindowTextColor };
+ return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, (LPRECT)pRect, &options);
+ }
}
}
return DefaultDrawThemeText(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, dwTextFlags2, pRect);
}
-HRESULT WINAPI PhDrawThemeTextExHook(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCWSTR pszText,
- _In_ int cchText,
- _In_ DWORD dwTextFlags,
- _Inout_ LPRECT pRect,
- _In_ const DTTOPTS* pOptions
+PH_THEMEAPI
+PhDrawThemeTextExHook(
+ _In_ HTHEME hTheme,
+ _In_ HDC hdc,
+ _In_ int iPartId,
+ _In_ int iStateId,
+ _In_reads_(cchText) LPCWSTR pszText,
+ _In_ int cchText,
+ _In_ DWORD dwTextFlags,
+ _Inout_ LPRECT pRect,
+ _In_opt_ const DTTOPTS* pOptions
)
{
- if (iPartId == BP_COMMANDLINK)
+ if (PhEnableThemeSupport)
{
WCHAR className[MAX_PATH];
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_BUTTON, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
+
+ if (iPartId == BP_COMMANDLINK)
{
- DTTOPTS options = { sizeof(DTTOPTS) };
- if (pOptions)
- options = *pOptions;
- options.dwFlags |= DTT_TEXTCOLOR;
- DefaultGetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &options.crText);
- options.crText = PhMakeColorBrighter(options.crText, 90);
- return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, pRect, &options);
+ if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_BUTTON, TRUE)
+ /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
+ {
+ DTTOPTS options = { sizeof(DTTOPTS) };
+ if (pOptions)
+ options = *pOptions;
+ options.dwFlags |= DTT_TEXTCOLOR;
+ DefaultGetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &options.crText);
+ options.crText = PhMakeColorBrighter(options.crText, 90);
+ return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, pRect, &options);
+ }
}
}
return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, pRect, pOptions);
}
-int PhDetoursComCtl32DrawTextW(
- _In_ HDC hdc,
- _Inout_ LPCWSTR lpchText,
- _In_ int cchText,
- _Inout_ LPRECT lprc,
- _In_ UINT format
+_Success_(return)
+int
+WINAPI
+PhDetoursComCtl32DrawTextW(
+ _In_ HDC hdc,
+ _When_((format & DT_MODIFYSTRING), _At_((LPWSTR)lpchText, _Inout_grows_updates_bypassable_or_z_(cchText, 4)))
+ _When_((!(format & DT_MODIFYSTRING)), _In_bypassable_reads_or_z_(cchText))
+ LPCWSTR lpchText,
+ _In_ int cchText,
+ _Inout_ LPRECT lprc,
+ _In_ UINT format
)
{
- static PH_INITONCE initOnce = PH_INITONCE_INIT;
- static COLORREF colLinkNormal = RGB(0, 0 ,0);
- static COLORREF colLinkHot = RGB(0, 0, 0);
- static COLORREF colLinkPressed = RGB(0, 0, 0);
- HWND WindowHandle;
-
- if ((WindowHandle = WindowFromDC(hdc)) &&
- (PhIsDarkModeAllowedForWindow(WindowHandle) || PhGetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG))) // HACK
+ if (PhEnableThemeSupport)
{
+ static PH_INITONCE initOnce = PH_INITONCE_INIT;
+ static COLORREF colLinkNormal = RGB(0, 0, 0);
+ static COLORREF colLinkHot = RGB(0, 0, 0);
+ static COLORREF colLinkPressed = RGB(0, 0, 0);
+
+ HWND WindowHandle;
WCHAR windowClassName[MAX_PATH];
- GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
- if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
+
+ if ((WindowHandle = WindowFromDC(hdc)) && PhIsDarkModeAllowedForWindow(WindowHandle)) // HACK
{
- if (PhBeginInitOnce(&initOnce))
+ GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
+ if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
{
- HTHEME hTextTheme = PhOpenThemeData(WindowHandle, VSCLASS_TEXTSTYLE, PhGetWindowDpi(WindowHandle));
- if (hTextTheme)
+ if (PhBeginInitOnce(&initOnce))
{
- PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_NORMAL, TMT_TEXTCOLOR, &colLinkNormal);
- PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_HOT, TMT_TEXTCOLOR, &colLinkHot);
- PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_PRESSED, TMT_TEXTCOLOR, &colLinkPressed);
- PhCloseThemeData(hTextTheme);
+ HTHEME hTextTheme = PhOpenThemeData(WindowHandle, VSCLASS_TEXTSTYLE, PhGetWindowDpi(WindowHandle));
+ if (hTextTheme)
+ {
+ PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_NORMAL, TMT_TEXTCOLOR, &colLinkNormal);
+ PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_HOT, TMT_TEXTCOLOR, &colLinkHot);
+ PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_PRESSED, TMT_TEXTCOLOR, &colLinkPressed);
+ PhCloseThemeData(hTextTheme);
+ }
+ PhEndInitOnce(&initOnce);
}
- PhEndInitOnce(&initOnce);
- }
- COLORREF color = GetTextColor(hdc);
+ COLORREF color = GetTextColor(hdc);
- if (color == colLinkNormal || color == colLinkHot || color == colLinkPressed ||
- WindowsVersion < WINDOWS_11 && color == RGB(0x00, 0x66, 0xCC)) // on Windows 10 PhGetThemeColor returns 0xFFFFFF for any StateId
- {
- SetTextColor(hdc, PhMakeColorBrighter(color, 95));
+ if (color == colLinkNormal || color == colLinkHot || color == colLinkPressed ||
+ WindowsVersion < WINDOWS_11 && color == RGB(0x00, 0x66, 0xCC)) // on Windows 10 PhGetThemeColor returns 0xFFFFFF for any StateId
+ {
+ SetTextColor(hdc, PhMakeColorBrighter(color, 95));
+ }
}
}
}
@@ -1729,47 +1626,56 @@ int PhDetoursComCtl32DrawTextW(
return DefaultComCtl32DrawTextW(hdc, lpchText, cchText, lprc, format);
}
-HRESULT PhGetThemeColorHook(
- _In_ HTHEME hTheme,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ int iPropId,
+PH_THEMEAPI
+PhGetThemeColorHook(
+ _In_ HTHEME hTheme,
+ _In_ int iPartId,
+ _In_ int iStateId,
+ _In_ int iPropId,
_Out_ COLORREF* pColor
)
{
- WCHAR className[MAX_PATH];
+ HRESULT result = DefaultGetThemeColor(hTheme, iPartId, iStateId, iPropId, pColor);
- HRESULT retVal = DefaultGetThemeColor(hTheme, iPartId, iStateId, iPropId, pColor);
-
- if (iPropId == TMT_TEXTCOLOR && iPartId == TDLG_MAININSTRUCTIONPANE)
+ if (PhEnableThemeSupport)
{
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOGSTYLE, TRUE)
- /*|| WindowsVersion < WINDOWS_11*/)
+ WCHAR className[MAX_PATH];
+
+ if (iPropId == TMT_TEXTCOLOR && iPartId == TDLG_MAININSTRUCTIONPANE)
{
- *pColor = PhMakeColorBrighter(*pColor, 150); // Main header.
+ if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOGSTYLE, TRUE)
+ /*|| WindowsVersion < WINDOWS_11*/)
+ {
+ *pColor = PhMakeColorBrighter(*pColor, 150); // Main header.
+ }
}
- }
- else if (iPropId == TMT_TEXTCOLOR)
- {
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOGSTYLE, TRUE)
- /*|| WindowsVersion < WINDOWS_11*/)
+ else if (iPropId == TMT_TEXTCOLOR)
{
- *pColor = PhThemeWindowTextColor; // Text color for check boxes, expanded text, and expander button text.
+ if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOGSTYLE, TRUE)
+ /*|| WindowsVersion < WINDOWS_11*/)
+ {
+ *pColor = PhThemeWindowTextColor; // Text color for check boxes, expanded text, and expander button text.
+ }
}
}
- return retVal;
+ return result;
}
-HTHEME PhOpenNcThemeDataHook(
+HTHEME
+STDAPICALLTYPE
+PhOpenNcThemeDataHook(
_In_ HWND hwnd,
_In_ LPCWSTR pszClassList
)
{
- if (PhEqualStringZ((PWSTR)pszClassList, VSCLASS_SCROLLBAR, TRUE) &&
- PhIsDarkModeAllowedForWindow(hwnd))
+ if (PhEnableThemeSupport)
{
- return DefaultOpenNcThemeData(NULL, L"Explorer::ScrollBar");
+ if (PhEqualStringZ(pszClassList, VSCLASS_SCROLLBAR, TRUE) &&
+ PhIsDarkModeAllowedForWindow(hwnd))
+ {
+ return DefaultOpenNcThemeData(NULL, L"Explorer::ScrollBar");
+ }
}
return DefaultOpenNcThemeData(hwnd, pszClassList);
@@ -1777,27 +1683,27 @@ HTHEME PhOpenNcThemeDataHook(
BOOLEAN CALLBACK PhInitializeTaskDialogTheme(
_In_ HWND WindowHandle,
- _In_opt_ PVOID CallbackData
+ _In_opt_ PVOID RootDialogWindow
)
{
WCHAR windowClassName[MAX_PATH];
PTASKDIALOG_COMMON_CONTEXT context;
BOOLEAN windowHasContext = !!PhGetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG);
- if (CallbackData && !windowHasContext)
+ if (RootDialogWindow && !windowHasContext)
{
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
- }
+ // Handled by PhDialogWindowHookProcedure
+ //if (PhEnableStreamerMode)
+ //{
+ // SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
+ //}
PhInitializeThemeWindowFrame(WindowHandle);
PTASKDIALOG_WINDOW_CONTEXT context = PhAllocateZero(sizeof(TASKDIALOG_WINDOW_CONTEXT));
context->DefaultWindowProc = PhSetWindowProcedure(WindowHandle, ThemeTaskDialogMasterSubclass);
- context->CallbackData = CallbackData;
PhSetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG, context);
- windowHasContext = TRUE;
+ windowHasContext = !!context;
}
PhEnumChildWindows(
@@ -1810,27 +1716,30 @@ BOOLEAN CALLBACK PhInitializeTaskDialogTheme(
if (windowHasContext) // HACK
return TRUE;
- GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
-
context = PhAllocateZero(sizeof(TASKDIALOG_COMMON_CONTEXT));
context->DefaultWindowProc = PhSetWindowProcedure(WindowHandle, ThemeTaskDialogMasterSubclass);
PhSetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG, context);
- if (PhEqualStringZ(windowClassName, WC_BUTTON, FALSE) ||
- PhEqualStringZ(windowClassName, WC_SCROLLBAR, FALSE))
- {
- PhSetControlTheme(WindowHandle, L"DarkMode_Explorer");
- }
- //else if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
- //{
- // PhAllowDarkModeForWindow(WindowHandle); // this doesn't work, idk why
- //}
- else if (PhEqualStringZ(windowClassName, L"DirectUIHWND", FALSE))
+ if (PhEnableThemeSupport)
{
- //WINDOWPLACEMENT pos = { 0 };
- //GetWindowPlacement(GetParent(WindowHandle), &pos);
- PhSetControlTheme(WindowHandle, L"DarkMode_Explorer");
- //SetWindowPlacement(GetParent(WindowHandle), &pos);
+ GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
+
+ if (PhEqualStringZ(windowClassName, WC_BUTTON, FALSE) ||
+ PhEqualStringZ(windowClassName, WC_SCROLLBAR, FALSE))
+ {
+ PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ }
+ else if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
+ {
+ PhAllowDarkModeForWindow(WindowHandle, TRUE);
+ }
+ else if (PhEqualStringZ(windowClassName, L"DirectUIHWND", FALSE))
+ {
+ //WINDOWPLACEMENT pos = { 0 };
+ //GetWindowPlacement(GetParent(WindowHandle), &pos);
+ PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ //SetWindowPlacement(GetParent(WindowHandle), &pos);
+ }
}
return TRUE;
@@ -1852,8 +1761,33 @@ LRESULT CALLBACK ThemeTaskDialogMasterSubclass(
OldWndProc = context->DefaultWindowProc;
+ if (!PhEnableThemeSupport && uMsg != WM_NCDESTROY && uMsg != TDM_NAVIGATE_PAGE)
+ goto OriginalWndProc;
+
switch (uMsg)
{
+ case WM_NCDESTROY:
+ {
+ PhSetWindowProcedure(hwnd, OldWndProc);
+ PhRemoveWindowContext(hwnd, TASKDIALOG_CONTEXT_TAG);
+ PhFree(context);
+ }
+ goto OriginalWndProc;
+ case TDM_NAVIGATE_PAGE:
+ {
+ PTASKDIALOG_WINDOW_CONTEXT WindowContext = (PTASKDIALOG_WINDOW_CONTEXT)context;
+ PTASKDIALOGCONFIG trueConfig = (PTASKDIALOGCONFIG)lParam;
+ PTASKDIALOGCONFIG myConfig;
+ TASKDIALOGCONFIG config = { sizeof(TASKDIALOGCONFIG) };
+
+ WindowContext->CallbackData.pfCallback = trueConfig ? trueConfig->pfCallback : NULL;
+ WindowContext->CallbackData.lpCallbackData = trueConfig ? trueConfig->lpCallbackData : 0;
+ myConfig = trueConfig ? trueConfig : &config;
+ myConfig->pfCallback = ThemeTaskDialogCallbackHook;
+ myConfig->lpCallbackData = (LONG_PTR)&WindowContext->CallbackData;
+
+ return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, (LPARAM)myConfig);
+ }
case WM_ERASEBKGND:
{
HDC hdc = (HDC)wParam;
@@ -1884,8 +1818,7 @@ LRESULT CALLBACK ThemeTaskDialogMasterSubclass(
LPNMCUSTOMDRAW customDraw = (LPNMCUSTOMDRAW)lParam;
WCHAR className[MAX_PATH];
- if (!GetClassName(customDraw->hdr.hwndFrom, className, RTL_NUMBER_OF(className)))
- className[0] = UNICODE_NULL;
+ GETCLASSNAME_OR_NULL(customDraw->hdr.hwndFrom, className);
if (PhEqualStringZ(className, WC_BUTTON, FALSE))
{
return PhThemeWindowDrawButton(customDraw);
@@ -1893,36 +1826,18 @@ LRESULT CALLBACK ThemeTaskDialogMasterSubclass(
}
}
break;
- case TDM_NAVIGATE_PAGE:
- {
- PTASKDIALOG_WINDOW_CONTEXT WindowContext = (PTASKDIALOG_WINDOW_CONTEXT)context;
- PTASKDIALOGCONFIG trueConfig = (PTASKDIALOGCONFIG)lParam;
- PTASKDIALOGCONFIG myConfig;
- TASKDIALOGCONFIG config = { sizeof(TASKDIALOGCONFIG) };
-
- WindowContext->CallbackData->pfCallback = trueConfig ? trueConfig->pfCallback : NULL;
- WindowContext->CallbackData->lpCallbackData = trueConfig ? trueConfig->lpCallbackData : 0;
- myConfig = trueConfig ? trueConfig : &config;
- myConfig->pfCallback = ThemeTaskDialogCallbackHook;
- myConfig->lpCallbackData = (LONG_PTR)WindowContext->CallbackData;
-
- return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, (LPARAM)myConfig);
- }
- case WM_DESTROY:
- {
- PhSetWindowProcedure(hwnd, OldWndProc);
- PhRemoveWindowContext(hwnd, TASKDIALOG_CONTEXT_TAG);
- PhFree(context);
- }
- return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
case WM_CTLCOLORDLG:
- return (LRESULT)PhThemeWindowBackgroundBrush; // Window background color when the extender resizes upward (Windows 10 only).
+ // Window background color when the extender resizes upward (Windows 10 only).
+ return (LRESULT)PhThemeWindowBackgroundBrush;
}
context->Painting++;
result = CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
context->Painting--;
return result;
+
+OriginalWndProc:
+ return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
}
HRESULT CALLBACK ThemeTaskDialogCallbackHook(
@@ -1935,33 +1850,33 @@ HRESULT CALLBACK ThemeTaskDialogCallbackHook(
{
HRESULT result = S_OK;
- PTASKDIALOG_CALLBACK_WRAP CallbackData = (PTASKDIALOG_CALLBACK_WRAP)dwRefData;
+ PTASKDIALOG_CALLBACK_WRAP callbackData = (PTASKDIALOG_CALLBACK_WRAP)dwRefData;
if (uMsg == TDN_DIALOG_CONSTRUCTED) // Called on each new page, including the first one.
{
- PhInitializeTaskDialogTheme(hwndDlg, CallbackData);
+ PhInitializeTaskDialogTheme(hwndDlg, hwndDlg);
}
- if (CallbackData->pfCallback)
- result = CallbackData->pfCallback(hwndDlg, uMsg, wParam, lParam, CallbackData->lpCallbackData);
+ if (callbackData->pfCallback)
+ result = callbackData->pfCallback(hwndDlg, uMsg, wParam, lParam, callbackData->lpCallbackData);
return result;
}
// https://github.com/SFTRS/DarkTaskDialog
-HRESULT PhTaskDialogIndirectHook(
- _In_ const TASKDIALOGCONFIG* pTaskConfig,
+HRESULT WINAPI PhTaskDialogIndirectHook(
+ _In_ const TASKDIALOGCONFIG* pTaskConfig,
_Out_opt_ int* pnButton,
_Out_opt_ int* pnRadioButton,
_Out_opt_ BOOL* pfVerificationFlagChecked
)
{
- TASKDIALOG_CALLBACK_WRAP CallbackData;
- CallbackData.pfCallback = pTaskConfig->pfCallback;
- CallbackData.lpCallbackData = pTaskConfig->lpCallbackData;
+ TASKDIALOG_CALLBACK_WRAP callbackData;
+ callbackData.pfCallback = pTaskConfig->pfCallback;
+ callbackData.lpCallbackData = pTaskConfig->lpCallbackData;
TASKDIALOGCONFIG myConfig = *pTaskConfig;
myConfig.pfCallback = ThemeTaskDialogCallbackHook;
- myConfig.lpCallbackData = (LONG_PTR)&CallbackData;
+ myConfig.lpCallbackData = (LONG_PTR)&callbackData;
return DefaultTaskDialogIndirect(&myConfig, pnButton, pnRadioButton, pfVerificationFlagChecked);
}
@@ -1973,12 +1888,6 @@ VOID PhRegisterDetoursHooks(
NTSTATUS status;
PVOID baseAddress;
- // For early TaskDialog with PhStartupParameters.ShowOptions
- if (!PhThemeWindowBackgroundBrush)
- {
- PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
- }
-
if (baseAddress = PhGetLoaderEntryDllBaseZ(L"user32.dll"))
{
DefaultCreateWindowEx = PhGetDllBaseProcedureAddress(baseAddress, "CreateWindowExW", 0);
@@ -2005,17 +1914,15 @@ VOID PhRegisterDetoursHooks(
if (!NT_SUCCESS(status = DetourTransactionBegin()))
goto CleanupExit;
- if (PhEnableThemeSupport || PhEnableThemeAcrylicSupport)
{
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeBackground, (PVOID)PhDrawThemeBackgroundHook)))
goto CleanupExit;
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeBackgroundEx, (PVOID)PhDrawThemeBackgroundExHook)))
goto CleanupExit;
- if (!PhDefaultEnableThemeAnimation)
- {
+ if (!PhEnableThemeAnimation)
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultSystemParametersInfo, (PVOID)PhSystemParametersInfoHook)))
goto CleanupExit;
- }
+
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeText, (PVOID)PhDrawThemeTextHook)))
goto CleanupExit;
if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeTextEx, (PVOID)PhDrawThemeTextExHook)))
@@ -2046,7 +1953,7 @@ BOOLEAN PhIsThemeTransparencyEnabled(
VOID
)
{
- static PH_STRINGREF themesKeyName = PH_STRINGREF_INIT(L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
+ static CONST PH_STRINGREF themesKeyName = PH_STRINGREF_INIT(L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
BOOLEAN themesEnableTransparency = FALSE;
HANDLE keyHandle;
@@ -2058,7 +1965,8 @@ BOOLEAN PhIsThemeTransparencyEnabled(
0
)))
{
- themesEnableTransparency = !!PhQueryRegistryUlongZ(keyHandle, L"EnableTransparency");
+ ULONG enableTransparency = PhQueryRegistryUlongZ(keyHandle, L"EnableTransparency");
+ themesEnableTransparency = enableTransparency != ULONG_MAX ? !!enableTransparency : FALSE;
NtClose(keyHandle);
}
@@ -2069,30 +1977,26 @@ VOID PhInitializeSuperclassControls(
VOID
)
{
- PhDefaultEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");
+ // All acrylic effects works only if it enabled in system.
+ // Skip checking for PhIsThemeTransparencyEnabled() - if transparency disabled it will not affect the menu appearance.
+ PhEnableThemeAcrylicSupport = PhEnableThemeAcrylicSupport && PhEnableThemeSupport;
+ // But it will affect to window appearance (it will be opaque but with more brighter colors).
+ PhEnableThemeAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport && PhEnableThemeSupport && PhIsThemeTransparencyEnabled();
- if (PhEnableThemeAcrylicSupport && !PhEnableThemeSupport)
- PhEnableThemeAcrylicSupport = FALSE;
- if (PhEnableThemeAcrylicSupport)
- PhEnableThemeAcrylicSupport = PhIsThemeTransparencyEnabled();
+ // For early TaskDialog with PhStartupParameters.ShowOptions
+ PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
- if (PhEnableThemeSupport || PhDefaultEnableStreamerMode)
+ // Superclasses and detours now always installing that gives opportunity to flawlessly runtime theme switching.
+ // If theme is disabled they are just trampolined to original hooked procedures.
{
- if (WindowsVersion >= WINDOWS_11)
- {
- PhDefaultEnableThemeAcrylicWindowSupport = !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
- }
-
- PhDefaultEnableThemeAnimation = !!PhGetIntegerSetting(L"EnableThemeAnimation");
-
- PhRegisterDialogSuperClass();
- PhRegisterMenuSuperClass();
- PhRegisterRebarSuperClass();
- PhRegisterComboBoxSuperClass();
- PhRegisterStaticSuperClass();
- PhRegisterStatusBarSuperClass();
- PhRegisterEditSuperClass();
- PhRegisterHeaderSuperClass();
+ PhRegisterSuperClassCommon(L"#32770", PhDialogWindowHookProcedure, &PhDefaultDialogWindowProcedure);
+ PhRegisterSuperClassCommon(L"#32768", PhMenuWindowHookProcedure, &PhDefaultMenuWindowProcedure);
+ PhRegisterSuperClassCommon(REBARCLASSNAME, PhRebarWindowHookProcedure, &PhDefaultRebarWindowProcedure);
+ PhRegisterSuperClassCommon(WC_STATIC, PhStaticWindowHookProcedure, &PhDefaultStaticWindowProcedure);
+ PhRegisterSuperClassCommon(STATUSCLASSNAME, PhStatusBarWindowHookProcedure, &PhDefaultStatusbarWindowProcedure);
+ PhRegisterSuperClassCommon(WC_EDIT, PhEditWindowHookProcedure, &PhDefaultEditWindowProcedure);
+ PhRegisterSuperClassCommon(WC_HEADER, PhHeaderWindowHookProcedure, &PhDefaultHeaderWindowProcedure);
+ PhRegisterSuperClassCommon(TOOLTIPS_CLASS, PhToolTipWindowHookProcedure, &PhDefaultToolTipWindowProcedure);
PhRegisterDetoursHooks();
}
diff --git a/phlib/emenu.c b/phlib/emenu.c
index 2d0d3d7c971b..16bd1bac9ca9 100644
--- a/phlib/emenu.c
+++ b/phlib/emenu.c
@@ -615,23 +615,24 @@ VOID PhEMenuToHMenu2(
}
// Themes
- if (WindowsVersion < WINDOWS_10_19H2)
- {
- if (PhEnableThemeSupport)
- {
- SetFlag(menuItemInfo.fType, MFT_OWNERDRAW);
- }
- }
- else
- {
- if (FlagOn(item->Flags, PH_EMENU_MAINMENU))
- {
- if (PhEnableThemeSupport)
- {
- SetFlag(menuItemInfo.fType, MFT_OWNERDRAW);
- }
- }
- }
+ // Moved to theme.c PhInitializeWindowThemeMenu. Supports dynamic menu theme switching w/o program restart. (Dart Vanya)
+ //if (WindowsVersion < WINDOWS_10_19H2)
+ //{
+ // if (PhEnableThemeSupport)
+ // {
+ // SetFlag(menuItemInfo.fType, MFT_OWNERDRAW);
+ // }
+ //}
+ //else
+ //{
+ // if (FlagOn(item->Flags, PH_EMENU_MAINMENU))
+ // {
+ // if (PhEnableThemeSupport)
+ // {
+ // SetFlag(menuItemInfo.fType, MFT_OWNERDRAW);
+ // }
+ // }
+ //}
if (FlagOn(Flags, PH_EMENU_RIGHTORDER))
{
diff --git a/phlib/graph.c b/phlib/graph.c
index 01ba1d304e08..cb108e162ed8 100644
--- a/phlib/graph.c
+++ b/phlib/graph.c
@@ -1326,11 +1326,7 @@ LRESULT CALLBACK PhpGraphWndProc(
// Allow newlines (-1 doesn't work)
SendMessage(context->TooltipHandle, TTM_SETMAXTIPWIDTH, 0, MAXSHORT);
- if (PhEnableThemeSupport)
- {
- PhSetControlTheme(context->TooltipHandle, L"DarkMode_Explorer");
- //SendMessage(context->TooltipHandle, TTM_SETWINDOWTHEME, 0, (LPARAM)L"DarkMode_Explorer");
- }
+ // ToolTip theme is applied automatically by phlib delayhook.c (Dart Vanya)
}
else
{
diff --git a/phlib/guisup.c b/phlib/guisup.c
index f540326ba239..20847cc42a7c 100644
--- a/phlib/guisup.c
+++ b/phlib/guisup.c
@@ -76,6 +76,12 @@ static __typeof__(&DrawThemeBackground) DrawThemeBackground_I = NULL;
static __typeof__(&DrawThemeTextEx) DrawThemeTextEx_I = NULL;
static _AllowDarkModeForWindow AllowDarkModeForWindow_I = NULL; // Win10-RS5 (uxtheme.dll ordinal 133)
static _IsDarkModeAllowedForWindow IsDarkModeAllowedForWindow_I = NULL; // Win10-RS5 (uxtheme.dll ordinal 137)
+static _ShouldAppsUseDarkMode ShouldAppsUseDarkMode_I = NULL; // Win10-RS5 (uxtheme.dll ordinal 132)
+// Win10-RS5 (uxtheme.dll ordinal 135)
+// Win10 build 17763: AllowDarkModeForApp(BOOL)
+// Win10 build 18334: SetPreferredAppMode(enum PreferredAppMode)
+static _SetPreferredAppMode SetPreferredAppMode_I = NULL;
+static _FlushMenuThemes FlushMenuThemes_I = NULL;
static __typeof__(&GetDpiForMonitor) GetDpiForMonitor_I = NULL; // win81+
static __typeof__(&GetDpiForWindow) GetDpiForWindow_I = NULL; // win10rs1+
static __typeof__(&GetDpiForSystem) GetDpiForSystem_I = NULL; // win10rs1+
@@ -127,6 +133,9 @@ VOID PhGuiSupportInitialization(
{
AllowDarkModeForWindow_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 133);
IsDarkModeAllowedForWindow_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 137);
+ ShouldAppsUseDarkMode_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 132);
+ SetPreferredAppMode_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 135);
+ FlushMenuThemes_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 136);
}
}
@@ -610,6 +619,45 @@ BOOLEAN PhIsDarkModeAllowedForWindow(
return !!IsDarkModeAllowedForWindow_I(WindowHandle);
}
+BOOLEAN PhShouldAppsUseDarkMode(
+ VOID
+ )
+{
+ if (!ShouldAppsUseDarkMode_I)
+ return FALSE;
+
+ return !!ShouldAppsUseDarkMode_I();
+}
+
+BOOLEAN PhIsThemeSupportEnabled(
+ VOID
+ )
+{
+ return PhEnableThemeSupport;
+}
+
+PreferredAppMode PhSetPreferredAppMode(
+ _In_ PreferredAppMode AppMode
+ )
+{
+ if (!SetPreferredAppMode_I)
+ return PreferredAppModeDisabled;
+
+ PreferredAppMode prevMode = SetPreferredAppMode_I(AppMode);
+ PhFlushMenuThemes();
+ return prevMode;
+}
+
+VOID PhFlushMenuThemes(
+ VOID
+ )
+{
+ if (FlushMenuThemes_I)
+ {
+ FlushMenuThemes_I();
+ }
+}
+
// rev from EtwRundown.dll!EtwpLogDPISettingsInfo (dmex)
//LONG PhGetUserOrMachineDpi(
// VOID
@@ -1914,19 +1962,6 @@ LRESULT CALLBACK PhpGeneralPropSheetWndProc(
}
}
break;
- case WM_KEYDOWN: // forward key messages
- {
- HWND pageWindowHandle;
-
- if (pageWindowHandle = PropSheet_GetCurrentPageHwnd(hwnd))
- {
- if (SendMessage(pageWindowHandle, uMsg, wParam, lParam))
- {
- return TRUE;
- }
- }
- }
- break;
}
return CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
@@ -2013,6 +2048,17 @@ BOOLEAN PhModalPropertySheet(
if (!processed)
{
+ if (message.message == WM_KEYDOWN /*|| message.message == WM_KEYUP*/) // forward key messages
+ {
+ HWND pageWindowHandle;
+
+ if ((pageWindowHandle = PropSheet_GetCurrentPageHwnd(hwnd)) &&
+ SendMessage(pageWindowHandle, message.message, message.wParam, message.lParam))
+ {
+ continue;
+ }
+ }
+
if (!PropSheet_IsDialogMessage(hwnd, &message))
{
TranslateMessage(&message);
@@ -4557,14 +4603,15 @@ BOOLEAN PhSetWindowCompositionAttribute(
BOOLEAN PhSetWindowAcrylicCompositionColor(
_In_ HWND WindowHandle,
- _In_ ULONG GradientColor
+ _In_ ULONG GradientColor,
+ _In_ BOOLEAN Enable
)
{
ACCENT_POLICY policy =
{
- ACCENT_ENABLE_ACRYLICBLURBEHIND,
- ACCENT_WINDOWS11_LUMINOSITY | ACCENT_BORDER_ALL,
- GradientColor,
+ Enable ? ACCENT_ENABLE_ACRYLICBLURBEHIND : 0,
+ Enable ? ACCENT_WINDOWS11_LUMINOSITY | ACCENT_BORDER_ALL : 0,
+ Enable ? GradientColor : 0,
0
};
WINDOWCOMPOSITIONATTRIBUTEDATA attribute =
diff --git a/phlib/include/guisup.h b/phlib/include/guisup.h
index 040f032bf8b7..089295e16f5d 100644
--- a/phlib/include/guisup.h
+++ b/phlib/include/guisup.h
@@ -248,6 +248,57 @@ PhIsDarkModeAllowedForWindow(
_In_ HWND WindowHandle
);
+PHLIBAPI
+BOOLEAN
+NTAPI
+PhShouldAppsUseDarkMode(
+ VOID
+ );
+
+PHLIBAPI
+BOOLEAN
+NTAPI
+PhIsThemeSupportEnabled(
+ VOID
+ );
+
+typedef enum _PreferredAppMode
+{
+ PreferredAppModeDisabled,
+ PreferredAppModeDarkOnDark,
+ PreferredAppModeDarkAlways,
+ PreferredAppModeLightAlways,
+ PreferredAppModeMax
+} PreferredAppMode;
+
+PHLIBAPI
+PreferredAppMode
+NTAPI
+PhSetPreferredAppMode(
+ _In_ PreferredAppMode AppMode
+ );
+
+PHLIBAPI
+VOID
+NTAPI
+PhFlushMenuThemes(
+ VOID
+ );
+
+#define GETCLASSNAME_OR_NULL(WindowHandle, ClassName) if (!GetClassName(WindowHandle, ClassName, RTL_NUMBER_OF(ClassName))) ClassName[0] = UNICODE_NULL
+
+#define PH_THEME_SET_PREFFEREDAPPMODE(GeneralThemeSetting, UseWindowsThemeSetting) PhSetPreferredAppMode( \
+ PhGetIntegerSetting(GeneralThemeSetting) ? \
+ PhGetIntegerSetting(UseWindowsThemeSetting) ? PreferredAppModeDarkOnDark : PreferredAppModeDarkAlways : \
+ PreferredAppModeLightAlways)
+
+#define PH_THEME_GET_GENERAL_SWITCH(GeneralThemeSetting) PhGetIntegerSetting(GeneralThemeSetting) && PhShouldAppsUseDarkMode()
+
+#define HANDLE_COLORSCHEMECHANGE_MESSAGE(wParam, lParam, GeneralThemeSetting, UseWindowsThemeSetting) \
+ ((ULONG)wParam == 0 && PhEqualStringZ((PWSTR)lParam, L"ImmersiveColorSet", TRUE) && \
+ PhGetIntegerSetting(GeneralThemeSetting) && \
+ PhGetIntegerSetting(UseWindowsThemeSetting))
+
PHLIBAPI
BOOLEAN
NTAPI
@@ -674,6 +725,15 @@ PhFindListViewItemByParam(
_In_opt_ PVOID Param
);
+PHLIBAPI
+LONG
+NTAPI
+PhFindIListViewItemByParam(
+ _In_ IListView* ListView,
+ _In_ LONG StartIndex,
+ _In_opt_ PVOID Param
+ );
+
_Success_(return)
PHLIBAPI
BOOLEAN
@@ -721,6 +781,14 @@ PhRemoveListViewItem(
_In_ LONG Index
);
+PHLIBAPI
+VOID
+NTAPI
+PhRemoveIListViewItem(
+ _In_ IListView * ListView,
+ _In_ LONG Index
+ );
+
PHLIBAPI
VOID
NTAPI
@@ -730,6 +798,15 @@ PhSetListViewItemImageIndex(
_In_ LONG ImageIndex
);
+PHLIBAPI
+VOID
+NTAPI
+PhSetIListViewItemImageIndex(
+ _In_ IListView * ListView,
+ _In_ LONG Index,
+ _In_ LONG ImageIndex
+ );
+
PHLIBAPI
VOID
NTAPI
@@ -1713,6 +1790,39 @@ PhMakeColorBrighter(
return RGB(r, g, b);
}
+FORCEINLINE
+COLORREF
+PhMakeColorDarker(
+ _In_ COLORREF Color,
+ _In_ UCHAR Increment
+ )
+{
+ UCHAR r;
+ UCHAR g;
+ UCHAR b;
+
+ r = (UCHAR)Color;
+ g = (UCHAR)(Color >> 8);
+ b = (UCHAR)(Color >> 16);
+
+ if (r - Increment > 0)
+ r -= Increment;
+ else
+ r = 0;
+
+ if (g - Increment > 0)
+ g -= Increment;
+ else
+ g = 0;
+
+ if (b - Increment > 0)
+ b -= Increment;
+ else
+ b = 0;
+
+ return RGB(r, g, b);
+}
+
// Window support
typedef enum _PH_PLUGIN_WINDOW_EVENT_TYPE
@@ -2284,7 +2394,8 @@ BOOLEAN
NTAPI
PhSetWindowAcrylicCompositionColor(
_In_ HWND WindowHandle,
- _In_ ULONG GradientColor
+ _In_ ULONG GradientColor,
+ _In_ BOOLEAN Enable
);
PHLIBAPI
@@ -2389,6 +2500,9 @@ extern BOOLEAN PhEnableThemeSupport;
extern BOOLEAN PhEnableThemeAcrylicSupport;
extern BOOLEAN PhEnableThemeAcrylicWindowSupport;
extern BOOLEAN PhEnableThemeNativeButtons;
+extern BOOLEAN PhEnableThemeTabBorders;
+extern BOOLEAN PhEnableThemeAnimation;
+extern BOOLEAN PhEnableStreamerMode;
extern BOOLEAN PhEnableThemeListviewBorder;
extern COLORREF PhThemeWindowForegroundColor;
extern COLORREF PhThemeWindowBackgroundColor;
@@ -2401,6 +2515,13 @@ PHLIBAPI
VOID
NTAPI
PhInitializeWindowTheme(
+ _In_ HWND WindowHandle
+ );
+
+PHLIBAPI
+VOID
+NTAPI
+PhInitializeWindowThemeEx(
_In_ HWND WindowHandle,
_In_ BOOLEAN EnableThemeSupport
);
@@ -2408,15 +2529,15 @@ PhInitializeWindowTheme(
PHLIBAPI
VOID
NTAPI
-PhInitializeWindowThemeEx(
- _In_ HWND WindowHandle
+PhReInitializeTheme(
+ BOOLEAN EnableThemeSupport
);
PHLIBAPI
VOID
NTAPI
-PhReInitializeWindowTheme(
- _In_ HWND WindowHandle
+PhReInitializeStreamerMode(
+ BOOLEAN Enable
);
PHLIBAPI
@@ -2426,6 +2547,67 @@ PhInitializeThemeWindowFrame(
_In_ HWND WindowHandle
);
+PHLIBAPI
+VOID
+NTAPI
+PhInitializeThemeWindowFrameEx(
+ _In_ HWND WindowHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ );
+
+PHLIBAPI
+VOID
+NTAPI
+PhWindowThemeSetDarkMode(
+ _In_ HWND WindowHandle,
+ _In_ BOOLEAN EnableDarkMode
+ );
+
+PHLIBAPI
+VOID
+NTAPI
+PhInitializeWindowThemeMenu(
+ _In_ HWND WindowHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ );
+
+PHLIBAPI
+VOID
+NTAPI
+PhInitializeTreeNewTheme(
+ _In_ HWND TreeNewHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ );
+
+PHLIBAPI
+VOID
+NTAPI
+PhInitializeListViewTheme(
+ _In_ HWND ListViewHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ );
+
+PHLIBAPI
+VOID
+CALLBACK
+PhInitializeSuperclassControls(
+ VOID
+ );
+
+PHLIBAPI
+BOOLEAN
+NTAPI
+PhGetAppsUseLightTheme(
+ VOID
+ );
+
+PHLIBAPI
+BOOLEAN
+NTAPI
+PhIsThemeTransparencyEnabled(
+ VOID
+ );
+
PHLIBAPI
HBRUSH
NTAPI
@@ -2459,13 +2641,6 @@ PhThemeWindowMeasureItem(
_In_ PMEASUREITEMSTRUCT DrawInfo
);
-PHLIBAPI
-VOID
-NTAPI
-PhInitializeWindowThemeMainMenu(
- _In_ HMENU MenuHandle
- );
-
PHLIBAPI
LRESULT
CALLBACK
diff --git a/phlib/include/guisupp.h b/phlib/include/guisupp.h
index 65e6e85151cf..69ff6dc57d50 100644
--- a/phlib/include/guisupp.h
+++ b/phlib/include/guisupp.h
@@ -19,15 +19,68 @@ typedef HRESULT (WINAPI* _GetThemeClass)(
_In_ ULONG BufferLength
);
-typedef BOOL(WINAPI* _AllowDarkModeForWindow)(
+typedef HRESULT (WINAPI* _GetThemeColor)(
+ _In_ HTHEME hTheme,
+ _In_ LONG iPartId,
+ _In_ LONG iStateId,
+ _In_ LONG iPropId,
+ _Out_ COLORREF* pColor
+ );
+
+typedef HRESULT (WINAPI *_GetThemeInt)(
+ _In_ HTHEME hTheme,
+ _In_ LONG iPartId,
+ _In_ LONG iStateId,
+ _In_ LONG iPropId,
+ _Out_ LONG*piVal
+ );
+
+typedef HRESULT (WINAPI* _GetThemePartSize)(
+ _In_ HTHEME hTheme,
+ _In_opt_ HDC hdc,
+ _In_ LONG iPartId,
+ _In_ LONG iStateId,
+ _In_opt_ LPCRECT prc,
+ _In_ enum THEMESIZE eSize,
+ _Out_ SIZE* psz
+ );
+
+typedef BOOLEAN(WINAPI* _AllowDarkModeForWindow)(
_In_ HWND WindowHandle,
_In_ BOOL Enabled
);
-typedef BOOL(WINAPI* _IsDarkModeAllowedForWindow)(
+typedef BOOLEAN(WINAPI* _IsDarkModeAllowedForWindow)(
_In_ HWND WindowHandle
);
+typedef BOOLEAN(WINAPI* _ShouldAppsUseDarkMode)(
+ VOID
+ );
+
+typedef PreferredAppMode(WINAPI* _SetPreferredAppMode)(
+ _In_ PreferredAppMode AppMode
+ );
+
+typedef VOID(WINAPI* _FlushMenuThemes)(
+ VOID
+ );
+
+typedef HRESULT (WINAPI* _GetDpiForMonitor)(
+ _In_ HMONITOR hmonitor,
+ _In_ enum MONITOR_DPI_TYPE dpiType,
+ _Out_ PLONG dpiX,
+ _Out_ PLONG dpiY
+ );
+
+typedef LONG (WINAPI* _GetDpiForWindow)(
+ _In_ HWND hwnd
+ );
+
+typedef LONG (WINAPI* _GetDpiForSystem)(
+ VOID
+ );
+
typedef LONG (WINAPI* _GetDpiForSession)(
VOID
);
diff --git a/phlib/include/searchbox.h b/phlib/include/searchbox.h
index 48175c65d5d8..e4a394083dea 100644
--- a/phlib/include/searchbox.h
+++ b/phlib/include/searchbox.h
@@ -32,8 +32,12 @@ PhCreateSearchControlEx(
_In_ PVOID ImageBaseAddress,
_In_ PCWSTR SearchButtonResource,
_In_ PCWSTR SearchButtonActiveResource,
- _In_ PCWSTR CaseButtonResource,
_In_ PCWSTR RegexButtonResource,
+ _In_ PCWSTR CaseButtonResource,
+ _In_ PCWSTR SearchButtonResourceDark,
+ _In_ PCWSTR SearchButtonActiveResourceDark,
+ _In_ PCWSTR RegexButtonResourceDark,
+ _In_ PCWSTR CaseButtonResourceDark,
_In_ PCWSTR RegexSetting,
_In_ PCWSTR CaseSetting,
_In_ PPH_SEARCHCONTROL_CALLBACK Callback,
diff --git a/phlib/phlib.vcxproj b/phlib/phlib.vcxproj
index 8e888850a9cb..90059a25c81b 100644
--- a/phlib/phlib.vcxproj
+++ b/phlib/phlib.vcxproj
@@ -157,6 +157,7 @@
+
diff --git a/phlib/phlib.vcxproj.filters b/phlib/phlib.vcxproj.filters
index e5b141a9a20a..612cc9f2f8ee 100644
--- a/phlib/phlib.vcxproj.filters
+++ b/phlib/phlib.vcxproj.filters
@@ -439,5 +439,8 @@
Header Files
+
+ Source Files
+
\ No newline at end of file
diff --git a/phlib/searchbox.c b/phlib/searchbox.c
index ea182d89f4c9..93b74b834124 100644
--- a/phlib/searchbox.c
+++ b/phlib/searchbox.c
@@ -67,6 +67,10 @@ typedef struct _PH_SEARCHCONTROL_CONTEXT
PCWSTR SearchButtonActiveResource;
PCWSTR RegexButtonResource;
PCWSTR CaseButtonResource;
+ PCWSTR SearchButtonResourceDark;
+ PCWSTR SearchButtonActiveResourceDark;
+ PCWSTR RegexButtonResourceDark;
+ PCWSTR CaseButtonResourceDark;
PH_SEARCHCONTROL_BUTTON SearchButton;
PH_SEARCHCONTROL_BUTTON RegexButton;
@@ -230,7 +234,8 @@ VOID PhpSearchControlInitializeImages(
Context->SearchButton.ImageIndex = ULONG_MAX;
Context->SearchButton.ActiveImageIndex = ULONG_MAX;
- bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, Context->SearchButtonResource, L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
+ bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, PhEnableThemeSupport ? Context->SearchButtonResource : Context->SearchButtonResourceDark,
+ L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
if (bitmap)
{
Context->SearchButton.ImageIndex = 0;
@@ -238,7 +243,8 @@ VOID PhpSearchControlInitializeImages(
DeleteBitmap(bitmap);
}
- bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, Context->SearchButtonActiveResource, L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
+ bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, PhEnableThemeSupport ? Context->SearchButtonActiveResource : Context->SearchButtonActiveResourceDark,
+ L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
if (bitmap)
{
Context->SearchButton.ActiveImageIndex = 1;
@@ -250,7 +256,8 @@ VOID PhpSearchControlInitializeImages(
Context->RegexButton.ImageIndex = ULONG_MAX;
Context->RegexButton.ActiveImageIndex = ULONG_MAX;
- bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, Context->RegexButtonResource, L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
+ bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, PhEnableThemeSupport ? Context->RegexButtonResource : Context->RegexButtonResourceDark,
+ L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
if (bitmap)
{
Context->RegexButton.ImageIndex = 2;
@@ -262,7 +269,8 @@ VOID PhpSearchControlInitializeImages(
Context->CaseButton.ImageIndex = ULONG_MAX;
Context->CaseButton.ActiveImageIndex = ULONG_MAX;
- bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, Context->CaseButtonResource, L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
+ bitmap = PhLoadImageFormatFromResource(Context->ImageBaseAddress, PhEnableThemeSupport ? Context->CaseButtonResource : Context->CaseButtonResourceDark,
+ L"PNG", PH_IMAGE_FORMAT_TYPE_PNG, Context->ImageWidth, Context->ImageHeight);
if (bitmap)
{
Context->CaseButton.ImageIndex = 3;
@@ -1298,6 +1306,10 @@ VOID PhCreateSearchControlEx(
_In_ PCWSTR SearchButtonActiveResource,
_In_ PCWSTR RegexButtonResource,
_In_ PCWSTR CaseButtonResource,
+ _In_ PCWSTR SearchButtonResourceDark,
+ _In_ PCWSTR SearchButtonActiveResourceDark,
+ _In_ PCWSTR RegexButtonResourceDark,
+ _In_ PCWSTR CaseButtonResourceDark,
_In_ PCWSTR RegexSetting,
_In_ PCWSTR CaseSetting,
_In_ PPH_SEARCHCONTROL_CALLBACK Callback,
@@ -1319,6 +1331,10 @@ VOID PhCreateSearchControlEx(
context->SearchButtonActiveResource = SearchButtonActiveResource;
context->RegexButtonResource = RegexButtonResource;
context->CaseButtonResource = CaseButtonResource;
+ context->SearchButtonResourceDark = SearchButtonResourceDark;
+ context->SearchButtonActiveResourceDark = SearchButtonActiveResourceDark;
+ context->RegexButtonResourceDark = RegexButtonResourceDark;
+ context->CaseButtonResourceDark = CaseButtonResourceDark;
context->Callback = Callback;
context->CallbackContext = Context;
diff --git a/phlib/secedit.c b/phlib/secedit.c
index 4acee5e907ce..0df301c2b115 100644
--- a/phlib/secedit.c
+++ b/phlib/secedit.c
@@ -679,7 +679,7 @@ HRESULT STDMETHODCALLTYPE PhSecurityInformation_PropertySheetPageCallback(
if (!this->IsPage)
PhCenterWindow(GetParent(hwnd), GetParent(GetParent(hwnd)));
- PhInitializeWindowTheme(GetParent(hwnd), PhEnableThemeSupport);
+ PhInitializeWindowTheme(GetParent(hwnd));
}
return E_NOTIMPL;
diff --git a/phlib/theme.c b/phlib/theme.c
index aff86f0a12ea..7cf4f61ee82a 100644
--- a/phlib/theme.c
+++ b/phlib/theme.c
@@ -5,7 +5,8 @@
*
* Authors:
*
- * dmex 2018-2023
+ * dmex 2022-2023
+ * Dart Vanya 2024
*
*/
@@ -14,10 +15,12 @@
#include
#include
#include
+#include
#include
#include
#include
+#include
typedef struct _PHP_THEME_WINDOW_TAB_CONTEXT
{
@@ -63,10 +66,6 @@ BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows(
_In_ HWND WindowHandle,
_In_opt_ PVOID Context
);
-BOOLEAN CALLBACK PhpReInitializeThemeWindowEnumChildWindows(
- _In_ HWND WindowHandle,
- _In_opt_ PVOID Context
- );
LRESULT CALLBACK PhpThemeWindowSubclassProc(
_In_ HWND hWnd,
@@ -108,32 +107,16 @@ LRESULT CALLBACK PhpThemeWindowACLUISubclassProc(
_In_ LPARAM lParam
);
-// Win10-RS5 (uxtheme.dll ordinal 132)
-BOOL (WINAPI *ShouldAppsUseDarkMode_I)(
- VOID
- ) = NULL;
+VOID PhThemeUpdateWindowProcedure(
+ _In_ HWND WindowHandle,
+ _In_ WNDPROC SubclassProcedure,
+ _In_ BOOLEAN EnableThemeSupport
+ );
+
// Win10-RS5 (uxtheme.dll ordinal 138)
BOOL (WINAPI *ShouldSystemUseDarkMode_I)(
VOID
) = NULL;
-// Win10-RS5 (uxtheme.dll ordinal 136)
-BOOL (WINAPI* FlushMenuThemes_I)(
- VOID
- ) = NULL;
-
-typedef enum _PreferredAppMode
-{
- PreferredAppModeDisabled,
- PreferredAppModeDarkOnDark,
- PreferredAppModeDarkAlways
-} PreferredAppMode;
-
-// Win10-RS5 (uxtheme.dll ordinal 135)
-// Win10 build 17763: AllowDarkModeForApp(BOOL)
-// Win10 build 18334: SetPreferredAppMode(enum PreferredAppMode)
-BOOL (WINAPI* SetPreferredAppMode_I)(
- _In_ PreferredAppMode AppMode
- ) = NULL;
// Win10-RS5 (uxtheme.dll ordinal 139)
BOOL (WINAPI *IsDarkModeAllowedForApp_I)(
@@ -160,6 +143,9 @@ BOOLEAN PhEnableThemeSupport = FALSE;
BOOLEAN PhEnableThemeAcrylicSupport = FALSE;
BOOLEAN PhEnableThemeAcrylicWindowSupport = FALSE;
BOOLEAN PhEnableThemeNativeButtons = FALSE;
+BOOLEAN PhEnableThemeTabBorders = FALSE;
+BOOLEAN PhEnableThemeAnimation = FALSE;
+BOOLEAN PhEnableStreamerMode = FALSE;
BOOLEAN PhEnableThemeListviewBorder = FALSE;
HBRUSH PhThemeWindowBackgroundBrush = NULL;
COLORREF PhThemeWindowForegroundColor = RGB(28, 28, 28);
@@ -169,101 +155,63 @@ COLORREF PhThemeWindowHighlightColor = RGB(128, 128, 128);
COLORREF PhThemeWindowHighlight2Color = RGB(143, 143, 143);
COLORREF PhThemeWindowTextColor = RGB(255, 255, 255);
+#define PH_THEME_ALLOWED_PROP L"PhEnableThemeSupport"
+
+// This wrapper designed for general use from any places including plugins.
+// No need te explicitly pass PhEnableThemeSupport or PhIsThemeSupportEnabled()
VOID PhInitializeWindowTheme(
- _In_ HWND WindowHandle,
- _In_ BOOLEAN EnableThemeSupport
+ _In_ HWND WindowHandle
)
{
- if (EnableThemeSupport && WindowsVersion >= WINDOWS_10_RS5)
- {
- static PH_INITONCE initOnce = PH_INITONCE_INIT;
-
- if (PhBeginInitOnce(&initOnce))
- {
- if (WindowsVersion >= WINDOWS_10_19H2)
- {
- PVOID baseAddress;
-
- if (!(baseAddress = PhGetLoaderEntryDllBaseZ(L"uxtheme.dll")))
- baseAddress = PhLoadLibrary(L"uxtheme.dll");
-
- if (baseAddress)
- {
- SetPreferredAppMode_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 135);
- //FlushMenuThemes_I = PhGetDllBaseProcedureAddress(baseAddress, NULL, 136);
- }
+ SetProp(GetAncestor(WindowHandle, GA_ROOT), PH_THEME_ALLOWED_PROP, (HANDLE)TRUE); // HACK for PhReInitializeTheme
- if (SetPreferredAppMode_I)
- {
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // SetPreferredAppMode_I(PreferredAppModeDisabled);
- // break;
- //case 1: // Old colors
- SetPreferredAppMode_I(PreferredAppModeDarkAlways);
- }
-
- //if (FlushMenuThemes_I)
- // FlushMenuThemes_I();
- }
-
- PhEndInitOnce(&initOnce);
- }
+ if (PhEnableThemeSupport)
+ {
+ PhInitializeWindowThemeEx(WindowHandle, TRUE);
}
+}
- PhInitializeThemeWindowFrame(WindowHandle);
+VOID PhInitializeWindowThemeEx(
+ _In_ HWND WindowHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ )
+{
+ WCHAR windowClassName[MAX_PATH];
- if (!PhThemeWindowBackgroundBrush)
+ GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
+
+ if (PhEqualStringZ(windowClassName, PH_TREENEW_CLASSNAME, FALSE)) // HACK for dynamically generated plugin tabs
{
- //HBRUSH brush = PhThemeWindowBackgroundBrush;
- PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
- //if (brush) DeleteBrush(brush);
+ PhInitializeTreeNewTheme(WindowHandle, EnableThemeSupport);
}
-
- if (EnableThemeSupport)
+ else
{
- WNDPROC defaultWindowProc;
-
- defaultWindowProc = (WNDPROC)GetWindowLongPtr(WindowHandle, GWLP_WNDPROC);
+ PhInitializeThemeWindowFrameEx(WindowHandle, EnableThemeSupport);
- if (defaultWindowProc != PhpThemeWindowSubclassProc)
- {
- PhSetWindowContext(WindowHandle, LONG_MAX, defaultWindowProc);
- SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)PhpThemeWindowSubclassProc);
+ PhThemeUpdateWindowProcedure(WindowHandle, PhpThemeWindowSubclassProc, EnableThemeSupport);
- if (WindowsVersion >= WINDOWS_10_RS5)
- {
- WCHAR windowClassName[MAX_PATH];
- if (!GetClassName(WindowHandle, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
- if (PhEqualStringZ(windowClassName, L"PhTreeNew", FALSE) || PhEqualStringZ(windowClassName, WC_LISTVIEW, FALSE))
- PhAllowDarkModeForWindow(WindowHandle, TRUE); // HACK for dynamically generated plugin tabs
- }
- }
+ PhInitializeWindowThemeMenu(WindowHandle, EnableThemeSupport);
+ }
- PhEnumChildWindows(
- WindowHandle,
- 0x1000,
- PhpThemeWindowEnumChildWindows,
- NULL
- );
+ PhEnumChildWindows(
+ WindowHandle,
+ 0x1000,
+ PhpThemeWindowEnumChildWindows,
+ (PVOID)EnableThemeSupport
+ );
- InvalidateRect(WindowHandle, NULL, FALSE); // HACK
- }
- else
- {
- //EnableThemeDialogTexture(WindowHandle, ETDT_ENABLETAB);
- }
+ //InvalidateRect(WindowHandle, NULL, FALSE); // HACK
+ RedrawWindow(WindowHandle, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN /*| RDW_ERASENOW | RDW_UPDATENOW*/);
+ SendMessage(WindowHandle, WM_THEMECHANGED, 0, 0); // Redraws buttons background in dialogs
}
-VOID PhInitializeWindowThemeEx(
- _In_ HWND WindowHandle
+BOOLEAN PhGetAppsUseLightTheme(
+ VOID
)
{
static CONST PH_STRINGREF keyPath = PH_STRINGREF_INIT(L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
HANDLE keyHandle;
- BOOLEAN enableThemeSupport = FALSE;
+ BOOLEAN appsUseLightTheme = TRUE;
if (NT_SUCCESS(PhOpenKey(
&keyHandle,
@@ -273,102 +221,91 @@ VOID PhInitializeWindowThemeEx(
0
)))
{
- enableThemeSupport = !PhQueryRegistryUlongZ(keyHandle, L"AppsUseLightTheme");
+ appsUseLightTheme = !PhQueryRegistryUlongZ(keyHandle, L"AppsUseLightTheme");
NtClose(keyHandle);
}
- PhInitializeWindowTheme(WindowHandle, enableThemeSupport);
+ return appsUseLightTheme;
}
-VOID PhReInitializeWindowTheme(
- _In_ HWND WindowHandle
+VOID PhReInitializeTheme(
+ BOOLEAN EnableThemeSupport
)
{
HWND currentWindow = NULL;
- PhInitializeThemeWindowFrame(WindowHandle);
-
- if (!PhEnableThemeSupport)
- return;
-
- if (!PhThemeWindowBackgroundBrush)
+ while (currentWindow = FindWindowEx(NULL, currentWindow, NULL, NULL))
{
- //HBRUSH brush = PhThemeWindowBackgroundBrush;
- PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
- //if (brush) DeleteBrush(brush);
- }
+ CLIENT_ID clientId;
+ WCHAR windowClassName[MAX_PATH];
- PhEnumChildWindows(
- WindowHandle,
- 0x1000,
- PhpReInitializeThemeWindowEnumChildWindows,
- NULL
- );
-
- do
- {
- if (currentWindow = FindWindowEx(NULL, currentWindow, NULL, NULL))
+ if (NT_SUCCESS(PhGetWindowClientId(currentWindow, &clientId)) &&
+ clientId.UniqueProcess == NtCurrentProcessId())
{
- ULONG processID = 0;
+ GETCLASSNAME_OR_NULL(currentWindow, windowClassName);
- GetWindowThreadProcessId(currentWindow, &processID);
-
- if (UlongToHandle(processID) == NtCurrentProcessId())
+ if (PhEqualStringZ(windowClassName, TOOLTIPS_CLASS, FALSE))
{
- WCHAR windowClassName[MAX_PATH];
-
- if (!GetClassName(currentWindow, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
+ PhWindowThemeSetDarkMode(currentWindow, EnableThemeSupport); // handle tooltips
+ }
+ // Update theme on all theme-allowed System Informer windows.
+ else if (GetProp(currentWindow, PH_THEME_ALLOWED_PROP))
+ {
+ dprintf("PhReInitializeTheme: %S\r\n", windowClassName);
- //dprintf("PhReInitializeWindowTheme: %S\r\n", windowClassName);
+ PhInitializeWindowThemeEx(currentWindow, EnableThemeSupport);
+ }
+ }
+ }
+}
- if (currentWindow != WindowHandle)
- {
- if (PhEqualStringZ(windowClassName, L"#32770", FALSE))
- {
- PhEnumChildWindows(
- currentWindow,
- 0x1000,
- PhpReInitializeThemeWindowEnumChildWindows,
- NULL
- );
- //PhReInitializeWindowTheme(currentWindow);
- }
+VOID PhReInitializeStreamerMode(
+ BOOLEAN Enable
+ )
+{
+ HWND currentWindow = NULL;
- InvalidateRect(currentWindow, NULL, TRUE);
- }
+ while (currentWindow = FindWindowEx(NULL, currentWindow, NULL, NULL))
+ {
+ CLIENT_ID clientId;
+ WCHAR windowClassName[MAX_PATH];
+
+ if (NT_SUCCESS(PhGetWindowClientId(currentWindow, &clientId)) &&
+ clientId.UniqueProcess == NtCurrentProcessId())
+ {
+ GETCLASSNAME_OR_NULL(currentWindow, windowClassName);
+
+ if ((PhGetWindowStyle(currentWindow) & WS_VISIBLE) == WS_VISIBLE ||
+ PhEqualStringZ(windowClassName, TOOLTIPS_CLASS, FALSE)
+ //|| PhEqualStringZ(windowClassName, L"ComboLBox", FALSE)
+ )
+ {
+ SetWindowDisplayAffinity(currentWindow, Enable ? WDA_EXCLUDEFROMCAPTURE : WDA_NONE);
}
}
- } while (currentWindow);
-
- InvalidateRect(WindowHandle, NULL, FALSE);
+ }
}
#define DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 19
-#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
-#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
-#endif
-#ifndef DWMWA_CAPTION_COLOR
-#define DWMWA_CAPTION_COLOR 35
-#endif
-#ifndef DWMWA_SYSTEMBACKDROP_TYPE
-#define DWMWA_SYSTEMBACKDROP_TYPE 38
-#endif
+//#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
+//#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
+//#endif
+//#ifndef DWMWA_CAPTION_COLOR
+//#define DWMWA_CAPTION_COLOR 35
+//#endif
+//#ifndef DWMWA_SYSTEMBACKDROP_TYPE
+//#define DWMWA_SYSTEMBACKDROP_TYPE 38
+//#endif
HRESULT PhSetWindowThemeAttribute(
_In_ HWND WindowHandle,
- _In_ ULONG AttributeId,
- _In_reads_bytes_(AttributeLength) PVOID Attribute,
- _In_ ULONG AttributeLength
+ _In_ DWORD AttributeId,
+ _In_reads_bytes_(AttributeLength) LPCVOID Attribute,
+ _In_ DWORD AttributeLength
)
{
static PH_INITONCE initOnce = PH_INITONCE_INIT;
- static HRESULT (WINAPI* DwmSetWindowAttribute_I)(
- _In_ HWND WindowHandle,
- _In_ ULONG AttributeId,
- _In_reads_bytes_(AttributeLength) PVOID Attribute,
- _In_ ULONG AttributeLength
- );
+ static __typeof__(&DwmSetWindowAttribute) DwmSetWindowAttribute_I = NULL;
if (PhBeginInitOnce(&initOnce))
{
@@ -392,49 +329,35 @@ VOID PhInitializeThemeWindowFrame(
_In_ HWND WindowHandle
)
{
- if (WindowsVersion >= WINDOWS_10_RS5)
+ if (PhEnableThemeSupport)
{
- BOOL boolAttribute;
- ULONG ulongAttribute;
+ PhInitializeThemeWindowFrameEx(WindowHandle, TRUE);
+ }
+}
- if (PhEnableThemeSupport)
+VOID PhInitializeThemeWindowFrameEx(
+ _In_ HWND WindowHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ )
+{
+ if (WindowsVersion >= WINDOWS_10_RS5)
+ {
+ if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &(BOOL){ EnableThemeSupport }, sizeof(BOOL))))
{
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // {
- // boolAttribute = FALSE;
- //
- // if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &boolAttribute, sizeof(BOOL))))
- // {
- // PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &boolAttribute, sizeof(BOOL));
- // }
- //
- // //if (WindowsVersion > WINDOWS_11)
- // //{
- // // PhSetWindowThemeAttribute(WindowHandle, DWMWA_CAPTION_COLOR, NULL, 0);
- // //}
- // }
- // break;
- //case 1: // Old colors
-
- boolAttribute = TRUE;
+ PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &(BOOL){ EnableThemeSupport }, sizeof(BOOL));
+ }
- if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &boolAttribute, sizeof(BOOL))))
- {
- PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &boolAttribute, sizeof(BOOL));
- }
+ if (WindowsVersion >= WINDOWS_11)
+ {
+ PhSetWindowThemeAttribute(WindowHandle, DWMWA_CAPTION_COLOR, &(COLORREF){ EnableThemeSupport ? PhThemeWindowBackgroundColor : DWMWA_COLOR_DEFAULT },
+ sizeof(COLORREF));
- if (WindowsVersion >= WINDOWS_11)
- {
- PhSetWindowThemeAttribute(WindowHandle, DWMWA_CAPTION_COLOR, &PhThemeWindowBackgroundColor, sizeof(COLORREF));
- }
+ PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)), PhEnableThemeAcrylicWindowSupport);
}
if (WindowsVersion >= WINDOWS_11_22H2)
{
- ulongAttribute = 1;
- PhSetWindowThemeAttribute(WindowHandle, DWMWA_SYSTEMBACKDROP_TYPE, &ulongAttribute, sizeof(ULONG));
+ PhSetWindowThemeAttribute(WindowHandle, DWMWA_SYSTEMBACKDROP_TYPE, &(ULONG){ EnableThemeSupport ? DWMSBT_NONE : DWMSBT_AUTO }, sizeof(ULONG));
}
}
}
@@ -444,20 +367,16 @@ VOID PhWindowThemeSetDarkMode(
_In_ BOOLEAN EnableDarkMode
)
{
- //BOOL boolAttribute;
-
- if (EnableDarkMode && PhEnableThemeSupport) // ShouldAppsUseDarkMode_I()
+ if (EnableDarkMode)
{
PhSetControlTheme(WindowHandle, L"DarkMode_Explorer");
//PhSetControlTheme(WindowHandle, L"DarkMode_ItemsView");
//if (WindowsVersion >= WINDOWS_11)
//{
- // boolAttribute = TRUE;
- //
- // if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &boolAttribute, sizeof(BOOL))))
+ // if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &(BOOL){ TRUE }, sizeof(BOOL))))
// {
- // PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &boolAttribute, sizeof(BOOL));
+ // PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &(BOOL){ TRUE }, sizeof(BOOL));
// }
//}
}
@@ -468,16 +387,43 @@ VOID PhWindowThemeSetDarkMode(
//if (WindowsVersion >= WINDOWS_11)
//{
- // boolAttribute = FALSE;
- //
- // if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &boolAttribute, sizeof(BOOL))))
+ // if (FAILED(PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE, &(BOOL){ FALSE }, sizeof(BOOL))))
// {
- // PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &boolAttribute, sizeof(BOOL));
+ // PhSetWindowThemeAttribute(WindowHandle, DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, &(BOOL){ FALSE }, sizeof(BOOL));
// }
//}
}
}
+VOID PhThemeUpdateWindowProcedure(
+ _In_ HWND WindowHandle,
+ _In_ WNDPROC SubclassProcedure,
+ _In_ BOOLEAN EnableThemeSupport
+ )
+{
+ WNDPROC currentWindowProc;
+ WNDPROC defaultWindowProc;
+
+ defaultWindowProc = (WNDPROC)PhGetWindowContext(WindowHandle, LONG_MAX);
+
+ if (EnableThemeSupport)
+ {
+ if ((currentWindowProc = PhGetWindowProcedure(WindowHandle)) != SubclassProcedure)
+ {
+ PhSetWindowContext(WindowHandle, LONG_MAX, currentWindowProc);
+ PhSetWindowProcedure(WindowHandle, SubclassProcedure);
+ }
+ }
+ else
+ {
+ if (defaultWindowProc)
+ {
+ PhRemoveWindowContext(WindowHandle, LONG_MAX);
+ PhSetWindowProcedure(WindowHandle, defaultWindowProc);
+ }
+ }
+}
+
HBRUSH PhWindowThemeControlColor(
_In_ HWND WindowHandle,
_In_ HDC Hdc,
@@ -494,7 +440,7 @@ HBRUSH PhWindowThemeControlColor(
if (PhEnableThemeSupport)
{
SetTextColor(Hdc, PhThemeWindowTextColor);
- SetDCBrushColor(Hdc, RGB(60, 60, 60));
+ SetDCBrushColor(Hdc, PhMakeColorBrighter(PhThemeWindowBackgroundColor, 17)); // RGB(60, 60, 60)
return PhGetStockBrush(DC_BRUSH);
}
else
@@ -578,96 +524,147 @@ VOID PhWindowThemeMainMenuBorder(
}
VOID PhInitializeThemeWindowTabControl(
- _In_ HWND TabControlWindow
+ _In_ HWND TabControlWindow,
+ _In_ BOOLEAN EnableThemeSupport
)
{
PPHP_THEME_WINDOW_TAB_CONTEXT context;
+ WNDPROC currentWindowProc;
- context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_TAB_CONTEXT));
- context->DefaultWindowProc = (WNDPROC)GetWindowLongPtr(TabControlWindow, GWLP_WNDPROC);
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
+ context = (PPHP_THEME_WINDOW_TAB_CONTEXT)PhGetWindowContext(TabControlWindow, LONG_MAX);
- PhSetWindowContext(TabControlWindow, LONG_MAX, context);
- SetWindowLongPtr(TabControlWindow, GWLP_WNDPROC, (LONG_PTR)PhpThemeWindowTabControlWndSubclassProc);
+ if (EnableThemeSupport)
+ {
+ if (!context && (currentWindowProc = PhGetWindowProcedure(TabControlWindow)) != PhpThemeWindowTabControlWndSubclassProc)
+ {
+ context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_TAB_CONTEXT));
+ context->DefaultWindowProc = currentWindowProc;
+ context->CursorPos.x = LONG_MIN;
+ context->CursorPos.y = LONG_MIN;
- InvalidateRect(TabControlWindow, NULL, FALSE);
+ PhSetWindowContext(TabControlWindow, LONG_MAX, context);
+ PhSetWindowProcedure(TabControlWindow, PhpThemeWindowTabControlWndSubclassProc);
+ }
+ }
+ else
+ {
+ if (context && context->DefaultWindowProc)
+ {
+ PhRemoveWindowContext(TabControlWindow, LONG_MAX);
+ PhSetWindowProcedure(TabControlWindow, context->DefaultWindowProc);
+ PhFree(context);
+ }
+ }
}
-VOID PhInitializeThemeWindowGroupBox(
- _In_ HWND GroupBoxHandle
+VOID PhInitializeWindowThemeMenu(
+ _In_ HWND WindowHandle,
+ _In_ BOOLEAN EnableThemeSupport
)
{
- WNDPROC groupboxWindowProc;
+ HMENU menuHandle;
- groupboxWindowProc = (WNDPROC)GetWindowLongPtr(GroupBoxHandle, GWLP_WNDPROC);
- PhSetWindowContext(GroupBoxHandle, LONG_MAX, groupboxWindowProc);
- SetWindowLongPtr(GroupBoxHandle, GWLP_WNDPROC, (LONG_PTR)PhpThemeWindowGroupBoxSubclassProc);
+ if (menuHandle = GetMenu(WindowHandle))
+ {
+ MENUINFO menuInfo;
+ MENUITEMINFO menuItemInfo;
- InvalidateRect(GroupBoxHandle, NULL, FALSE);
-}
+ memset(&menuInfo, 0, sizeof(MENUINFO));
+ menuInfo.cbSize = sizeof(MENUINFO);
+ menuInfo.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS;
+ menuInfo.hbrBack = EnableThemeSupport ? PhThemeWindowBackgroundBrush : NULL;
-VOID PhInitializeWindowThemeMainMenu(
- _In_ HMENU MenuHandle
- )
-{
- MENUINFO menuInfo;
+ SetMenuInfo(menuHandle, &menuInfo);
- if (!PhEnableThemeSupport)
- return;
+ memset(&menuItemInfo, 0, sizeof(MENUITEMINFO));
+ menuItemInfo.cbSize = sizeof(MENUITEMINFO);
+ menuItemInfo.fMask = MIIM_FTYPE;
- memset(&menuInfo, 0, sizeof(MENUINFO));
- menuInfo.cbSize = sizeof(MENUINFO);
- menuInfo.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS;
- menuInfo.hbrBack = PhThemeWindowBackgroundBrush;
+ for (INT i = 0; i < GetMenuItemCount(menuHandle); i++)
+ {
+ GetMenuItemInfo(menuHandle, i, TRUE, &menuItemInfo);
+ if (EnableThemeSupport)
+ SetFlag(menuItemInfo.fType, MFT_OWNERDRAW);
+ else
+ ClearFlag(menuItemInfo.fType, MFT_OWNERDRAW);
+ SetMenuItemInfo(menuHandle, i, TRUE, &menuItemInfo);
+ }
- SetMenuInfo(MenuHandle, &menuInfo);
+ DrawMenuBar(WindowHandle);
+ }
}
VOID PhInitializeWindowThemeListboxControl(
- _In_ HWND ListBoxControl
+ _In_ HWND ListBoxControl,
+ _In_ BOOLEAN EnableThemeSupport
)
{
PPHP_THEME_WINDOW_STATUSBAR_CONTEXT context;
+ WNDPROC currentWindowProc;
+
+ context = (PPHP_THEME_WINDOW_STATUSBAR_CONTEXT)PhGetWindowContext(ListBoxControl, LONG_MAX);
- context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_STATUSBAR_CONTEXT));
- context->DefaultWindowProc = (WNDPROC)GetWindowLongPtr(ListBoxControl, GWLP_WNDPROC);
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
+ if (EnableThemeSupport)
+ {
+ if (!context && (currentWindowProc = PhGetWindowProcedure(ListBoxControl)) != PhpThemeWindowListBoxControlSubclassProc)
+ {
+ context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_STATUSBAR_CONTEXT));
+ context->DefaultWindowProc = currentWindowProc;
+ context->CursorPos.x = LONG_MIN;
+ context->CursorPos.y = LONG_MIN;
- PhSetWindowContext(ListBoxControl, LONG_MAX, context);
- SetWindowLongPtr(ListBoxControl, GWLP_WNDPROC, (LONG_PTR)PhpThemeWindowListBoxControlSubclassProc);
+ PhSetWindowContext(ListBoxControl, LONG_MAX, context);
+ PhSetWindowProcedure(ListBoxControl, PhpThemeWindowListBoxControlSubclassProc);
+ }
+ }
+ else
+ {
+ if (context && context->DefaultWindowProc)
+ {
+ PhRemoveWindowContext(ListBoxControl, LONG_MAX);
+ PhSetWindowProcedure(ListBoxControl, context->DefaultWindowProc);
+ PhFree(context);
+ }
+ }
- InvalidateRect(ListBoxControl, NULL, FALSE);
SetWindowPos(ListBoxControl, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
}
VOID PhInitializeWindowThemeComboboxControl(
- _In_ HWND ComboBoxControl
+ _In_ HWND ComboBoxControl,
+ _In_ BOOLEAN EnableThemeSupport
)
{
PPHP_THEME_WINDOW_COMBO_CONTEXT context;
+ WNDPROC currentWindowProc;
- context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_COMBO_CONTEXT));
- context->DefaultWindowProc = (WNDPROC)GetWindowLongPtr(ComboBoxControl, GWLP_WNDPROC);
- context->ThemeHandle = PhOpenThemeData(ComboBoxControl, VSCLASS_COMBOBOX, PhGetWindowDpi(ComboBoxControl));
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
+ context = (PPHP_THEME_WINDOW_COMBO_CONTEXT)PhGetWindowContext(ComboBoxControl, LONG_MAX);
- PhSetWindowContext(ComboBoxControl, LONG_MAX, context);
- SetWindowLongPtr(ComboBoxControl, GWLP_WNDPROC, (LONG_PTR)PhpThemeWindowComboBoxControlSubclassProc);
-
- InvalidateRect(ComboBoxControl, NULL, FALSE);
-}
-
-VOID PhInitializeWindowThemeACLUI(
- _In_ HWND ACLUIControl
-)
-{
- PhSetWindowContext(ACLUIControl, LONG_MAX, (PVOID)GetWindowLongPtr(ACLUIControl, GWLP_WNDPROC));
- SetWindowLongPtr(ACLUIControl, GWLP_WNDPROC, (LONG_PTR)PhpThemeWindowACLUISubclassProc);
+ if (EnableThemeSupport)
+ {
+ if (!context && (currentWindowProc = PhGetWindowProcedure(ComboBoxControl)) != PhpThemeWindowComboBoxControlSubclassProc)
+ {
+ context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_COMBO_CONTEXT));
+ context->DefaultWindowProc = currentWindowProc;
+ context->ThemeHandle = PhOpenThemeData(ComboBoxControl, VSCLASS_COMBOBOX, PhGetWindowDpi(ComboBoxControl));
+ context->CursorPos.x = LONG_MIN;
+ context->CursorPos.y = LONG_MIN;
- InvalidateRect(ACLUIControl, NULL, FALSE);
+ PhSetWindowContext(ComboBoxControl, LONG_MAX, context);
+ PhSetWindowProcedure(ComboBoxControl, PhpThemeWindowComboBoxControlSubclassProc);
+ }
+ }
+ else
+ {
+ if (context && context->DefaultWindowProc)
+ {
+ PhRemoveWindowContext(ComboBoxControl, LONG_MAX);
+ PhSetWindowProcedure(ComboBoxControl, context->DefaultWindowProc);
+ if (context->ThemeHandle)
+ PhCloseThemeData(context->ThemeHandle);
+ PhFree(context);
+ }
+ }
}
BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows(
@@ -676,168 +673,79 @@ BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows(
)
{
WCHAR windowClassName[MAX_PATH];
+ BOOLEAN enableThemeSupport = !!Context;
PhEnumChildWindows(
WindowHandle,
0x1000,
PhpThemeWindowEnumChildWindows,
- NULL
+ Context
);
- if (PhGetWindowContext(WindowHandle, LONG_MAX)) // HACK
+ if (enableThemeSupport && PhGetWindowContext(WindowHandle, LONG_MAX)) // HACK
return TRUE;
- if (!GetClassName(WindowHandle, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
+ GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
//dprintf("PhpThemeWindowEnumChildWindows: %S\r\n", windowClassName);
if (PhEqualStringZ(windowClassName, L"#32770", TRUE))
{
- PhInitializeWindowTheme(WindowHandle, TRUE);
+ PhInitializeWindowThemeEx(WindowHandle, enableThemeSupport);
}
else if (PhEqualStringZ(windowClassName, WC_BUTTON, FALSE))
{
- LONG_PTR style = PhGetWindowStyle(WindowHandle);
- if ((style & BS_GROUPBOX) == BS_GROUPBOX)
+ if ((PhGetWindowStyle(WindowHandle) & BS_GROUPBOX) == BS_GROUPBOX)
{
- PhInitializeThemeWindowGroupBox(WindowHandle);
+ PhThemeUpdateWindowProcedure(WindowHandle, PhpThemeWindowGroupBoxSubclassProc, enableThemeSupport);
}
else // apply theme for CheckBox, Radio (Dart Vanya)
{
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
}
else if (PhEqualStringZ(windowClassName, WC_TABCONTROL, FALSE))
{
- PhInitializeThemeWindowTabControl(WindowHandle);
+ PhInitializeThemeWindowTabControl(WindowHandle, enableThemeSupport);
}
else if (PhEqualStringZ(windowClassName, WC_SCROLLBAR, FALSE))
{
if (WindowsVersion >= WINDOWS_10_RS5)
{
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhWindowThemeSetDarkMode(WindowHandle, FALSE);
- // break;
- //case 1: // Old colors
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
}
else if (PhEqualStringZ(windowClassName, WC_LISTVIEW, FALSE))
{
- if (WindowsVersion >= WINDOWS_10_RS5)
- {
- HWND tooltipWindow = ListView_GetToolTips(WindowHandle);
-
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhSetControlTheme(WindowHandle, L"explorer");
- // PhSetControlTheme(tooltipWindow, L"");
- // break;
- //case 1: // Old colors
- //PhWindowThemeSetDarkMode(WindowHandle, TRUE);
- PhAllowDarkModeForWindow(WindowHandle, TRUE);
- PhSetControlTheme(WindowHandle, L"DarkMode_ItemsView");
- PhWindowThemeSetDarkMode(tooltipWindow, TRUE);
- }
-
- if (PhEnableThemeListviewBorder)
- {
- PhSetWindowStyle(WindowHandle, WS_BORDER, WS_BORDER);
- PhSetWindowExStyle(WindowHandle, WS_EX_CLIENTEDGE, WS_EX_CLIENTEDGE);
- }
- else
- {
- PhSetWindowStyle(WindowHandle, WS_BORDER, 0);
- PhSetWindowExStyle(WindowHandle, WS_EX_CLIENTEDGE, 0);
- }
-
- SetWindowPos(WindowHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
-
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // ListView_SetBkColor(WindowHandle, RGB(0xff, 0xff, 0xff));
- // ListView_SetTextBkColor(WindowHandle, RGB(0xff, 0xff, 0xff));
- // ListView_SetTextColor(WindowHandle, RGB(0x0, 0x0, 0x0));
- // break;
- //case 1: // Old colors
- ListView_SetBkColor(WindowHandle, PhThemeWindowBackgroundColor); // RGB(30, 30, 30)
- ListView_SetTextBkColor(WindowHandle, PhThemeWindowBackgroundColor); // RGB(30, 30, 30)
- ListView_SetTextColor(WindowHandle, PhThemeWindowTextColor);
+ PhInitializeListViewTheme(WindowHandle, enableThemeSupport);
}
else if (PhEqualStringZ(windowClassName, WC_TREEVIEW, FALSE))
{
if (WindowsVersion >= WINDOWS_10_RS5)
{
- HWND tooltipWindow = TreeView_GetToolTips(WindowHandle);
-
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
- PhWindowThemeSetDarkMode(tooltipWindow, TRUE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
+ // ToolTip theme is applied automatically by phlib delayhook.c (Dart Vanya)
}
- TreeView_SetBkColor(WindowHandle, PhThemeWindowBackgroundColor);// RGB(30, 30, 30));
- //TreeView_SetTextBkColor(WindowHandle, RGB(30, 30, 30));
- TreeView_SetTextColor(WindowHandle, PhThemeWindowTextColor);
- //InvalidateRect(WindowHandle, NULL, FALSE);
+ TreeView_SetBkColor(WindowHandle, enableThemeSupport ? PhThemeWindowBackgroundColor : GetSysColor(COLOR_WINDOW));// RGB(30, 30, 30));
+ //TreeView_SetTextBkColor(WindowHandle, enableThemeSupport ? PhThemeWindowBackgroundColor : GetSysColor(COLOR_WINDOW));
+ TreeView_SetTextColor(WindowHandle, enableThemeSupport ? PhThemeWindowTextColor : GetSysColor(COLOR_WINDOWTEXT));
}
else if (PhEqualStringZ(windowClassName, L"RICHEDIT50W", FALSE))
{
- if (PhEnableThemeListviewBorder)
- PhSetWindowStyle(WindowHandle, WS_BORDER, WS_BORDER);
- else
- PhSetWindowStyle(WindowHandle, WS_BORDER, 0);
+ CHARFORMAT cf = { sizeof(CHARFORMAT) };
+ cf.dwMask = CFM_COLOR;
+ cf.dwEffects = enableThemeSupport ? 0 : CFE_AUTOCOLOR;
+ if (enableThemeSupport) cf.crTextColor = PhThemeWindowTextColor;
- SetWindowPos(WindowHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
+ SendMessage(WindowHandle, EM_SETBKGNDCOLOR, 0, enableThemeSupport ? PhMakeColorBrighter(PhThemeWindowForegroundColor, 2) : GetSysColor(COLOR_WINDOW)); // RGB(30, 30, 30)
+ SendMessage(WindowHandle, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf);
- #define EM_SETBKGNDCOLOR (WM_USER + 67)
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // SendMessage(WindowHandle, EM_SETBKGNDCOLOR, 0, RGB(0xff, 0xff, 0xff));
- // break;
- //case 1: // Old colors
- SendMessage(WindowHandle, EM_SETBKGNDCOLOR, 0, RGB(30, 30, 30));
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
- //InvalidateRect(WindowHandle, NULL, FALSE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
- else if (PhEqualStringZ(windowClassName, L"PhTreeNew", FALSE))
+ else if (PhEqualStringZ(windowClassName, PH_TREENEW_CLASSNAME, FALSE))
{
- if (WindowsVersion >= WINDOWS_10_RS5)
- {
- HWND tooltipWindow = TreeNew_GetTooltips(WindowHandle);
-
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhSetControlTheme(tooltipWindow, L"");
- // PhSetControlTheme(WindowHandle, L"");
- // break;
- //case 1: // Old colors
- PhWindowThemeSetDarkMode(tooltipWindow, TRUE);
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
- PhAllowDarkModeForWindow(WindowHandle, TRUE);
- }
-
- if (PhEnableThemeListviewBorder)
- PhSetWindowExStyle(WindowHandle, WS_EX_CLIENTEDGE, WS_EX_CLIENTEDGE);
- else
- PhSetWindowExStyle(WindowHandle, WS_EX_CLIENTEDGE, 0);
-
- SetWindowPos(WindowHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
-
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // TreeNew_ThemeSupport(WindowHandle, FALSE);
- // break;
- //case 1: // Old colors
- TreeNew_ThemeSupport(WindowHandle, TRUE);
-
- //InvalidateRect(WindowHandle, NULL, TRUE);
+ PhInitializeTreeNewTheme(WindowHandle, enableThemeSupport);
}
else if (
PhEqualStringZ(windowClassName, WC_LISTBOX, FALSE) ||
@@ -846,16 +754,10 @@ BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows(
{
if (WindowsVersion >= WINDOWS_10_RS5)
{
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhSetControlTheme(WindowHandle, L"explorer");
- // break;
- //case 1: // Old colors
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
- PhInitializeWindowThemeListboxControl(WindowHandle);
+ PhInitializeWindowThemeListboxControl(WindowHandle, enableThemeSupport);
}
else if (PhEqualStringZ(windowClassName, WC_COMBOBOX, FALSE))
{
@@ -870,122 +772,111 @@ BOOLEAN CALLBACK PhpThemeWindowEnumChildWindows(
if (info.hwndList)
{
- PhWindowThemeSetDarkMode(info.hwndList, TRUE);
+ PhWindowThemeSetDarkMode(info.hwndList, enableThemeSupport);
}
}
//if ((PhGetWindowStyle(WindowHandle) & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST)
{
- PhInitializeWindowThemeComboboxControl(WindowHandle);
+ PhInitializeWindowThemeComboboxControl(WindowHandle, enableThemeSupport);
}
}
else if (PhEqualStringZ(windowClassName, L"CHECKLIST_ACLUI", FALSE))
{
if (WindowsVersion >= WINDOWS_10_RS5)
{
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhSetControlTheme(WindowHandle, L"explorer");
- // break;
- //case 1: // Old colors
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
- PhInitializeWindowThemeACLUI(WindowHandle);
+ PhThemeUpdateWindowProcedure(WindowHandle, PhpThemeWindowACLUISubclassProc, enableThemeSupport);
}
else if (PhEqualStringZ(windowClassName, WC_EDIT, FALSE))
{
// Fix scrollbar on multiline edit (Dart Vanya)
- if (GetWindowLongPtr(WindowHandle, GWL_STYLE) & ES_MULTILINE)
+ if ((PhGetWindowStyle(WindowHandle) & ES_MULTILINE) == ES_MULTILINE)
{
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
+ else if (PhGetWindowContext(WindowHandle, SHRT_MAX)) // HACK
+ {
+ SendMessage(WindowHandle, WM_THEMECHANGED, 0, 0); // searchbox.c
+ }
+
+ PhAllowDarkModeForWindow(WindowHandle, enableThemeSupport); // fix for unsupported system dialogs (ex. Advanced Security)
}
- else if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
+ else if (PhEqualStringZ(windowClassName, WC_LINK, FALSE)) // SysLink theme support (Dart Vanya)
{
- // SysLink theme support (Dart Vanya)
- PhAllowDarkModeForWindow(WindowHandle, TRUE);
+ PhAllowDarkModeForWindow(WindowHandle, enableThemeSupport);
+ }
+ else if (PhEqualStringZ(windowClassName, L"DirectUIHWND", FALSE)) // TaskDialog
+ {
+ PhWindowThemeSetDarkMode(WindowHandle, enableThemeSupport);
}
return TRUE;
}
-BOOLEAN CALLBACK PhpReInitializeThemeWindowEnumChildWindows(
- _In_ HWND WindowHandle,
- _In_opt_ PVOID Context
+VOID PhInitializeTreeNewTheme(
+ _In_ HWND TreeNewHandle,
+ _In_ BOOLEAN EnableThemeSupport
)
{
- WCHAR windowClassName[MAX_PATH];
+ if (WindowsVersion >= WINDOWS_10_RS5)
+ {
+ HWND headerHandle = TreeNew_GetHeader(TreeNewHandle);
+ HWND fixedHeaderHandle = TreeNew_GetFixedHeader(TreeNewHandle);
+
+ PhAllowDarkModeForWindow(TreeNewHandle, EnableThemeSupport);
+ PhWindowThemeSetDarkMode(TreeNewHandle, EnableThemeSupport);
+ if (headerHandle)
+ PhSetControlTheme(headerHandle, EnableThemeSupport ? L"DarkMode_ItemsView" : L"Explorer");
+ if (fixedHeaderHandle)
+ PhSetControlTheme(fixedHeaderHandle, EnableThemeSupport ? L"DarkMode_ItemsView" : L"Explorer");
+ // ToolTip theme is applied automatically by phlib delayhook.c (Dart Vanya)
+ }
- PhEnumChildWindows(
- WindowHandle,
- 0x1000,
- PhpReInitializeThemeWindowEnumChildWindows,
- NULL
- );
+ if (EnableThemeSupport)
+ {
+ PhSetWindowStyle(TreeNewHandle, WS_BORDER, !PhEnableThemeListviewBorder ? 0 : WS_BORDER);
+ PhSetWindowExStyle(TreeNewHandle, WS_EX_CLIENTEDGE, 0);
+ }
- if (!GetClassName(WindowHandle, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
+ SetWindowPos(TreeNewHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
- if (PhEqualStringZ(windowClassName, WC_LISTVIEW, FALSE))
- {
- if (WindowsVersion >= WINDOWS_10_RS5)
- {
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhSetControlTheme(WindowHandle, L"explorer");
- // break;
- //case 1: // Old colors
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
- }
+ TreeNew_ThemeSupport(TreeNewHandle, EnableThemeSupport);
+}
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // ListView_SetBkColor(WindowHandle, RGB(0xff, 0xff, 0xff));
- // ListView_SetTextBkColor(WindowHandle, RGB(0xff, 0xff, 0xff));
- // ListView_SetTextColor(WindowHandle, RGB(0x0, 0x0, 0x0));
- // break;
- //case 1: // Old colors
- ListView_SetBkColor(WindowHandle, PhThemeWindowBackgroundColor); // RGB(30, 30, 30)
- ListView_SetTextBkColor(WindowHandle, PhThemeWindowBackgroundColor); // RGB(30, 30, 30)
- ListView_SetTextColor(WindowHandle, PhThemeWindowTextColor);
- }
- else if (PhEqualStringZ(windowClassName, WC_SCROLLBAR, FALSE))
+VOID PhInitializeListViewTheme(
+ _In_ HWND ListViewHandle,
+ _In_ BOOLEAN EnableThemeSupport
+ )
+{
+ if (WindowsVersion >= WINDOWS_10_RS5)
{
- if (WindowsVersion >= WINDOWS_10_RS5)
- {
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // PhSetControlTheme(WindowHandle, L"");
- // break;
- //case 1: // Old colors
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
- }
+ HWND headerHandle = ListView_GetHeader(ListViewHandle);
+
+ PhAllowDarkModeForWindow(ListViewHandle, EnableThemeSupport);
+ PhSetControlTheme(ListViewHandle, EnableThemeSupport ? L"DarkMode_ItemsView" : L"Explorer");
+ if (headerHandle)
+ PhSetControlTheme(headerHandle, EnableThemeSupport ? L"DarkMode_ItemsView" : L"Explorer");
+ // ToolTip theme is applied automatically by phlib delayhook.c (Dart Vanya)
}
- else if (PhEqualStringZ(windowClassName, L"PhTreeNew", FALSE))
+
+ if (EnableThemeSupport)
{
- //switch (PhpThemeColorMode)
- //{
- //case 0: // New colors
- // TreeNew_ThemeSupport(WindowHandle, FALSE);
- // PhSetControlTheme(WindowHandle, L"");
- // break;
- //case 1: // Old colors
- TreeNew_ThemeSupport(WindowHandle, TRUE);
- PhWindowThemeSetDarkMode(WindowHandle, TRUE);
+ PhSetWindowExStyle(ListViewHandle, WS_BORDER, 0);
+ PhSetWindowExStyle(ListViewHandle, WS_EX_CLIENTEDGE, !PhEnableThemeListviewBorder ? 0 : WS_EX_CLIENTEDGE);
}
- else if (PhEqualStringZ(windowClassName, WC_EDIT, FALSE))
+ else
{
- SendMessage(WindowHandle, WM_THEMECHANGED, 0, 0); // searchbox.c
+ PhSetWindowExStyle(ListViewHandle, WS_EX_CLIENTEDGE, WS_EX_CLIENTEDGE);
}
- InvalidateRect(WindowHandle, NULL, TRUE);
+ SetWindowPos(ListViewHandle, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
- return TRUE;
+ ListView_SetBkColor(ListViewHandle, EnableThemeSupport ? PhThemeWindowBackgroundColor : GetSysColor(COLOR_WINDOW)); // RGB(30, 30, 30)
+ ListView_SetTextBkColor(ListViewHandle, EnableThemeSupport ? PhThemeWindowBackgroundColor : GetSysColor(COLOR_WINDOW)); // RGB(30, 30, 30)
+ ListView_SetTextColor(ListViewHandle, EnableThemeSupport ? PhThemeWindowTextColor : GetSysColor(COLOR_WINDOWTEXT));
}
BOOLEAN PhThemeWindowDrawItem(
@@ -1274,13 +1165,12 @@ BOOLEAN PhThemeWindowDrawItem(
//{
// DeleteFont(fontHandle);
//}
-
- return TRUE;
}
+ return TRUE;
case ODT_COMBOBOX:
{
- SetTextColor(DrawInfo->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- SetDCBrushColor(DrawInfo->hDC, PhThemeWindowForegroundColor);
+ SetTextColor(DrawInfo->hDC, PhThemeWindowTextColor);
+ SetDCBrushColor(DrawInfo->hDC, isSelected ? PhMakeColorBrighter(PhThemeWindowBackground2Color, 15) : PhThemeWindowForegroundColor); // RGB(80, 80, 80)
FillRect(DrawInfo->hDC, &DrawInfo->rcItem, PhGetStockBrush(DC_BRUSH));
INT length = ComboBox_GetLBTextLen(DrawInfo->hwndItem, DrawInfo->itemID);
@@ -1295,18 +1185,19 @@ BOOLEAN PhThemeWindowDrawItem(
if (ComboBox_GetLBText(DrawInfo->hwndItem, DrawInfo->itemID, comboText) == CB_ERR)
break;
+ RECT rect = DrawInfo->rcItem;
+ rect.left += 2;
+
DrawText(
DrawInfo->hDC,
comboText,
(UINT)PhCountStringZ(comboText),
- &DrawInfo->rcItem,
- DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE
+ &rect,
+ DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_VCENTER
);
}
-
- return TRUE;
}
- break;
+ return TRUE;
}
return FALSE;
@@ -1592,7 +1483,8 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
BOOLEAN isSelected = (DrawInfo->uItemState & CDIS_SELECTED) == CDIS_SELECTED;
BOOLEAN isHighlighted = (DrawInfo->uItemState & CDIS_HOT) == CDIS_HOT;
BOOLEAN isFocused = (DrawInfo->uItemState & CDIS_FOCUS) == CDIS_FOCUS;
- BOOLEAN isKeyboardFocused = isFocused && (DrawInfo->uItemState & CDIS_SHOWKEYBOARDCUES) == CDIS_SHOWKEYBOARDCUES;
+ BOOLEAN showKeyboardCues = (DrawInfo->uItemState & CDIS_SHOWKEYBOARDCUES) == CDIS_SHOWKEYBOARDCUES;
+ UINT hidePrefixFlag = showKeyboardCues ? 0 : DT_HIDEPREFIX;
RECT bufferRect =
{
0, 0,
@@ -1627,7 +1519,7 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
HTHEME themeHandle;
isChecked = Button_GetCheck(DrawInfo->hdr.hwndFrom) & BST_CHECKED;
- isMixed = Button_GetCheck(DrawInfo->hdr.hwndFrom) & BST_INDETERMINATE;
+ isMixed = Button_GetCheck(DrawInfo->hdr.hwndFrom) & BST_INDETERMINATE;
if (isCheckbox)
{
@@ -1664,7 +1556,7 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
// break;
//case 1: // Old colors
SetTextColor(DrawInfo->hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
- SetDCBrushColor(DrawInfo->hdc, RGB(78, 78, 78));
+ SetDCBrushColor(DrawInfo->hdc, PhMakeColorBrighter(PhThemeWindowBackground2Color, 13)); // RGB(78, 78, 78)
FillRect(DrawInfo->hdc, &DrawInfo->rc, PhGetStockBrush(DC_BRUSH));
}
else if (isHighlighted)
@@ -1695,6 +1587,12 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
else
{
SetBkMode(DrawInfo->hdc, TRANSPARENT);
+ if (showKeyboardCues) // fix artefacts on Alt press
+ {
+ SetDCBrushColor(DrawInfo->hdc, PhGetWindowContext(GetAncestor(DrawInfo->hdr.hwndFrom, GA_ROOT), LONG_MAX) ?
+ PhThemeWindowBackgroundColor : PhThemeWindowBackground2Color); // TaskDialog HACK
+ FillRect(DrawInfo->hdc, &DrawInfo->rc, PhGetStockBrush(DC_BRUSH));
+ }
SetTextColor(DrawInfo->hdc, !isDisabled ? PhThemeWindowTextColor : RGB(0x9B, 0x9B, 0x9B));
if (themeHandle = PhOpenThemeData(DrawInfo->hdr.hwndFrom, VSCLASS_BUTTON, dpiValue))
@@ -1742,7 +1640,7 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
buttonText->Buffer,
(UINT)buttonText->Length / sizeof(WCHAR),
&bufferRect,
- DT_LEFT | DT_SINGLELINE | DT_VCENTER | (!isKeyboardFocused ? DT_HIDEPREFIX : 0)
+ DT_LEFT | DT_SINGLELINE | DT_VCENTER | hidePrefixFlag
);
}
else
@@ -1752,7 +1650,7 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
buttonText->Buffer,
(UINT)buttonText->Length / sizeof(WCHAR),
&bufferRect,
- DT_LEFT | DT_TOP | DT_CALCRECT | (!isKeyboardFocused ? DT_HIDEPREFIX : 0)
+ DT_LEFT | DT_TOP | DT_CALCRECT | hidePrefixFlag
);
bufferRect.top = (DrawInfo->rc.bottom - DrawInfo->rc.top) / 2 - (bufferRect.bottom - bufferRect.top) / 2 - 1;
@@ -1763,18 +1661,18 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
buttonText->Buffer,
(UINT)buttonText->Length / sizeof(WCHAR),
&bufferRect,
- DT_LEFT | DT_TOP | (!isKeyboardFocused ? DT_HIDEPREFIX : 0)
+ DT_LEFT | DT_TOP | hidePrefixFlag
);
}
- if (isKeyboardFocused)
+ if (showKeyboardCues && isFocused)
{
DrawText(
DrawInfo->hdc,
buttonText->Buffer,
(UINT)buttonText->Length / sizeof(WCHAR),
&bufferRect,
- DT_LEFT | DT_TOP | DT_CALCRECT
+ DT_LEFT | DT_TOP | DT_CALCRECT | hidePrefixFlag
);
PhInflateRect(&bufferRect, 1, 0);
bufferRect.top += 1, bufferRect.bottom += 2;
@@ -1812,6 +1710,8 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
}
else
{
+ ODS_DISABLED;
+
HFONT newFont = PhDuplicateFontWithNewHeight(PhApplicationFont, 22, dpiValue);
HFONT oldFont;
@@ -1835,7 +1735,7 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
buttonText->Buffer,
(UINT)buttonText->Length / sizeof(WCHAR),
&bufferRect,
- DT_LEFT | DT_VCENTER | DT_SINGLELINE | (!isKeyboardFocused ? DT_HIDEPREFIX : 0)
+ DT_LEFT | DT_VCENTER | DT_SINGLELINE | hidePrefixFlag
);
}
}
@@ -1852,7 +1752,7 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
// break;
//case 1: // Old colors
SetTextColor(DrawInfo->hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
- SetDCBrushColor(DrawInfo->hdc, RGB(78, 78, 78));
+ SetDCBrushColor(DrawInfo->hdc, PhMakeColorBrighter(PhThemeWindowBackground2Color, 13)); // RGB(78, 78, 78)
FillRect(DrawInfo->hdc, &DrawInfo->rc, PhGetStockBrush(DC_BRUSH));
}
else if (isHighlighted)
@@ -1888,13 +1788,12 @@ LRESULT CALLBACK PhThemeWindowDrawButton(
buttonText->Buffer,
(UINT)buttonText->Length / sizeof(WCHAR),
&bufferRect,
- DT_CENTER | DT_SINGLELINE | DT_VCENTER | (!isKeyboardFocused ? DT_HIDEPREFIX : 0)
+ DT_CENTER | DT_SINGLELINE | DT_VCENTER | hidePrefixFlag
);
}
}
PhDereferenceObject(buttonText);
}
-
return CDRF_SKIPDEFAULT;
}
@@ -1907,7 +1806,10 @@ LRESULT CALLBACK PhThemeWindowDrawRebar(
{
// temp chevron workaround until location/state supported.
if (DrawInfo->dwDrawStage != CDDS_PREPAINT)
- return CDRF_DODEFAULT;
+ {
+ // Skip erasing of background to remove flickering when close settings or lock/unlock toolbar (Dart Vanya)
+ return DrawInfo->dwDrawStage == CDDS_PREERASE ? CDRF_SKIPDEFAULT : CDRF_DODEFAULT;
+ }
switch (DrawInfo->dwDrawStage)
{
@@ -2061,8 +1963,9 @@ LRESULT CALLBACK PhThemeWindowDrawToolbar(
//SetDCBrushColor(DrawInfo->nmcd.hdc, PhThemeWindowBackgroundColor); // GetSysColor(COLOR_3DFACE));// RGB(0xff, 0xff, 0xff));
if (!isPressed)
FillRect(DrawInfo->nmcd.hdc, &DrawInfo->nmcd.rc, PhThemeWindowBackgroundBrush);
- else {
- SetDCBrushColor(DrawInfo->nmcd.hdc, RGB(0x60, 0x60, 0x60));
+ else
+ {
+ SetDCBrushColor(DrawInfo->nmcd.hdc, PhMakeColorBrighter(PhThemeWindowBackground2Color, 31)); // RGB(96, 96, 96)
FillRect(DrawInfo->nmcd.hdc, &DrawInfo->nmcd.rc, PhGetStockBrush(DC_BRUSH));
}
}
@@ -2195,30 +2098,65 @@ LRESULT CALLBACK PhpThemeWindowDrawListViewGroup(
memset(&groupInfo, 0, sizeof(LVGROUP));
groupInfo.cbSize = sizeof(LVGROUP);
- groupInfo.mask = LVGF_HEADER;
+ groupInfo.mask = LVGF_HEADER | LVGF_STATE;
+ groupInfo.stateMask = LVGS_SELECTED | LVGS_FOCUSED | LVGS_COLLAPSED | LVGS_COLLAPSIBLE;
if (ListView_GetGroupInfo(DrawInfo->nmcd.hdr.hwndFrom, (ULONG)DrawInfo->nmcd.dwItemSpec, &groupInfo) != INT_ERROR)
{
+ RECT headerRect = DrawInfo->rcText;
+ POINT pt;
+ HTHEME glyphTheme;
+
+ BOOLEAN isCollapsible = (groupInfo.state & LVGS_COLLAPSIBLE) == LVGS_COLLAPSIBLE;
+ BOOLEAN isCollapsed = (groupInfo.state & LVGS_COLLAPSED) == LVGS_COLLAPSED;
+ GetCursorPos(&pt);
+ MapWindowPoints(NULL, DrawInfo->nmcd.hdr.hwndFrom, &pt, 1);
+ BOOLEAN isHot = PtInRect(&DrawInfo->rcText, pt); // LVGS_HOT is missing
+
SetTextColor(DrawInfo->nmcd.hdc, PhThemeWindowTextColor);
- SetDCBrushColor(DrawInfo->nmcd.hdc, PhThemeWindowBackground2Color);
+ headerRect.top += PhGetDpi(2, dpiValue);
+ headerRect.bottom -= PhGetDpi(2, dpiValue);
+
+ if (isCollapsible &&
+ (glyphTheme = PhOpenThemeData(DrawInfo->nmcd.hdr.hwndFrom, VSCLASS_LISTVIEW, dpiValue)))
+ {
+ SIZE glyphSize;
+ RECT glyphRect = headerRect;
+ INT partId = isCollapsed ? LVP_EXPANDBUTTON : LVP_COLLAPSEBUTTON;
+ INT stateId = LVCB_NORMAL;
- DrawInfo->rcText.top += PhGetDpi(2, dpiValue);
- DrawInfo->rcText.bottom -= PhGetDpi(2, dpiValue);
- FillRect(DrawInfo->nmcd.hdc, &DrawInfo->rcText, PhGetStockBrush(DC_BRUSH));
- DrawInfo->rcText.top -= PhGetDpi(2, dpiValue);
- DrawInfo->rcText.bottom += PhGetDpi(2, dpiValue);
+ PhGetThemePartSize(glyphTheme, DrawInfo->nmcd.hdc, partId, stateId, &glyphRect, TS_TRUE, &glyphSize);
+ glyphRect.left = glyphRect.right - glyphSize.cx - glyphSize.cx / 2;
+
+ if (PtInRect(&glyphRect, pt))
+ {
+ stateId = IsLButtonDown() ? LVCB_PUSHED : LVCB_HOVER;
+ SetDCBrushColor(DrawInfo->nmcd.hdc, PhThemeWindowBackground2Color);
+ }
+ else
+ {
+ SetDCBrushColor(DrawInfo->nmcd.hdc, !isHot ? PhThemeWindowBackground2Color : PhMakeColorBrighter(PhThemeWindowBackground2Color, 12));
+ }
+ FillRect(DrawInfo->nmcd.hdc, &headerRect, PhGetStockBrush(DC_BRUSH));
+ PhDrawThemeBackground(glyphTheme, DrawInfo->nmcd.hdc, partId, stateId, &glyphRect, NULL);
+ PhCloseThemeData(glyphTheme);
+ }
+ else
+ {
+ SetDCBrushColor(DrawInfo->nmcd.hdc, !isHot ? PhThemeWindowBackground2Color : PhMakeColorBrighter(PhThemeWindowBackground2Color, 12));
+ FillRect(DrawInfo->nmcd.hdc, &headerRect, PhGetStockBrush(DC_BRUSH));
+ }
if (groupInfo.pszHeader)
{
- DrawInfo->rcText.left += PhGetDpi(10, dpiValue);
+ headerRect.left += PhGetDpi(10, dpiValue);
DrawText(
DrawInfo->nmcd.hdc,
groupInfo.pszHeader,
(UINT)PhCountStringZ(groupInfo.pszHeader),
- &DrawInfo->rcText,
+ &headerRect,
DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_HIDEPREFIX
);
- DrawInfo->rcText.left -= PhGetDpi(10, dpiValue);
}
}
@@ -2255,7 +2193,7 @@ LRESULT CALLBACK PhpThemeWindowSubclassProc(
case WM_NCDESTROY:
{
PhRemoveWindowContext(hWnd, LONG_MAX);
- SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
+ PhSetWindowProcedure(hWnd, oldWndProc);
}
break;
case WM_NOTIFY:
@@ -2269,8 +2207,7 @@ LRESULT CALLBACK PhpThemeWindowSubclassProc(
LPNMCUSTOMDRAW customDraw = (LPNMCUSTOMDRAW)lParam;
WCHAR className[MAX_PATH];
- if (!GetClassName(customDraw->hdr.hwndFrom, className, RTL_NUMBER_OF(className)))
- className[0] = UNICODE_NULL;
+ GETCLASSNAME_OR_NULL(customDraw->hdr.hwndFrom, className);
if (PhEqualStringZ(className, WC_BUTTON, FALSE))
{
@@ -2305,7 +2242,7 @@ LRESULT CALLBACK PhpThemeWindowSubclassProc(
{
HDC hdc = (HDC)wParam;
- //Fix typing in multiline edit (Dart Vanya)
+ //Fix typing in multiline edit (Dart Vanya)
if (PhGetWindowStyle((HWND)lParam) & ES_MULTILINE)
SetBkColor(hdc, PhThemeWindowBackground2Color);
else
@@ -2330,7 +2267,6 @@ LRESULT CALLBACK PhpThemeWindowSubclassProc(
return (INT_PTR)PhThemeWindowBackgroundBrush;
}
break;
-
case WM_MEASUREITEM:
if (PhThemeWindowMeasureItem(hWnd, (LPMEASUREITEMSTRUCT)lParam))
return TRUE;
@@ -2419,10 +2355,10 @@ LRESULT CALLBACK PhpThemeWindowGroupBoxSubclassProc(
switch (uMsg)
{
- case WM_NCDESTROY:
+ case WM_NCDESTROY:
{
- SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
PhRemoveWindowContext(WindowHandle, LONG_MAX);
+ PhSetWindowProcedure(WindowHandle, oldWndProc);
}
break;
case WM_ERASEBKGND:
@@ -2526,8 +2462,12 @@ VOID ThemeWindowRenderTabControl(
TabCtrl_GetItemRect(WindowHandle, 0, &itemRect);
clientRect->top += (itemRect.bottom - itemRect.top) * TabCtrl_GetRowCount(WindowHandle) + 2;
- //SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color);
- //FrameRect(bufferDc, clientRect, PhGetStockBrush(DC_BRUSH));
+ if (PhEnableThemeTabBorders)
+ {
+ SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color);
+ FrameRect(bufferDc, clientRect, PhGetStockBrush(DC_BRUSH));
+ }
+
headerBottom = clientRect->top;
clientRect->top = oldTop;
@@ -2604,10 +2544,13 @@ VOID ThemeWindowRenderTabControl(
//case 1: // Old colors
{
// SetTextColor(bufferDc, PhThemeWindowTextColor);
- SetDCBrushColor(bufferDc, PhThemeWindowBackgroundColor);
+ SetDCBrushColor(bufferDc, PhEnableThemeTabBorders ? PhMakeColorBrighter(PhThemeWindowBackgroundColor, 6) : PhThemeWindowBackgroundColor);
FillRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH));
- //SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color);
- //FrameRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH));
+ if (PhEnableThemeTabBorders)
+ {
+ SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color);
+ FrameRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH));
+ }
}
}
@@ -2633,7 +2576,8 @@ VOID ThemeWindowRenderTabControl(
itemRect.right += itemRect.right + 1 < clientRect->right;
PhInflateRect(&itemRect, 1, 1); // draw selected tab slightly bigger
itemRect.bottom -= 1;
- SetDCBrushColor(bufferDc, PhPtInRect(&itemRect, Context->CursorPos) ? PhThemeWindowHighlightColor : RGB(0x50, 0x50, 0x50));
+ SetDCBrushColor(bufferDc, PhPtInRect(&itemRect, Context->CursorPos) ? PhThemeWindowHighlightColor :
+ PhMakeColorBrighter(PhThemeWindowBackground2Color, 15)); // RGB(80, 80, 80)
FillRect(bufferDc, &itemRect, PhGetStockBrush(DC_BRUSH));
if (TabCtrl_GetItem(WindowHandle, currentSelection, &tabItem))
@@ -2686,7 +2630,7 @@ LRESULT CALLBACK PhpThemeWindowTabControlWndSubclassProc(
case WM_NCDESTROY:
{
PhRemoveWindowContext(WindowHandle, LONG_MAX);
- SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
+ PhSetWindowProcedure(WindowHandle, oldWndProc);
PhFree(context);
}
@@ -2843,10 +2787,11 @@ LRESULT CALLBACK PhpThemeWindowListBoxControlSubclassProc(
switch (uMsg)
{
- case WM_NCDESTROY:
+ case WM_NCDESTROY:
{
PhRemoveWindowContext(WindowHandle, LONG_MAX);
- SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
+ PhSetWindowProcedure(WindowHandle, oldWndProc);
+ PhFree(context);
}
break;
//case WM_MOUSEMOVE:
@@ -3091,42 +3036,6 @@ VOID ThemeWindowRenderComboBox(
}
}
-VOID ThemeWindowComboBoxExcludeRect(
- _In_ PPHP_THEME_WINDOW_COMBO_CONTEXT Context,
- _In_ HWND WindowHandle,
- _In_ HDC Hdc,
- _In_ PRECT clientRect,
- _In_ WNDPROC WindowProcedure
- )
-{
- LONG_PTR windowStyle = PhGetWindowStyle(WindowHandle);
-
- if ((windowStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST || (windowStyle & CBS_DROPDOWN) != CBS_DROPDOWN)
- {
- COMBOBOXINFO info = { sizeof(COMBOBOXINFO) };
-
- if (CallWindowProc(WindowProcedure, WindowHandle, CB_GETCOMBOBOXINFO, 0, (LPARAM)&info))
- {
- //INT borderSize = 0;
- //if (Context->ThemeHandle)
- //{
- // if (PhGetThemeInt(Context->ThemeHandle, 0, 0, TMT_BORDERSIZE, &borderSize))
- // {
- // borderSize = borderSize * 2;
- // }
- //}
-
- ExcludeClipRect(
- Hdc,
- info.rcItem.left,
- info.rcItem.top,
- info.rcItem.right,
- info.rcItem.bottom
- );
- }
- }
-}
-
LRESULT CALLBACK PhpThemeWindowComboBoxControlSubclassProc(
_In_ HWND WindowHandle,
_In_ UINT uMsg,
@@ -3147,7 +3056,7 @@ LRESULT CALLBACK PhpThemeWindowComboBoxControlSubclassProc(
case WM_NCDESTROY:
{
PhRemoveWindowContext(WindowHandle, LONG_MAX);
- SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
+ PhSetWindowProcedure(WindowHandle, oldWndProc);
if (context->ThemeHandle)
{
@@ -3207,14 +3116,48 @@ LRESULT CALLBACK PhpThemeWindowComboBoxControlSubclassProc(
HBITMAP bufferBitmap;
HBITMAP oldBufferBitmap;
+ LONG_PTR windowStyle = PhGetWindowStyle(WindowHandle);
GetClientRect(WindowHandle, &clientRect);
-
hdc = GetDC(WindowHandle);
+
+ if ((windowStyle & CBS_DROPDOWNLIST) != CBS_DROPDOWNLIST || (windowStyle & CBS_DROPDOWN) != CBS_DROPDOWN)
+ {
+ COMBOBOXINFO info = { sizeof(COMBOBOXINFO) };
+ RECT windowRect;
+ RECT listRect;
+
+ if (CallWindowProc(oldWndProc, WindowHandle, CB_GETCOMBOBOXINFO, 0, (LPARAM)&info) && info.hwndList)
+ {
+ if ((windowStyle & CBS_SIMPLE) == CBS_SIMPLE)
+ {
+ GetWindowRect(WindowHandle, &windowRect);
+ GetWindowRect(info.hwndList, &listRect);
+ clientRect.bottom -= (windowRect.bottom - listRect.bottom);
+ }
+
+ //INT borderSize = 0;
+ //if (Context->ThemeHandle)
+ //{
+ // if (PhGetThemeInt(Context->ThemeHandle, 0, 0, TMT_BORDERSIZE, &borderSize))
+ // {
+ // borderSize = borderSize * 2;
+ // }
+ //}
+
+ ExcludeClipRect(
+ hdc,
+ info.rcItem.left,
+ info.rcItem.top,
+ info.rcItem.right,
+ info.rcItem.bottom
+ );
+ }
+ }
+
bufferDc = CreateCompatibleDC(hdc);
bufferBitmap = CreateCompatibleBitmap(hdc, clientRect.right, clientRect.bottom);
oldBufferBitmap = SelectBitmap(bufferDc, bufferBitmap);
- ThemeWindowComboBoxExcludeRect(context, WindowHandle, hdc, &clientRect, oldWndProc);
ThemeWindowRenderComboBox(context, WindowHandle, bufferDc, &clientRect, oldWndProc);
BitBlt(hdc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom, bufferDc, 0, 0, SRCCOPY);
@@ -3240,7 +3183,7 @@ LRESULT CALLBACK PhpThemeWindowACLUISubclassProc(
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
-)
+ )
{
WNDPROC oldWndProc;
@@ -3249,9 +3192,11 @@ LRESULT CALLBACK PhpThemeWindowACLUISubclassProc(
switch (uMsg)
{
- case WM_VSCROLL:
- case WM_MOUSEWHEEL:
- InvalidateRect(WindowHandle, NULL, FALSE);
+ case WM_NCDESTROY:
+ {
+ PhRemoveWindowContext(WindowHandle, LONG_MAX);
+ PhSetWindowProcedure(WindowHandle, oldWndProc);
+ }
break;
case WM_NOTIFY:
{
@@ -3264,8 +3209,8 @@ LRESULT CALLBACK PhpThemeWindowACLUISubclassProc(
if (customDraw->dwDrawStage == CDDS_PREPAINT && !(customDraw->uItemState & CDIS_FOCUS))
{
- if (!GetClassName(customDraw->hdr.hwndFrom, className, RTL_NUMBER_OF(className)))
- className[0] = UNICODE_NULL;
+ GETCLASSNAME_OR_NULL(customDraw->hdr.hwndFrom, className);
+
if (PhEqualStringZ(className, WC_BUTTON, FALSE))
{
HDC hdc = GetDC(WindowHandle);
@@ -3279,11 +3224,9 @@ LRESULT CALLBACK PhpThemeWindowACLUISubclassProc(
}
}
break;
- case WM_NCDESTROY:
- {
- PhRemoveWindowContext(WindowHandle, LONG_MAX);
- SetWindowLongPtr(WindowHandle, GWLP_WNDPROC, (LONG_PTR)oldWndProc);
- }
+ case WM_VSCROLL:
+ case WM_MOUSEWHEEL:
+ InvalidateRect(WindowHandle, NULL, FALSE);
break;
case WM_ERASEBKGND:
{
diff --git a/phlib/treenew.c b/phlib/treenew.c
index e81875cac14b..0974a36f774a 100644
--- a/phlib/treenew.c
+++ b/phlib/treenew.c
@@ -5492,7 +5492,11 @@ VOID PhTnpPaint(
RECT tempRect;
BLENDFUNCTION blendFunction;
- SetTextColor(hdc, PhThemeWindowTextColor);
+ // Fix ForeColor for theme, previously it was always white. Plus 90-100 brightness adjustments seems fine for good contrast. (Dart Vanya)
+ SetTextColor(hdc,
+ !node->UseAutoForeColor && node->s.DrawForeColor != 0 ?
+ PhMakeColorBrighter(node->s.DrawForeColor, node->s.DrawBackColor == 16777215 ? 95 : 105) :
+ PhThemeWindowTextColor);
SetDCBrushColor(hdc, PhThemeWindowBackgroundColor);
FillRect(hdc, &rowRect, PhGetStockBrush(DC_BRUSH));
diff --git a/plugins/DotNetTools/asmpage.c b/plugins/DotNetTools/asmpage.c
index 30b75552381d..8a29cbb0a522 100644
--- a/plugins/DotNetTools/asmpage.c
+++ b/plugins/DotNetTools/asmpage.c
@@ -2050,7 +2050,7 @@ INT_PTR CALLBACK DotNetAsmPageDlgProc(
PhReferenceObject(context);
DotNetAsmRefreshTraceQuery(context, FALSE);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/DotNetTools/perfpage.c b/plugins/DotNetTools/perfpage.c
index 5c790a24067a..94f7f77118a4 100644
--- a/plugins/DotNetTools/perfpage.c
+++ b/plugins/DotNetTools/perfpage.c
@@ -840,7 +840,7 @@ INT_PTR CALLBACK DotNetPerfPageDlgProc(
&context->ProcessesUpdatedCallbackRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/depend.c b/plugins/ExtendedServices/depend.c
index 64bbc95af32c..9717350b65c3 100644
--- a/plugins/ExtendedServices/depend.c
+++ b/plugins/ExtendedServices/depend.c
@@ -135,7 +135,7 @@ INT_PTR CALLBACK EspServiceDependenciesDlgProc(
PhClearReference(&errorMessage);
}
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
@@ -260,7 +260,7 @@ INT_PTR CALLBACK EspServiceDependentsDlgProc(
PhClearReference(&errorMessage);
}
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/other.c b/plugins/ExtendedServices/other.c
index 2b8c0e7e891f..f96fc36d2396 100644
--- a/plugins/ExtendedServices/other.c
+++ b/plugins/ExtendedServices/other.c
@@ -381,7 +381,7 @@ INT_PTR CALLBACK EspServiceOtherDlgProc(
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(WindowHandle, IDC_ADD), NULL, PH_ANCHOR_BOTTOM | PH_ANCHOR_RIGHT);
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(WindowHandle, IDC_REMOVE), NULL, PH_ANCHOR_BOTTOM | PH_ANCHOR_RIGHT);
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/recovery.c b/plugins/ExtendedServices/recovery.c
index 936e0ed20e68..2ffae657ae0d 100644
--- a/plugins/ExtendedServices/recovery.c
+++ b/plugins/ExtendedServices/recovery.c
@@ -329,7 +329,7 @@ INT_PTR CALLBACK EspServiceRecoveryDlgProc(
context->Ready = TRUE;
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
@@ -587,7 +587,7 @@ INT_PTR CALLBACK EspServiceRecovery2DlgProc(
)
{
if (WindowMessage == WM_INITDIALOG)
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
return FALSE;
}
@@ -626,7 +626,7 @@ INT_PTR CALLBACK RestartComputerDlgProc(
PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDC_RESTARTCOMPAFTER));
Edit_SetSel(GetDlgItem(WindowHandle, IDC_RESTARTCOMPAFTER), 0, -1);
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/srvprgrs.c b/plugins/ExtendedServices/srvprgrs.c
index 38e79b42279f..e1af25cbae9c 100644
--- a/plugins/ExtendedServices/srvprgrs.c
+++ b/plugins/ExtendedServices/srvprgrs.c
@@ -63,7 +63,7 @@ INT_PTR CALLBACK EspRestartServiceDlgProc(
EndDialog(WindowHandle, IDCANCEL);
}
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/svcpkg.c b/plugins/ExtendedServices/svcpkg.c
index d359ee13b59d..56274c3565d1 100644
--- a/plugins/ExtendedServices/svcpkg.c
+++ b/plugins/ExtendedServices/svcpkg.c
@@ -340,7 +340,7 @@ INT_PTR CALLBACK EspPackageServiceDlgProc(
EspUpdatePackageProperties(context);
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
PhSetDialogFocus(WindowHandle, GetDlgItem(GetParent(WindowHandle), IDCANCEL));
}
diff --git a/plugins/ExtendedServices/svcpnp.c b/plugins/ExtendedServices/svcpnp.c
index 99b5d61c7315..e4ba11613bad 100644
--- a/plugins/ExtendedServices/svcpnp.c
+++ b/plugins/ExtendedServices/svcpnp.c
@@ -778,7 +778,7 @@ INT_PTR CALLBACK EspPnPServiceDlgProc(
ShowWindow(context->ListViewHandle, SW_HIDE);
}
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/trigger.c b/plugins/ExtendedServices/trigger.c
index 36006b845b39..297c8e4892f6 100644
--- a/plugins/ExtendedServices/trigger.c
+++ b/plugins/ExtendedServices/trigger.c
@@ -1253,7 +1253,7 @@ INT_PTR CALLBACK EspServiceTriggerDlgProc(
EnableWindow(GetDlgItem(WindowHandle, IDC_EDIT), FALSE);
EnableWindow(GetDlgItem(WindowHandle, IDC_DELETE), FALSE);
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
@@ -1583,7 +1583,7 @@ INT_PTR CALLBACK ValueDlgProc(
PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDC_VALUES));
Edit_SetSel(GetDlgItem(WindowHandle, IDC_VALUES), 0, -1);
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedServices/triggpg.c b/plugins/ExtendedServices/triggpg.c
index e2cf8db9a3ed..aedb460a1892 100644
--- a/plugins/ExtendedServices/triggpg.c
+++ b/plugins/ExtendedServices/triggpg.c
@@ -107,7 +107,7 @@ INT_PTR CALLBACK EspServiceTriggersDlgProc(
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(WindowHandle, IDC_EDIT), NULL, PH_ANCHOR_BOTTOM | PH_ANCHOR_RIGHT);
PhAddLayoutItem(&context->LayoutManager, GetDlgItem(WindowHandle, IDC_DELETE), NULL, PH_ANCHOR_BOTTOM | PH_ANCHOR_RIGHT);
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/ExtendedTools.rc b/plugins/ExtendedTools/ExtendedTools.rc
index 0fbadd6b0063..1001c6638939 100644
--- a/plugins/ExtendedTools/ExtendedTools.rc
+++ b/plugins/ExtendedTools/ExtendedTools.rc
@@ -406,8 +406,8 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS
CAPTION "Object Manager"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- PUSHBUTTON "Refresh (F5)",IDC_REFRESH,2,2,50,14
- COMBOBOX IDC_OBJMGR_PATH,56,3,466,16,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Refresh (F5)",IDC_REFRESH,2,1,50,14
+ COMBOBOX IDC_OBJMGR_PATH,56,2,466,16,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_OBJMGR_SEARCH,528,2,169,13,ES_AUTOHSCROLL
CONTROL "",IDC_OBJMGR_LIST,"SysListView32",LVS_REPORT | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,153,19,544,328
CONTROL "",IDC_OBJMGR_TREE,"SysTreeView32",TVS_HASBUTTONS | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | TVS_FULLROWSELECT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,2,19,148,328
diff --git a/plugins/ExtendedTools/disktab.c b/plugins/ExtendedTools/disktab.c
index f7b068827794..111204ac6288 100644
--- a/plugins/ExtendedTools/disktab.c
+++ b/plugins/ExtendedTools/disktab.c
@@ -95,19 +95,13 @@ BOOLEAN EtpDiskPageCallback(
0,
Parameter2,
NULL,
- NULL,
+ PluginInstance->DllBase,
&treelistCreateParams
);
if (!hwnd)
return FALSE;
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
- {
- PhInitializeWindowTheme(hwnd, TRUE); // HACK (dmex)
- TreeNew_ThemeSupport(hwnd, TRUE);
- }
-
DiskTreeNewCreated = TRUE;
DiskNodeHashtable = PhCreateHashtable(
@@ -120,6 +114,8 @@ BOOLEAN EtpDiskPageCallback(
EtInitializeDiskTreeList(hwnd);
+ PhInitializeWindowTheme(hwnd);
+
//if (!EtEtwEnabled) // always show status (dmex)
{
if (EtEtwStatus != ERROR_SUCCESS)
@@ -262,7 +258,7 @@ VOID EtInitializeDiskTreeList(
{
DiskTreeNewHandle = WindowHandle;
- PhSetControlTheme(DiskTreeNewHandle, !PhGetIntegerSetting(L"EnableThemeSupport") ? L"explorer" : L"DarkMode_Explorer");
+ PhSetControlTheme(DiskTreeNewHandle, L"explorer");
TreeNew_SetRedraw(WindowHandle, FALSE);
SendMessage(TreeNew_GetTooltips(DiskTreeNewHandle), TTM_SETDELAYTIME, TTDT_AUTOPOP, 0x7fff);
TreeNew_SetCallback(WindowHandle, EtpDiskTreeNewCallback, NULL);
@@ -1346,7 +1342,7 @@ HWND NTAPI EtpToolStatusGetTreeNewHandle(
// ShowWindow(GetDlgItem(hwndDlg, IDC_RESTART), SW_HIDE);
// }
//
-// PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+// PhInitializeWindowTheme(hwndDlg);
// }
// break;
// case WM_COMMAND:
diff --git a/plugins/ExtendedTools/etwprprp.c b/plugins/ExtendedTools/etwprprp.c
index f937547b4e6e..0dee90cfa1df 100644
--- a/plugins/ExtendedTools/etwprprp.c
+++ b/plugins/ExtendedTools/etwprprp.c
@@ -498,7 +498,7 @@ INT_PTR CALLBACK EtwDiskPageDlgProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -831,7 +831,7 @@ INT_PTR CALLBACK EtwNetworkPageDlgProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/exttools.h b/plugins/ExtendedTools/exttools.h
index 4fa1e542c9c2..55bf549519dc 100644
--- a/plugins/ExtendedTools/exttools.h
+++ b/plugins/ExtendedTools/exttools.h
@@ -1650,8 +1650,10 @@ VOID EtShowFirmwareDialog(
#define PH_OBJ_KERNEL_ACCESS_ONLY 0x00010000L
extern HWND EtObjectManagerDialogHandle;
+extern LARGE_INTEGER EtObjectManagerTimeCached;
extern PPH_LIST EtObjectManagerOwnHandles;
extern HICON EtObjectManagerPropIcon;
+extern PPH_HASHTABLE EtObjectManagerPropWindows;
extern BOOLEAN EtObjectManagerShowHandlesPage;
extern ULONG EtAlpcPortTypeIndex;
diff --git a/plugins/ExtendedTools/firmware.c b/plugins/ExtendedTools/firmware.c
index 5dff9623f87b..c7c3a8cffd1f 100644
--- a/plugins/ExtendedTools/firmware.c
+++ b/plugins/ExtendedTools/firmware.c
@@ -264,7 +264,7 @@ INT_PTR CALLBACK EtFirmwareDlgProc(
else
PhCenterWindow(hwndDlg, context->ParentWindowHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtEnumerateFirmwareEntries(context);
}
diff --git a/plugins/ExtendedTools/firmware_editor.c b/plugins/ExtendedTools/firmware_editor.c
index b6373362ee70..bd6d573fd174 100644
--- a/plugins/ExtendedTools/firmware_editor.c
+++ b/plugins/ExtendedTools/firmware_editor.c
@@ -174,7 +174,7 @@ INT_PTR CALLBACK EtFirmwareEditorDlgProc(
}
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM)context->HexEditHandle, TRUE);
}
diff --git a/plugins/ExtendedTools/frameprp.c b/plugins/ExtendedTools/frameprp.c
index a07c4659ea01..021313ba614a 100644
--- a/plugins/ExtendedTools/frameprp.c
+++ b/plugins/ExtendedTools/frameprp.c
@@ -461,7 +461,7 @@ INT_PTR CALLBACK EtpFramesPageDlgProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/fwtab.c b/plugins/ExtendedTools/fwtab.c
index 652c035320bb..6d308ad05db1 100644
--- a/plugins/ExtendedTools/fwtab.c
+++ b/plugins/ExtendedTools/fwtab.c
@@ -54,7 +54,7 @@ BOOLEAN FwTabPageCallback(
PH_TREENEW_CREATEPARAMS treelistCreateParams = { 0 };
thinRows = PhGetIntegerSetting(L"ThinRows") ? TN_STYLE_THIN_ROWS : 0;
- treelistBorder = (PhGetIntegerSetting(L"TreeListBorderEnable") && !PhGetIntegerSetting(L"EnableThemeSupport")) ? WS_BORDER : 0;
+ treelistBorder = (PhGetIntegerSetting(L"TreeListBorderEnable") && !PhIsThemeSupportEnabled()) ? WS_BORDER : 0;
treelistCustomColors = PhGetIntegerSetting(L"TreeListCustomColorsEnable") ? TN_STYLE_CUSTOM_COLORS : 0;
if (treelistCustomColors)
@@ -83,16 +83,12 @@ BOOLEAN FwTabPageCallback(
FwTreeNewCreated = TRUE;
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
- {
- PhInitializeWindowTheme(hwnd, TRUE); // HACK (dmex)
- TreeNew_ThemeSupport(hwnd, TRUE);
- }
-
PhInitializeProviderEventQueue(&FwNetworkEventQueue, 100);
InitializeFwTreeList(hwnd);
+ PhInitializeWindowTheme(hwnd);
+
if (PhGetOwnTokenAttributes().Elevated)
{
EtFwStatus = EtFwMonitorInitialize();
@@ -253,7 +249,7 @@ VOID InitializeFwTreeList(
InitializeFwTreeListDpi(FwTreeNewHandle);
- PhSetControlTheme(FwTreeNewHandle, !PhGetIntegerSetting(L"EnableThemeSupport") ? L"explorer" : L"DarkMode_Explorer");
+ PhSetControlTheme(FwTreeNewHandle, L"explorer");
TreeNew_SetRedraw(FwTreeNewHandle, FALSE);
TreeNew_SetCallback(FwTreeNewHandle, FwTreeNewCallback, NULL);
diff --git a/plugins/ExtendedTools/gpudetails.c b/plugins/ExtendedTools/gpudetails.c
index c6b2ee2ffd75..42332aa992f1 100644
--- a/plugins/ExtendedTools/gpudetails.c
+++ b/plugins/ExtendedTools/gpudetails.c
@@ -401,7 +401,7 @@ INT_PTR CALLBACK EtpGpuDetailsDlgProc(
else
PhCenterWindow(hwndDlg, (HWND)lParam);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtpGpuDetailsEnumAdapters(context->ListViewHandle);
diff --git a/plugins/ExtendedTools/gpunodes.c b/plugins/ExtendedTools/gpunodes.c
index 66e3734b12fe..3517d82c18dd 100644
--- a/plugins/ExtendedTools/gpunodes.c
+++ b/plugins/ExtendedTools/gpunodes.c
@@ -176,7 +176,7 @@ INT_PTR CALLBACK EtpGpuNodesDlgProc(
&ProcessesUpdatedCallbackRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/gpuprprp.c b/plugins/ExtendedTools/gpuprprp.c
index bfc0b9157513..48d320cc4a80 100644
--- a/plugins/ExtendedTools/gpuprprp.c
+++ b/plugins/ExtendedTools/gpuprprp.c
@@ -374,7 +374,7 @@ INT_PTR CALLBACK EtpGpuPageDlgProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/modsrv.c b/plugins/ExtendedTools/modsrv.c
index a99908cd6dc1..324b9066caa5 100644
--- a/plugins/ExtendedTools/modsrv.c
+++ b/plugins/ExtendedTools/modsrv.c
@@ -241,7 +241,7 @@ INT_PTR CALLBACK EtpModuleServicesDlgProc(
else
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/namedpipes.c b/plugins/ExtendedTools/namedpipes.c
index 1eec4d2929f6..09e7652191a4 100644
--- a/plugins/ExtendedTools/namedpipes.c
+++ b/plugins/ExtendedTools/namedpipes.c
@@ -517,7 +517,7 @@ INT_PTR CALLBACK EtPipeEnumDlgProc(
PhSetExtendedListView(context->ListViewWndHandle);
PhLoadListViewColumnsFromSetting(SETTING_NAME_PIPE_ENUM_LISTVIEW_COLUMNS_WITH_KSI, context->ListViewWndHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtEnumerateNamedPipeHandles(context);
}
@@ -539,7 +539,7 @@ INT_PTR CALLBACK EtPipeEnumDlgProc(
PhSetExtendedListView(context->ListViewWndHandle);
PhLoadListViewColumnsFromSetting(SETTING_NAME_PIPE_ENUM_LISTVIEW_COLUMNS, context->ListViewWndHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtEnumerateNamedPipeDirectory(context);
}
diff --git a/plugins/ExtendedTools/npudetails.c b/plugins/ExtendedTools/npudetails.c
index 84f82aa1699f..5f8e96d67161 100644
--- a/plugins/ExtendedTools/npudetails.c
+++ b/plugins/ExtendedTools/npudetails.c
@@ -399,7 +399,7 @@ INT_PTR CALLBACK EtpNpuDetailsDlgProc(
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtpNpuDetailsEnumAdapters(context->ListViewHandle);
diff --git a/plugins/ExtendedTools/npunodes.c b/plugins/ExtendedTools/npunodes.c
index b546bd8d0206..ffbead7c58eb 100644
--- a/plugins/ExtendedTools/npunodes.c
+++ b/plugins/ExtendedTools/npunodes.c
@@ -177,7 +177,7 @@ INT_PTR CALLBACK EtpNpuNodesDlgProc(
&ProcessesUpdatedCallbackRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/npuprprp.c b/plugins/ExtendedTools/npuprprp.c
index 5c04de00e639..31fad31de1ca 100644
--- a/plugins/ExtendedTools/npuprprp.c
+++ b/plugins/ExtendedTools/npuprprp.c
@@ -375,7 +375,7 @@ INT_PTR CALLBACK EtpNpuPageDlgProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/objmgr.c b/plugins/ExtendedTools/objmgr.c
index 57789eb399b0..92fedb5d3e36 100644
--- a/plugins/ExtendedTools/objmgr.c
+++ b/plugins/ExtendedTools/objmgr.c
@@ -26,7 +26,9 @@ static HANDLE EtObjectManagerDialogThreadHandle = NULL;
static PH_EVENT EtObjectManagerDialogInitializedEvent = PH_EVENT_INIT;
HWND EtObjectManagerDialogHandle = NULL;
+LARGE_INTEGER EtObjectManagerTimeCached = { 0 };
PPH_LIST EtObjectManagerOwnHandles = NULL;
+PPH_HASHTABLE EtObjectManagerPropWindows = NULL;
HICON EtObjectManagerPropIcon = NULL;
BOOLEAN EtObjectManagerShowHandlesPage = FALSE;
@@ -55,6 +57,11 @@ static PPH_STRING ObjectAbandonedString = NULL;
#define ETOBLVC_TARGET 2
#define ETOBLVC_OBJECT 3
+// StatusBar parts
+#define ETOBSBP_TOTAL 1
+#define ETOBSBP_VISIBLE 3
+#define ETOBSBP_HANDLES 5
+
typedef enum _ET_OBJECT_TYPE
{
EtObjectUnknown = 0,
@@ -87,6 +94,7 @@ typedef struct _ET_OBJECT_CONTEXT
HWND WindowHandle;
HWND ParentWindowHandle;
HWND ListViewHandle;
+ IListView* ListViewClass;
HWND TreeViewHandle;
HWND SearchBoxHandle;
HWND PathControlHandle;
@@ -101,10 +109,10 @@ typedef struct _ET_OBJECT_CONTEXT
HIMAGELIST ListImageList;
PPH_STRING CurrentPath;
- volatile PPH_LIST CurrentDirectoryList;
+ PPH_LIST CurrentDirectoryList;
BOOLEAN DisableSelChanged;
- PBOOLEAN BreakResolverThread;
+ volatile PBOOLEAN BreakResolverThread;
BOOLEAN UseAddressColumn;
} ET_OBJECT_CONTEXT, * PET_OBJECT_CONTEXT;
@@ -190,7 +198,7 @@ VOID NTAPI EtpObjectManagerChangeSelection(
VOID NTAPI EtpObjectManagerSortAndSelectOld(
_In_ PET_OBJECT_CONTEXT context,
- _In_opt_ PPH_STRING oldSelection
+ _In_opt_ PET_OBJECT_ENTRY OldSelection
);
VOID NTAPI EtpObjectManagerSearchControlCallback(
@@ -210,13 +218,18 @@ NTSTATUS EtpTargetResolverWorkThreadStart(
ObjectContext.Object = &entry_##ObjectContext; \
ObjectContext.FullName = NULL; \
-
#define ET_CREATE_DIRECTORY_OBJECT_ENTRY(DirectoryName, ObjectContext, Entry) \
ET_OBJECT_ENTRY Entry = { 0 }; \
Entry.Name = directory; \
Entry.EtObjectType = EtObjectDirectory; \
Entry.Context = ObjectContext; \
+#define ET_CREATE_OBJECT_CONTEXT(ObjectContext, Path, Entry) \
+ ET_HANDLE_OPEN_CONTEXT ObjectContext; \
+ ObjectContext.CurrentPath = Path; \
+ ObjectContext.Object = Entry; \
+ ObjectContext.FullName = NULL; \
+
_Success_(return)
BOOLEAN PhGetTreeViewItemParam(
_In_ HWND TreeViewHandle,
@@ -453,15 +466,15 @@ VOID EtInitializeListImages(
);
icon = PhLoadIcon(PluginInstance->DllBase, MAKEINTRESOURCE(IDI_UNKNOWN), PH_LOAD_ICON_SIZE_LARGE, size, size, dpiValue);
- PhImageListAddIcon(Context->ListImageList, icon);
+ index = PhImageListAddIcon(Context->ListImageList, icon);
DestroyIcon(icon);
icon = PhLoadIcon(PluginInstance->DllBase, MAKEINTRESOURCE(IDI_FOLDER), PH_LOAD_ICON_SIZE_LARGE, size, size, dpiValue);
- PhImageListAddIcon(Context->ListImageList, icon);
+ index = PhImageListAddIcon(Context->ListImageList, icon);
DestroyIcon(icon);
icon = PhLoadIcon(PluginInstance->DllBase, MAKEINTRESOURCE(IDI_LINK), PH_LOAD_ICON_SIZE_LARGE, size, size, dpiValue);
- PhImageListAddIcon(Context->ListImageList, icon);
+ index = PhImageListAddIcon(Context->ListImageList, icon);
DestroyIcon(icon);
icon = PhLoadIcon(PluginInstance->DllBase, MAKEINTRESOURCE(IDI_EVENT), PH_LOAD_ICON_SIZE_LARGE, size, size, dpiValue);
@@ -535,10 +548,12 @@ VOID EtInitializeListImages(
icon = PhLoadIcon(PluginInstance->DllBase, MAKEINTRESOURCE(IDI_CALLBACK), PH_LOAD_ICON_SIZE_LARGE, size, size, dpiValue);
index = PhImageListAddIcon(Context->ListImageList, icon);
DestroyIcon(icon);
+
+ assert(index + 1 == EtObjectMax);
}
static BOOLEAN NTAPI EtEnumDirectoryObjectsCallback(
- _In_ HANDLE RootDirectory,
+ _In_opt_ HANDLE RootDirectory,
_In_ PCPH_STRINGREF Name,
_In_ PCPH_STRINGREF TypeName,
_In_ PET_DIRECTORY_ENUM_CONTEXT Context
@@ -800,7 +815,7 @@ NTSTATUS EtpTargetResolverThreadStart(
if (status != STATUS_ABANDONED)
{
- entry->ItemIndex = PhFindListViewItemByParam(context->ListViewHandle, INT_ERROR, entry); // need to update index
+ entry->ItemIndex = PhFindIListViewItemByParam(context->ListViewClass, INT_ERROR, entry); // need to update index
PhQueueItemWorkQueue(&workQueue, EtpTargetResolverWorkThreadStart, entry);
}
else
@@ -827,9 +842,14 @@ NTSTATUS EtpTargetResolverThreadStart(
{
ExtendedListView_SortItems(context->ListViewHandle);
- INT index = ListView_GetNextItem(context->ListViewHandle, INT_ERROR, LVNI_SELECTED);
- if (index != INT_ERROR)
- ListView_EnsureVisible(context->ListViewHandle, index, TRUE);
+ LVITEMINDEX start = { INT_ERROR, 0 };
+ LVITEMINDEX item = { INT_ERROR, 0 };
+ IListView_GetNextItem(context->ListViewClass, start, LVNI_SELECTED, &item);
+ if (item.iItem != INT_ERROR)
+ {
+ //IListView_EnsureItemVisible(context->ListViewClass, item, FALSE);
+ ListView_EnsureVisible(context->ListViewHandle, item.iItem, FALSE);
+ }
}
}
if (curentFilter)
@@ -853,15 +873,12 @@ NTSTATUS EtpTargetResolverWorkThreadStart(
PET_OBJECT_ENTRY entry = Parameter;
NTSTATUS status;
- ET_HANDLE_OPEN_CONTEXT objectContext;
HANDLE objectHandle = NULL;
HANDLE processId = NtCurrentProcessId();
HANDLE processHandle = NtCurrentProcess();
BOOLEAN alpcSourceOpened = FALSE;
- objectContext.CurrentPath = entry->BaseDirectory;
- objectContext.Object = entry;
- objectContext.FullName = NULL;
+ ET_CREATE_OBJECT_CONTEXT(objectContext, entry->BaseDirectory, entry);
switch (entry->EtObjectType)
{
@@ -1275,8 +1292,7 @@ NTSTATUS EtpTargetResolverWorkThreadStart(
if (winStationInfo.Domain[0] == UNICODE_NULL || winStationInfo.UserName[0] == UNICODE_NULL)
{
entry->Target = PhFormatString(L"%s (%s)", winStationInfo.WinStationName, EtMapSessionConnectState(winStationInfo.ConnectState));
- }
-
+ }
else
{
entry->Target = PhFormatString(
@@ -1348,6 +1364,7 @@ NTSTATUS EtpTargetResolverWorkThreadStart(
// Target was successfully resolved, redraw list entry
entry->TargetIsResolving = FALSE;
+ //IListView_RedrawItems(entry->Context->ListViewClass, entry->ItemIndex, entry->ItemIndex);
ListView_RedrawItems(entry->Context->ListViewHandle, entry->ItemIndex, entry->ItemIndex);
PhDereferenceObject(entry);
@@ -1376,6 +1393,19 @@ NTSTATUS EtpObjectManagerStartResolver(
return PhCreateThread2(EtpTargetResolverThreadStart, threadContext);
}
+VOID StatusBarUpdate(
+ _In_ PET_OBJECT_CONTEXT Context
+ )
+{
+ WCHAR string[PH_INT32_STR_LEN_1];
+ LONG count;
+ PhPrintUInt32(string, Context->CurrentDirectoryList->Count);
+ SendMessage(Context->StatusBarHandle, SB_SETTEXT, ETOBSBP_TOTAL, (LPARAM)string);
+ IListView_GetItemCount(Context->ListViewClass, &count);
+ PhPrintUInt32(string, count);
+ SendMessage(Context->StatusBarHandle, SB_SETTEXT, ETOBSBP_VISIBLE, (LPARAM)string);
+}
+
NTSTATUS EtEnumCurrentDirectoryObjects(
_In_ PET_OBJECT_CONTEXT Context
)
@@ -1384,7 +1414,6 @@ NTSTATUS EtEnumCurrentDirectoryObjects(
HANDLE directoryHandle;
ULONG sortColumn;
PH_SORT_ORDER sortOrder;
- WCHAR string[PH_INT32_STR_LEN_1];
PhMoveReference(&Context->CurrentPath, EtGetSelectedTreeViewPath(Context));
@@ -1409,8 +1438,7 @@ NTSTATUS EtEnumCurrentDirectoryObjects(
PhSetWindowText(Context->PathControlHandle, PhGetString(Context->CurrentPath));
Edit_SetSel(Context->PathControlEdit, -2, -1);
- PhPrintUInt32(string, ListView_GetItemCount(Context->ListViewHandle));
- PhSetWindowText(Context->StatusBarHandle, PH_AUTO_T(PH_STRING, PhFormatString(L"Objects in current directory: %s", string))->Buffer);
+ StatusBarUpdate(Context);
// Apply current filter and sort
PPH_STRING curentFilter = PH_AUTO(PhGetWindowText(Context->SearchBoxHandle));
@@ -1443,10 +1471,7 @@ VOID EtObjectManagerFreeListViewItems(
PhClearReference(&Context->CurrentPath);
- for (ULONG i = 0; i < Context->CurrentDirectoryList->Count; i++)
- {
- PhDereferenceObject(Context->CurrentDirectoryList->Items[i]);
- }
+ PhDereferenceObjects(Context->CurrentDirectoryList->Items, Context->CurrentDirectoryList->Count);
//INT index = INT_ERROR;
//while ((index = PhFindListViewItemByFlags(
@@ -1478,6 +1503,20 @@ NTSTATUS EtDuplicateHandleFromProcessEx(
HANDLE processHandle;
*Handle = NULL;
+
+ if (!ProcessHandle && ProcessId == NtCurrentProcessId())
+ {
+ return NtDuplicateObject(
+ NtCurrentProcess(),
+ SourceHandle,
+ NtCurrentProcess(),
+ Handle,
+ DesiredAccess,
+ 0,
+ 0
+ );
+ }
+
processHandle = ProcessHandle;
if (ProcessHandle ||
@@ -1870,7 +1909,7 @@ NTSTATUS EtObjectManagerOpenRealObject(
NTSTATUS status = STATUS_UNSUCCESSFUL;
PPH_STRING fullName;
ULONG targetIndex;
- ULONG i;
+ ULONG_PTR i;
PSYSTEM_HANDLE_INFORMATION_EX handles;
PPH_HASHTABLE processHandleHashtable;
PVOID* processHandlePtr;
@@ -2002,14 +2041,16 @@ NTSTATUS EtObjectManagerOpenRealObject(
}
}
- i = 0;
- while (PhEnumHashtable(processHandleHashtable, &procEntry, &i))
{
- status = NtClose(procEntry->Value);
-
- if (!NT_SUCCESS(status))
+ ULONG j = 0;
+ while (PhEnumHashtable(processHandleHashtable, &procEntry, &j))
{
- PhShowStatus(NULL, L"Unidentified third party object.", status, 0);
+ NTSTATUS status = NtClose(procEntry->Value);
+
+ if (!NT_SUCCESS(status))
+ {
+ PhShowStatus(NULL, L"Unidentified third party object.", status, 0);
+ }
}
}
@@ -2217,7 +2258,6 @@ VOID NTAPI EtpObjectManagerObjectProperties(
NTSTATUS status;
NTSTATUS subStatus = STATUS_UNSUCCESSFUL;
HANDLE objectHandle = NULL;
- ET_HANDLE_OPEN_CONTEXT objectContext;
PPH_HANDLE_ITEM handleItem;
HANDLE processId = NtCurrentProcessId();
HANDLE processHandle = NtCurrentProcess();
@@ -2228,9 +2268,27 @@ VOID NTAPI EtpObjectManagerObjectProperties(
else
objectName = EtGetObjectFullPath(Entry->BaseDirectory, Entry->Name);
- objectContext.CurrentPath = PhReferenceObject(context->CurrentPath);
- objectContext.Object = PhReferenceObject(Entry);
- objectContext.FullName = NULL;
+ if (!!PhGetIntegerSetting(L"ForceNoParent"))
+ {
+ PPH_KEY_VALUE_PAIR entry;
+ ULONG i = 0;
+
+ while (PhEnumHashtable(EtObjectManagerPropWindows, &entry, &i))
+ {
+ if (PhEqualString(objectName, ((PPH_HANDLE_ITEM)entry->Value)->ObjectName, TRUE)) // HACK: activate already opened window for this object if any
+ {
+ FLASHWINFO fi = {sizeof(FLASHWINFO), entry->Key, FLASHW_CAPTION, 7, GetCaretBlinkTime() / 8};
+ ShowWindow(entry->Key, SW_SHOW);
+ SetForegroundWindow(entry->Key);
+ FlashWindowEx(&fi);
+
+ PhDereferenceObject(objectName);
+ return;
+ }
+ }
+ }
+
+ ET_CREATE_OBJECT_CONTEXT(objectContext, PhReferenceObject(context->CurrentPath), Entry);
if (Entry->EtObjectType == EtObjectDirectory)
objectContext.Object->TypeName = PhCreateString2(&DirectoryObjectType);
@@ -2251,6 +2309,7 @@ VOID NTAPI EtpObjectManagerObjectProperties(
handleItem = PhCreateHandleItem(NULL);
handleItem->Handle = objectHandle;
handleItem->TypeIndex = ULONG_MAX;
+ EtObjectManagerTimeCached.QuadPart = 0;
switch (Entry->EtObjectType)
{
@@ -2290,6 +2349,12 @@ VOID NTAPI EtpObjectManagerObjectProperties(
&handleItem->Attributes
);
+ // Show only real source object address
+ if (status == STATUS_NOT_ALL_ASSIGNED)
+ {
+ handleItem->Object = 0;
+ }
+
if (NT_SUCCESS(status = PhGetHandleInformation(
processHandle,
objectHandle,
@@ -2305,6 +2370,7 @@ VOID NTAPI EtpObjectManagerObjectProperties(
{
handleItem->Attributes = basicInfo.Attributes;
}
+ EtObjectManagerTimeCached = basicInfo.CreationTime; // all symbolic links has valid creation time (Dart Vanya)
}
if (processHandle != NtCurrentProcess())
@@ -2328,7 +2394,16 @@ VOID NTAPI EtpObjectManagerObjectProperties(
// Object Manager plugin window
PhShowHandlePropertiesEx(context->WindowHandle, processId, handleItem, PluginInstance, PhGetString(Entry->TypeName));
- PhDereferenceObject(Entry);
+ // Update the object address for items skipped by resolver
+ Entry->Object = handleItem->Object;
+ if (Entry->Object) PhPrintPointer(Entry->ObjectString, Entry->Object);
+ else Entry->ObjectString[0] = UNICODE_NULL;
+ if (Entry->Context->UseAddressColumn)
+ {
+ Entry->ItemIndex = PhFindIListViewItemByParam(context->ListViewClass, INT_ERROR, Entry);
+ IListView_RedrawItems(Entry->Context->ListViewClass, Entry->ItemIndex, Entry->ItemIndex);
+ }
+
PhDereferenceObject(objectContext.CurrentPath);
}
@@ -2349,16 +2424,18 @@ BOOLEAN EtListViewFindAndSelectItem(
LVFINDINFO findinfo;
findinfo.psz = PH_AUTO_T(PH_STRING, PhCreateString2(Name))->Buffer;
findinfo.flags = LVFI_STRING;
+ LVITEMINDEX start = { INT_ERROR, 0 };
+ LVITEMINDEX item = { INT_ERROR, 0 };
- INT item = ListView_FindItem(Context->ListViewHandle, INT_ERROR, &findinfo);
+ IListView_FindItem(Context->ListViewClass, start, &findinfo, &item);
// Navigate to target object
- if (item != INT_ERROR)
+ if (item.iItem != INT_ERROR)
{
- ListView_SetItemState(Context->ListViewHandle, item, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
- ListView_EnsureVisible(Context->ListViewHandle, item, TRUE);
+ IListView_SetItemState(Context->ListViewClass, item.iItem, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
+ IListView_EnsureItemVisible(Context->ListViewClass, item, FALSE);
}
- return item != INT_ERROR;
+ return item.iItem != INT_ERROR;
}
BOOLEAN NTAPI EtpObjectManagerOpenTarget(
@@ -2377,7 +2454,7 @@ BOOLEAN NTAPI EtpObjectManagerOpenTarget(
remainingPart = PhGetStringRef(PhReferenceObject(Target));
Context->SelectedTreeItem = Context->RootTreeObject;
- ListView_SetItemState(Context->ListViewHandle, -1, 0, LVIS_SELECTED);
+ IListView_SetItemState(Context->ListViewClass, INT_ERROR, 0, LVIS_SELECTED, 0);
PhSplitStringRefAtLastChar(&remainingPart, OBJ_NAME_PATH_SEPARATOR, &pathPart, &namePart);
@@ -2479,23 +2556,19 @@ VOID NTAPI EtpObjectManagerRefresh(
)
{
PPH_STRING currentPath = PhReferenceObject(Context->CurrentPath);
- PPH_STRING oldSelect = NULL;
- PET_OBJECT_ENTRY* listviewItems;
- ULONG numberOfItems;
+ PET_OBJECT_ENTRY oldSelect = NULL;
PH_STRINGREF directoryPart;
PH_STRINGREF remainingPart;
BOOLEAN reverseScan = FALSE;
- SendMessage(Context->TreeViewHandle, WM_SETREDRAW, FALSE, 0);
-
- PhGetSelectedListViewItemParams(Context->ListViewHandle, &listviewItems, &numberOfItems);
- if (numberOfItems != 0)
- oldSelect = PhReferenceObject(listviewItems[0]->Name);
+ if (oldSelect = PhGetSelectedIListViewItemParam(Context->ListViewClass))
+ PhReferenceObject(oldSelect);
+ SendMessage(Context->TreeViewHandle, WM_SETREDRAW, FALSE, 0);
ExtendedListView_SetRedraw(Context->ListViewHandle, FALSE);
EtObjectManagerFreeListViewItems(Context);
- ListView_DeleteAllItems(Context->ListViewHandle);
+ IListView_DeleteAllItems(Context->ListViewClass);
EtCleanupTreeViewItemParams(Context, Context->RootTreeObject);
TreeView_DeleteAllItems(Context->TreeViewHandle);
@@ -2547,12 +2620,11 @@ VOID NTAPI EtpObjectManagerRefresh(
// Reapply old selection
EtpObjectManagerSortAndSelectOld(Context, oldSelect);
+ SendMessage(Context->TreeViewHandle, WM_SETREDRAW, TRUE, 0);
ExtendedListView_SetRedraw(Context->ListViewHandle, TRUE);
Context->DisableSelChanged = FALSE;
PhDereferenceObject(currentPath);
-
- SendMessage(Context->TreeViewHandle, WM_SETREDRAW, TRUE, 0);
}
VOID NTAPI EtpObjectManagerOpenSecurity(
@@ -2598,18 +2670,15 @@ VOID NTAPI EtpObjectManagerSearchControlCallback(
)
{
PET_OBJECT_CONTEXT context = Context;
- PET_OBJECT_ENTRY* listviewItems;
- ULONG numberOfItems;
- PPH_STRING oldSelect = NULL;
+ PET_OBJECT_ENTRY oldSelect = NULL;
assert(context);
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
- if (numberOfItems != 0)
- oldSelect = PhReferenceObject(listviewItems[0]->Name);
+ if (oldSelect = PhGetSelectedIListViewItemParam(context->ListViewClass))
+ PhReferenceObject(oldSelect);
ExtendedListView_SetRedraw(context->ListViewHandle, FALSE);
- ListView_DeleteAllItems(context->ListViewHandle);
+ IListView_DeleteAllItems(context->ListViewClass);
PPH_LIST Array = context->CurrentDirectoryList;
@@ -2624,8 +2693,8 @@ VOID NTAPI EtpObjectManagerSearchControlCallback(
entry->Object && PhSearchControlMatchPointer(MatchHandle, entry->Object)
)
{
- entry->ItemIndex = PhAddListViewItem(context->ListViewHandle, MAXINT, LPSTR_TEXTCALLBACK, entry);
- PhSetListViewItemImageIndex(context->ListViewHandle, entry->ItemIndex, entry->EtObjectType);
+ entry->ItemIndex = PhAddIListViewItem(context->ListViewClass, MAXINT, LPSTR_TEXTCALLBACK, entry);
+ PhSetIListViewItemImageIndex(context->ListViewClass, entry->ItemIndex, entry->EtObjectType);
}
}
@@ -2634,23 +2703,21 @@ VOID NTAPI EtpObjectManagerSearchControlCallback(
ExtendedListView_SetRedraw(context->ListViewHandle, TRUE);
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
- if (numberOfItems != 0)
- oldSelect = EtGetObjectFullPath(listviewItems[0]->BaseDirectory, listviewItems[0]->Name);
+ PPH_STRING currentPath;
+ if (oldSelect = PhGetSelectedIListViewItemParam(context->ListViewClass))
+ currentPath = EtGetObjectFullPath(oldSelect->BaseDirectory, oldSelect->Name);
else
- oldSelect = PhReferenceObject(context->CurrentPath);
+ currentPath = PhReferenceObject(context->CurrentPath);
- PhSetDialogItemText(context->WindowHandle, IDC_OBJMGR_PATH, PhGetString(oldSelect));
- PhDereferenceObject(oldSelect);
+ PhSetWindowText(context->PathControlHandle, PhGetString(currentPath));
+ PhDereferenceObject(currentPath);
- WCHAR string[PH_INT32_STR_LEN_1];
- PhPrintUInt32(string, ListView_GetItemCount(context->ListViewHandle));
- PhSetWindowText(context->StatusBarHandle, PH_AUTO_T(PH_STRING, PhFormatString(L"Objects in current directory: %s", string))->Buffer);
+ StatusBarUpdate(context);
}
VOID NTAPI EtpObjectManagerSortAndSelectOld(
_In_ PET_OBJECT_CONTEXT Context,
- _In_opt_ PPH_STRING OldSelection
+ _In_opt_ PET_OBJECT_ENTRY OldSelection
)
{
ULONG sortColumn;
@@ -2664,15 +2731,17 @@ VOID NTAPI EtpObjectManagerSortAndSelectOld(
if (OldSelection)
{
LVFINDINFO findinfo;
- findinfo.psz = OldSelection->Buffer;
+ findinfo.psz = PhGetString(OldSelection->Name);
findinfo.flags = LVFI_STRING;
+ LVITEMINDEX start = { INT_ERROR, 0 };
+ LVITEMINDEX item = { INT_ERROR, 0 };
- INT item = ListView_FindItem(Context->ListViewHandle, INT_ERROR, &findinfo);
+ IListView_FindItem(Context->ListViewClass, start, &findinfo, &item);
- if (item != INT_ERROR)
+ if (item.iItem != INT_ERROR)
{
- ListView_SetItemState(Context->ListViewHandle, item, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
- ListView_EnsureVisible(Context->ListViewHandle, item, TRUE);
+ IListView_SetItemState(Context->ListViewClass, item.iItem, 0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
+ IListView_EnsureItemVisible(Context->ListViewClass, item, FALSE);
}
PhDereferenceObject(OldSelection);
@@ -2688,7 +2757,7 @@ VOID NTAPI EtpObjectManagerChangeSelection(
if (!Context->DisableSelChanged)
ExtendedListView_SetRedraw(Context->ListViewHandle, FALSE);
EtObjectManagerFreeListViewItems(Context);
- ListView_DeleteAllItems(Context->ListViewHandle);
+ IListView_DeleteAllItems(Context->ListViewClass);
EtEnumCurrentDirectoryObjects(Context);
@@ -2707,7 +2776,6 @@ VOID EtpObjectManagerCopyObjectAddress(
HANDLE objectHandle;
HANDLE processId = NtCurrentProcessId();
HANDLE processHandle = NtCurrentProcess();
- ET_HANDLE_OPEN_CONTEXT objectContext;
if (Entry->Object)
{
@@ -2716,9 +2784,7 @@ VOID EtpObjectManagerCopyObjectAddress(
return;
}
- objectContext.CurrentPath = PhReferenceObject(context->CurrentPath);
- objectContext.Object = PhReferenceObject(Entry);
- objectContext.FullName = NULL;
+ ET_CREATE_OBJECT_CONTEXT(objectContext, PhReferenceObject(context->CurrentPath), Entry);
if (NT_SUCCESS(status = EtObjectManagerOpenHandle(&objectHandle, &objectContext, READ_CONTROL, OBJECT_OPENSOURCE_ALL)) ||
NT_SUCCESS(status = EtObjectManagerOpenRealObject(&objectHandle, &objectContext, 0, &processId)))
@@ -2746,7 +2812,11 @@ VOID EtpObjectManagerCopyObjectAddress(
{
Entry->Object = objectAddress;
PhPrintPointer(Entry->ObjectString, objectAddress);
- ListView_RedrawItems(Entry->Context->ListViewHandle, Entry->ItemIndex, Entry->ItemIndex);
+ if (Entry->Context->UseAddressColumn)
+ {
+ Entry->ItemIndex = PhFindIListViewItemByParam(context->ListViewClass, INT_ERROR, Entry);
+ IListView_RedrawItems(Entry->Context->ListViewClass, Entry->ItemIndex, Entry->ItemIndex);
+ }
PhInitializeStringRef(&pointer, Entry->ObjectString);
}
}
@@ -2757,7 +2827,6 @@ VOID EtpObjectManagerCopyObjectAddress(
cleanup_exit:
PhSetClipboardString(context->WindowHandle, &pointer);
- PhDereferenceObject(Entry);
PhDereferenceObject(objectContext.CurrentPath);
}
@@ -2776,7 +2845,7 @@ VOID EtpObjectEntryDeleteProcedure(
PhClearReference(&entry->BaseDirectory);
}
-VOID EtpLoadComboBoxHistoryToSettings(
+VOID EtpLoadComboBoxHistoryFromSettings(
_In_ PET_OBJECT_CONTEXT Context
)
{
@@ -2891,18 +2960,16 @@ INT_PTR CALLBACK WinObjDlgProc(
context->ParentWindowHandle = (HWND)lParam;
context->TreeViewHandle = GetDlgItem(hwndDlg, IDC_OBJMGR_TREE);
context->ListViewHandle = GetDlgItem(hwndDlg, IDC_OBJMGR_LIST);
+ context->ListViewClass = PhGetListViewInterface(context->ListViewHandle);
context->SearchBoxHandle = GetDlgItem(hwndDlg, IDC_OBJMGR_SEARCH);
context->PathControlHandle = GetDlgItem(hwndDlg, IDC_OBJMGR_PATH);
-
if (GetComboBoxInfo(context->PathControlHandle, &info))
- {
context->PathControlEdit = info.hwndItem;
- SetWindowFont(context->PathControlHandle, GetWindowFont(hwndDlg), TRUE);
- }
-
context->CurrentDirectoryList = PhCreateList(100);
if (!EtObjectManagerOwnHandles || !PhReferenceObjectSafe(EtObjectManagerOwnHandles))
EtObjectManagerOwnHandles = PhCreateList(10);
+ if (!EtObjectManagerPropWindows || !PhReferenceObjectSafe(EtObjectManagerPropWindows))
+ EtObjectManagerPropWindows = PhCreateSimpleHashtable(10);
PhSetApplicationWindowIcon(hwndDlg);
@@ -2918,13 +2985,13 @@ INT_PTR CALLBACK WinObjDlgProc(
PhSetControlTheme(context->ListViewHandle, L"explorer");
PhSetListViewStyle(context->ListViewHandle, TRUE, FALSE);
PhSetExtendedListView(context->ListViewHandle);
- ListView_SetImageList(context->ListViewHandle, context->ListImageList, LVSIL_SMALL);
- PhAddListViewColumn(context->ListViewHandle, ETOBLVC_NAME, ETOBLVC_NAME, ETOBLVC_NAME, LVCFMT_LEFT, 445, L"Name");
- PhAddListViewColumn(context->ListViewHandle, ETOBLVC_TYPE, ETOBLVC_TYPE, ETOBLVC_TYPE, LVCFMT_LEFT, 150, L"Type");
- PhAddListViewColumn(context->ListViewHandle, ETOBLVC_TARGET, ETOBLVC_TARGET, ETOBLVC_TARGET, LVCFMT_LEFT, 200, L"Target");
+ IListView_SetImageList(context->ListViewClass, LVSIL_SMALL, context->ListImageList, NULL);
+ PhAddIListViewColumn(context->ListViewClass, ETOBLVC_NAME, ETOBLVC_NAME, ETOBLVC_NAME, LVCFMT_LEFT, 445, L"Name");
+ PhAddIListViewColumn(context->ListViewClass, ETOBLVC_TYPE, ETOBLVC_TYPE, ETOBLVC_TYPE, LVCFMT_LEFT, 150, L"Type");
+ PhAddIListViewColumn(context->ListViewClass, ETOBLVC_TARGET, ETOBLVC_TARGET, ETOBLVC_TARGET, LVCFMT_LEFT, 200, L"Target");
context->UseAddressColumn = KsiLevel() >= KphLevelMed;
if (context->UseAddressColumn)
- PhAddListViewColumn(context->ListViewHandle, ETOBLVC_OBJECT, ETOBLVC_OBJECT, ETOBLVC_OBJECT, LVCFMT_LEFT, 120, L"Object address");
+ PhAddIListViewColumn(context->ListViewClass, ETOBLVC_OBJECT, ETOBLVC_OBJECT, ETOBLVC_OBJECT, LVCFMT_LEFT, 120, L"Object address");
PhLoadListViewColumnsFromSetting(SETTING_NAME_OBJMGR_COLUMNS, context->ListViewHandle);
PH_INTEGER_PAIR sortSettings;
@@ -2964,12 +3031,19 @@ INT_PTR CALLBACK WinObjDlgProc(
0,
hwndDlg,
NULL,
- NULL,
+ PluginInstance->DllBase,
NULL
);
PhAddLayoutItem(&context->LayoutManager, context->StatusBarHandle, NULL, PH_ANCHOR_LEFT | PH_ANCHOR_BOTTOM | PH_ANCHOR_RIGHT | PH_LAYOUT_IMMEDIATE_RESIZE);
+ ULONG i;
+ ULONG widths[] = { i = 155, i += 40, i += 60, -1 };
+ SendMessage(context->StatusBarHandle, SB_SETPARTS, ARRAYSIZE(widths), (LPARAM)widths);
+ SendMessage(context->StatusBarHandle, SB_SETTEXT, ETOBSBP_TOTAL - 1, (LPARAM)L"Objects in current directory");
+ SendMessage(context->StatusBarHandle, SB_SETTEXT, ETOBSBP_VISIBLE - 1, (LPARAM)L"Visible");
+ //SendMessage(context->StatusBarHandle, SB_SETTEXT, ETOBSBP_HANDLES - 1, (LPARAM)L"Handles");
+
if (PhGetIntegerPairSetting(SETTING_NAME_OBJMGR_WINDOW_POSITION).X != 0)
PhLoadWindowPlacementFromSetting(SETTING_NAME_OBJMGR_WINDOW_POSITION, SETTING_NAME_OBJMGR_WINDOW_SIZE, hwndDlg);
else
@@ -2981,25 +3055,20 @@ INT_PTR CALLBACK WinObjDlgProc(
context->CurrentPath
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
- {
- PPH_STRING Target = PH_AUTO(PhGetStringSetting(SETTING_NAME_OBJMGR_LAST_PATH));
+ PPH_STRING Target = PH_AUTO(PhGetStringSetting(SETTING_NAME_OBJMGR_LAST_PATH));
+ if (PhIsNullOrEmptyString(Target)) // HACK
+ Target = PH_AUTO(PhCreateString2(&EtObjectManagerRootDirectoryObject));
- if (PhIsNullOrEmptyString(Target)) // HACK
- {
- Target = PH_AUTO(PhCreateString2(&EtObjectManagerRootDirectoryObject));
- }
+ EtpLoadComboBoxHistoryFromSettings(context);
- EtpLoadComboBoxHistoryToSettings(context);
+ context->DisableSelChanged = TRUE;
+ EtpObjectManagerOpenTarget(context, Target);
+ TreeView_EnsureVisible(context->TreeViewHandle, context->SelectedTreeItem);
+ context->DisableSelChanged = FALSE;
- context->DisableSelChanged = TRUE;
- EtpObjectManagerOpenTarget(context, Target);
- TreeView_EnsureVisible(context->TreeViewHandle, context->SelectedTreeItem);
- context->DisableSelChanged = FALSE;
-
- EtEnumCurrentDirectoryObjects(context);
- }
+ EtEnumCurrentDirectoryObjects(context);
PhSetDialogFocus(hwndDlg, context->TreeViewHandle);
ExtendedListView_SetColumnWidth(context->ListViewHandle, 0, ELVSCW_AUTOSIZE_REMAININGSPACE);
@@ -3023,6 +3092,8 @@ INT_PTR CALLBACK WinObjDlgProc(
PhDereferenceObject(context->CurrentDirectoryList);
if (EtObjectManagerOwnHandles)
PhDereferenceObject(EtObjectManagerOwnHandles);
+ if (EtObjectManagerPropWindows)
+ PhDereferenceObject(EtObjectManagerPropWindows);
PhSaveWindowPlacementToSetting(SETTING_NAME_OBJMGR_WINDOW_POSITION, SETTING_NAME_OBJMGR_WINDOW_SIZE, hwndDlg);
PhSaveListViewColumnsToSetting(SETTING_NAME_OBJMGR_COLUMNS, context->ListViewHandle);
@@ -3039,6 +3110,8 @@ INT_PTR CALLBACK WinObjDlgProc(
PhDeleteLayoutManager(&context->LayoutManager);
+ PhDestroyListViewInterface(context->ListViewClass);
+
PostQuitMessage(0);
}
break;
@@ -3176,21 +3249,23 @@ INT_PTR CALLBACK WinObjDlgProc(
LPNMITEMACTIVATE info = (LPNMITEMACTIVATE)header;
PET_OBJECT_ENTRY entry;
- if (header->hwndFrom == context->ListViewHandle &&
- (entry = PhGetSelectedListViewItemParam(context->ListViewHandle)))
+ if (header->hwndFrom == context->ListViewHandle)
{
- if (GetKeyState(VK_CONTROL) < 0)
- {
- EtpObjectManagerOpenSecurity(entry);
- }
- else if (entry->EtObjectType == EtObjectSymLink && !(GetKeyState(VK_SHIFT) < 0))
+ if (entry = PhGetSelectedIListViewItemParam(context->ListViewClass))
{
- if (!PhIsNullOrEmptyString(entry->Target))
- EtpObjectManagerOpenTarget(context, entry->TargetDrvLow ? entry->TargetDrvLow : entry->Target); // HACK
- }
- else
- {
- EtpObjectManagerObjectProperties(entry);
+ if (GetKeyState(VK_CONTROL) < 0)
+ {
+ EtpObjectManagerOpenSecurity(entry);
+ }
+ else if (entry->EtObjectType == EtObjectSymLink && !(GetKeyState(VK_SHIFT) < 0))
+ {
+ if (!PhIsNullOrEmptyString(entry->Target))
+ EtpObjectManagerOpenTarget(context, entry->TargetDrvLow ? entry->TargetDrvLow : entry->Target); // HACK
+ }
+ else
+ {
+ EtpObjectManagerObjectProperties(entry);
+ }
}
}
}
@@ -3204,25 +3279,27 @@ INT_PTR CALLBACK WinObjDlgProc(
if ((keyDown->wVKey == 'C' || keyDown->wVKey == 'H') && GetKeyState(VK_CONTROL))
{
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
+ PhGetSelectedIListViewItemParams(context->ListViewClass, &listviewItems, &numberOfItems);
if (numberOfItems == 1)
{
+ PET_OBJECT_ENTRY entry = listviewItems[0];
+
if (keyDown->wVKey == 'C')
{
if (GetKeyState(VK_MENU) < 0)
{
- PhSetClipboardString(hwndDlg, &PH_AUTO_T(PH_STRING, EtGetObjectFullPath(listviewItems[0]->BaseDirectory, listviewItems[0]->Name))->sr);
+ PhSetClipboardString(hwndDlg, &PH_AUTO_T(PH_STRING, EtGetObjectFullPath(entry->BaseDirectory, entry->Name))->sr);
break;
}
else if (GetKeyState(VK_SHIFT) < 0)
{
- EtpObjectManagerCopyObjectAddress(listviewItems[0]);
+ EtpObjectManagerCopyObjectAddress(entry);
break;
}
}
else
{
- EtpObjectManagerObjectHandles(listviewItems[0]);
+ EtpObjectManagerObjectHandles(entry);
}
}
}
@@ -3270,16 +3347,18 @@ INT_PTR CALLBACK WinObjDlgProc(
if ((HWND)wParam == context->ListViewHandle)
{
- PVOID *listviewItems;
+ PET_OBJECT_ENTRY* listviewItems;
ULONG numberOfItems;
point.x = GET_X_LPARAM(lParam);
point.y = GET_Y_LPARAM(lParam);
if (point.x == -1 && point.y == -1)
- PhGetListViewContextMenuPoint(context->ListViewHandle, &point);
+ PhGetIListViewContextMenuPoint(context->ListViewClass, &point);
- if (WindowFromPoint(point) == ListView_GetHeader(context->ListViewHandle))
+ HWND headerControl = NULL;
+ IListView_GetHeaderControl(context->ListViewClass, &headerControl);
+ if (WindowFromPoint(point) == headerControl)
{
ULONG sortColumn;
PH_SORT_ORDER sortOrder;
@@ -3310,7 +3389,7 @@ INT_PTR CALLBACK WinObjDlgProc(
break;
}
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
+ PhGetSelectedIListViewItemParams(context->ListViewClass, &listviewItems, &numberOfItems);
if (numberOfItems != 0)
{
PET_OBJECT_ENTRY entry = listviewItems[0];
@@ -3385,7 +3464,7 @@ INT_PTR CALLBACK WinObjDlgProc(
PhInsertEMenuItem(menu, copyPathMenuItem = PhCreateEMenuItem(0, IDC_COPYPATH, L"Copy &Full Name\bCtrl+Alt+C", NULL, NULL), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuSeparator(), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_COPY, L"&Copy\bCtrl+C", NULL, NULL), ULONG_MAX);
- PhInsertCopyListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle);
+ PhInsertCopyIListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle, context->ListViewClass);
PhSetFlagsEMenuItem(menu, isSymlink ? IDC_OPENLINK : IDC_PROPERTIES, PH_EMENU_DEFAULT, PH_EMENU_DEFAULT);
if (numberOfItems > 1)
@@ -3481,7 +3560,7 @@ INT_PTR CALLBACK WinObjDlgProc(
PhGetString(target),
FALSE,
L"Make sure the Explorer executable file is present."
- );
+ );
}
else
{
@@ -3496,7 +3575,7 @@ INT_PTR CALLBACK WinObjDlgProc(
break;
case IDC_COPY:
{
- PhCopyListView(context->ListViewHandle);
+ PhCopyIListView(context->ListViewHandle, context->ListViewClass);
}
break;
case IDC_COPYPATH:
@@ -3552,8 +3631,6 @@ INT_PTR CALLBACK WinObjDlgProc(
PhInsertEMenuItem(menu, PhCreateEMenuSeparator(), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_COPY, L"&Copy\bCtrl+C", NULL, NULL), ULONG_MAX);
- PhInsertCopyListViewEMenuItem(menu, IDC_COPYOBJECTADDRESS, context->ListViewHandle);
-
item = PhShowEMenu(
menu,
hwndDlg,
@@ -3616,101 +3693,103 @@ INT_PTR CALLBACK WinObjDlgProc(
{
switch (LOWORD(wParam))
{
- case 'K':
- if (GetKeyState(VK_CONTROL) < 0)
- {
- SetFocus(context->SearchBoxHandle);
- return TRUE;
- }
- break;
- case VK_F5:
- {
- EtpObjectManagerRefresh(context);
- return TRUE;
- }
- break;
- case VK_RETURN:
- if (GetFocus() == context->ListViewHandle)
+ case 'K':
+ if (GetKeyState(VK_CONTROL) < 0)
+ {
+ SetFocus(context->SearchBoxHandle);
+ return TRUE;
+ }
+ break;
+ case VK_F5:
+ {
+ EtpObjectManagerRefresh(context);
+ return TRUE;
+ }
+ break;
+ case VK_RETURN:
+ if (GetFocus() == context->ListViewHandle)
+ {
+ PET_OBJECT_ENTRY* listviewItems;
+ ULONG numberOfItems;
+
+ PhGetSelectedIListViewItemParams(context->ListViewClass, &listviewItems, &numberOfItems);
+ if (numberOfItems == 1)
{
- PET_OBJECT_ENTRY* listviewItems;
- ULONG numberOfItems;
+ PET_OBJECT_ENTRY entry = listviewItems[0];
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
- if (numberOfItems == 1)
+ if (entry->EtObjectType == EtObjectSymLink && GetKeyState(VK_SHIFT) < 0)
{
- if (listviewItems[0]->EtObjectType == EtObjectSymLink && GetKeyState(VK_SHIFT) < 0)
- {
- EtpObjectManagerObjectProperties(listviewItems[0]);
- }
- else if (GetKeyState(VK_CONTROL) < 0)
+ EtpObjectManagerObjectProperties(entry);
+ }
+ else if (GetKeyState(VK_CONTROL) < 0)
+ {
+ EtpObjectManagerOpenSecurity(entry);
+ }
+ else
+ {
+ if (entry->EtObjectType == EtObjectSymLink)
{
- EtpObjectManagerOpenSecurity(listviewItems[0]);
+ if (!PhIsNullOrEmptyString(entry->Target))
+ EtpObjectManagerOpenTarget(context, entry->TargetDrvLow ? entry->TargetDrvLow : entry->Target); // HACK
+ else
+ break;
}
else
{
- if (listviewItems[0]->EtObjectType == EtObjectSymLink)
- {
- if (!PhIsNullOrEmptyString(listviewItems[0]->Target))
- EtpObjectManagerOpenTarget(context, listviewItems[0]->TargetDrvLow ? listviewItems[0]->TargetDrvLow : listviewItems[0]->Target); // HACK
- else
- break;
- }
- else
- {
- EtpObjectManagerObjectProperties(listviewItems[0]);
- }
+ EtpObjectManagerObjectProperties(entry);
}
-
- return TRUE;
}
+
+ return TRUE;
}
- else if (GetFocus() == context->TreeViewHandle)
- {
- PPH_STRING directory;
+ }
+ else if (GetFocus() == context->TreeViewHandle)
+ {
+ PPH_STRING directory;
- if (GetKeyState(VK_SHIFT) < 0)
+ if (GetKeyState(VK_SHIFT) < 0)
+ {
+ if (PhGetTreeViewItemParam(context->TreeViewHandle, context->SelectedTreeItem, &directory, NULL))
{
- if (PhGetTreeViewItemParam(context->TreeViewHandle, context->SelectedTreeItem, &directory, NULL))
- {
- ET_CREATE_DIRECTORY_OBJECT_ENTRY(directory, context, entry);
- EtpObjectManagerObjectProperties(&entry);
- return TRUE;
- }
+ ET_CREATE_DIRECTORY_OBJECT_ENTRY(directory, context, entry);
+ EtpObjectManagerObjectProperties(&entry);
+ return TRUE;
}
- else if (GetKeyState(VK_CONTROL) < 0)
+ }
+ else if (GetKeyState(VK_CONTROL) < 0)
+ {
+ if (PhGetTreeViewItemParam(context->TreeViewHandle, context->SelectedTreeItem, &directory, NULL))
{
- if (PhGetTreeViewItemParam(context->TreeViewHandle, context->SelectedTreeItem, &directory, NULL))
- {
- ET_CREATE_DIRECTORY_OBJECT_ENTRY(directory, context, entry);
- EtpObjectManagerOpenSecurity(&entry);
- return TRUE;
- }
+ ET_CREATE_DIRECTORY_OBJECT_ENTRY(directory, context, entry);
+ EtpObjectManagerOpenSecurity(&entry);
+ return TRUE;
}
}
- else if (GetFocus() == context->PathControlEdit)
- {
- PPH_STRING newTarget = PH_AUTO(PhGetWindowText(context->PathControlHandle));
- PPH_STRING comboEntry;
- BOOLEAN alreadyExist = FALSE;
+ }
+ else if (GetFocus() == context->PathControlEdit)
+ {
+ PPH_STRING newTarget = PH_AUTO(PhGetWindowText(context->PathControlHandle));
+ PPH_STRING comboEntry;
+ BOOLEAN alreadyExist = FALSE;
- if (!PhIsNullOrEmptyString(newTarget) &&
- EtpObjectManagerOpenTarget(context, newTarget))
+ if (!PhIsNullOrEmptyString(newTarget) &&
+ EtpObjectManagerOpenTarget(context, newTarget))
+ {
+ for (INT i = 0; i < ComboBox_GetCount(context->PathControlHandle); i++)
{
- for (INT i = 0; i < ComboBox_GetCount(context->PathControlHandle); i++)
+ comboEntry = PH_AUTO(PhGetComboBoxString(context->PathControlHandle, i));
+ if (PhEqualString(newTarget, comboEntry, TRUE))
{
- comboEntry = PH_AUTO(PhGetComboBoxString(context->PathControlHandle, i));
- if (PhEqualString(newTarget, comboEntry, TRUE))
- {
- alreadyExist = TRUE;
- break;
- }
+ alreadyExist = TRUE;
+ break;
}
-
- if (!alreadyExist)
- ComboBox_InsertString(context->PathControlHandle, 0, PhGetString(newTarget));
}
+
+ if (!alreadyExist)
+ ComboBox_InsertString(context->PathControlHandle, 0, PhGetString(newTarget));
}
- break;
+ }
+ break;
}
break;
}
@@ -3750,6 +3829,11 @@ NTSTATUS EtShowObjectManagerDialogThread(
if (result == INT_ERROR)
break;
+ if (message.message == WM_KEYDOWN /*|| message.message == WM_KEYUP*/) // forward key messages, need for F5 and Return (Dart Vanya)
+ {
+ CallWindowProc(WinObjDlgProc, EtObjectManagerDialogHandle, message.message, message.wParam, message.lParam);
+ }
+
if (!IsDialogMessage(EtObjectManagerDialogHandle, &message))
{
TranslateMessage(&message);
diff --git a/plugins/ExtendedTools/objprp.c b/plugins/ExtendedTools/objprp.c
index 86fb08770178..996bb0de3d15 100644
--- a/plugins/ExtendedTools/objprp.c
+++ b/plugins/ExtendedTools/objprp.c
@@ -38,6 +38,7 @@ typedef struct _COMMON_PAGE_CONTEXT
HANDLE ProcessId;
HWND WindowHandle;
HWND ListViewHandle;
+ IListView* ListViewClass;
// Handles tab
ULONG TotalHandlesCount;
@@ -147,7 +148,7 @@ VOID EtHandlePropertiesInitializing(
}
// Object Manager
- if (EtObjectManagerDialogHandle)
+ if (EtObjectManagerDialogHandle && context->OwnerPlugin == PluginInstance)
{
page = EtpCommonCreatePage(
context,
@@ -199,7 +200,7 @@ VOID EtHandlePropertiesInitializing(
typedef enum _ET_OBJECT_GENERAL_CATEGORY
{
- OBJECT_GENERAL_CATEGORY_DEVICE = PH_PLUGIN_HANDLE_GENERAL_CATEGORY_MAXIMUM,
+ OBJECT_GENERAL_CATEGORY_DEVICE = PH_HANDLE_GENERAL_CATEGORY_MAXIMUM,
OBJECT_GENERAL_CATEGORY_DRIVER,
OBJECT_GENERAL_CATEGORY_TYPE,
OBJECT_GENERAL_CATEGORY_TYPE_ACCESS,
@@ -267,6 +268,7 @@ typedef enum _ET_OBJECT_POOLTYPE
#define OBJECT_CHILD_HANDLEPROP_WINDOW 1
#define OBJECT_CORRECT_HANDLES_COUNT(real_count) ((ULONG)(real_count) - 1)
+#define OBJECT_HANDLES_CONTEXT_TAG (ULONG)'OBJH'
typedef struct _ET_GENERAL_PAGE_CONTEXT
{
WNDPROC OldWndProc;
@@ -284,7 +286,7 @@ LRESULT CALLBACK EtpGeneralPageWindowSubclassProc(
PET_GENERAL_PAGE_CONTEXT context;
WNDPROC oldWndProc;
- if (!(context = PhGetWindowContext(hWnd, 'OBJH')))
+ if (!(context = PhGetWindowContext(hWnd, OBJECT_HANDLES_CONTEXT_TAG)))
return FALSE;
oldWndProc = context->OldWndProc;
@@ -294,66 +296,87 @@ LRESULT CALLBACK EtpGeneralPageWindowSubclassProc(
case WM_NCDESTROY:
{
PhSetWindowProcedure(hWnd, oldWndProc);
- PhRemoveWindowContext(hWnd, 'OBJH');
+ PhRemoveWindowContext(hWnd, OBJECT_HANDLES_CONTEXT_TAG);
PhFree(context);
}
break;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->code == PSN_QUERYINITIALFOCUS) // HACK
+ {
+ if (!context->PageSwitched)
+ {
+ PropSheet_SetCurSel(context->ParentWindow, NULL, 1);
+ context->PageSwitched = TRUE;
+ }
+ }
+ break;
}
- //if (uMsg == WM_NOTIFY && ((LPNMHDR)lParam)->code == PSN_QUERYINITIALFOCUS) // HACK
- //{
- // if (!context->PageSwitched)
- // {
- // PropSheet_SetCurSel(context->ParentWindow, NULL, 1);
- // context->PageSwitched = TRUE;
- // }
- //}
-
return CallWindowProc(oldWndProc, hWnd, uMsg, wParam, lParam);
}
+_Success_(return)
+BOOLEAN FORCEINLINE EtFindIListViewItemByIndexParam(
+ _In_ IListView* ListViewClass,
+ _In_ LONG Index,
+ _Out_ PLONG FoundIndex
+ )
+{
+ BOOLEAN found;
+ LONG index;
+
+ if (found = (index = PhFindIListViewItemByParam(ListViewClass, INT_ERROR, UlongToPtr(Index))) != INT_ERROR)
+ *FoundIndex = index;
+
+ return found;
+}
+
VOID EtHandlePropertiesWindowInitialized(
_In_ PVOID Parameter
)
{
- PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT context = Parameter;
+ static INT EtListViewRowCache[PH_HANDLE_GENERAL_INDEX_MAXIMUM];
+
+ PPH_HANDLE_PROPERTIES_CONTEXT context = Parameter;
WCHAR string[PH_INT64_STR_LEN_1];
+ LONG index;
- if (EtObjectManagerDialogHandle)
+ // Object Manager
+ if (EtObjectManagerDialogHandle && context->OwnerPlugin == PluginInstance)
{
+ PhReferenceObject(EtObjectManagerPropWindows);
+ PhAddItemSimpleHashtable(EtObjectManagerPropWindows, context->ParentWindow, context->HandleItem);
+
// HACK
- //if (PhGetIntegerPairSetting(SETTING_NAME_OBJMGR_PROPERTIES_WINDOW_POSITION).X != 0)
- // PhLoadWindowPlacementFromSetting(SETTING_NAME_OBJMGR_PROPERTIES_WINDOW_POSITION, NULL, context->ParentWindow);
- //else
- // PhCenterWindow(context->ParentWindow, GetParent(context->ParentWindow)); // HACK
+ if (PhGetIntegerPairSetting(SETTING_NAME_OBJMGR_PROPERTIES_WINDOW_POSITION).X != 0)
+ PhLoadWindowPlacementFromSetting(SETTING_NAME_OBJMGR_PROPERTIES_WINDOW_POSITION, NULL, context->ParentWindow);
+ else
+ PhCenterWindow(context->ParentWindow, GetParent(context->ParentWindow)); // HACK
PhSetWindowIcon(context->ParentWindow, EtObjectManagerPropIcon, NULL, 0);
// Open Handles page if needed
- //if (EtObjectManagerShowHandlesPage)
- //{
- // HWND generalPage = GetParent(context->ListViewHandle); // HACK
- // PET_GENERAL_PAGE_CONTEXT pageContext = PhAllocateZero(sizeof(ET_GENERAL_PAGE_CONTEXT));
- // pageContext->OldWndProc = PhGetWindowProcedure(generalPage);
- // pageContext->ParentWindow = context->ParentWindow;
- // PhSetWindowContext(generalPage, 'OBJH', pageContext);
- // PhSetWindowProcedure(generalPage, EtpGeneralPageWindowSubclassProc);
- //
- // EtObjectManagerShowHandlesPage = FALSE;
- //}
+ if (EtObjectManagerShowHandlesPage)
+ {
+ HWND generalPage = context->WindowHandle;
+ PET_GENERAL_PAGE_CONTEXT pageContext = PhAllocateZero(sizeof(ET_GENERAL_PAGE_CONTEXT));
+ pageContext->OldWndProc = PhGetWindowProcedure(generalPage);
+ pageContext->ParentWindow = context->ParentWindow;
+ PhSetWindowContext(generalPage, OBJECT_HANDLES_CONTEXT_TAG, pageContext);
+ PhSetWindowProcedure(generalPage, EtpGeneralPageWindowSubclassProc);
+ EtObjectManagerShowHandlesPage = FALSE;
+ }
// Show real handles count
- if (context->ProcessId == NtCurrentProcessId())
+ if (context->ProcessId == NtCurrentProcessId() &&
+ EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_HANDLES, &index))
{
ULONG64 real_count = ULONG64_MAX;
- PPH_STRING count;
-
- count = PH_AUTO(PhGetListViewItemText(context->ListViewHandle, PH_PLUGIN_HANDLE_GENERAL_INDEX_HANDLES, 1));
-
+ PPH_STRING count = PH_AUTO(PhGetIListViewItemText(context->ListViewClass, index, 1));
if (!PhIsNullOrEmptyString(count) && PhStringToUInt64(&count->sr, 0, &real_count) && real_count > 0)
{
PhPrintUInt32(string, OBJECT_CORRECT_HANDLES_COUNT(real_count));
- PhSetListViewSubItem(context->ListViewHandle, PH_PLUGIN_HANDLE_GENERAL_INDEX_HANDLES, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, string);
}
// HACK for \REGISTRY permissions
@@ -365,14 +388,7 @@ VOID EtHandlePropertiesWindowInitialized(
UNICODE_STRING objectName;
RtlInitUnicodeString(&objectName, L"\\REGISTRY");
- InitializeObjectAttributes(
- &objectAttributes,
- &objectName,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL
- );
-
+ InitializeObjectAttributes(&objectAttributes, &objectName, OBJ_CASE_INSENSITIVE, NULL, NULL);
if (NT_SUCCESS(NtOpenKey(®istryHandle, READ_CONTROL | WRITE_DAC, &objectAttributes)))
{
PhRemoveItemList(EtObjectManagerOwnHandles, PhFindItemList(EtObjectManagerOwnHandles, context->HandleItem->Handle));
@@ -384,50 +400,122 @@ VOID EtHandlePropertiesWindowInitialized(
}
// Removing of row breaks cached indexes, so hide reference value instead
- //PhSetListViewSubItem(context->ListViewHandle, context->ListViewRowCache[PH_PLUGIN_HANDLE_GENERAL_INDEX_REFERENCES], 1, L"");
+ //PhSetIListViewSubItem(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_REFERENCES, 1, L"");
+
+ // Show object attributes
+ PPH_STRING Attributes;
+ PH_STRING_BUILDER stringBuilder;
+ PhInitializeStringBuilder(&stringBuilder, 10);
+
+ if (EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_ACCESSMASK, &index))
+ PhRemoveIListViewItem(context->ListViewClass, index);
+ index = PhAddIListViewGroupItem(
+ context->ListViewClass,
+ PH_HANDLE_GENERAL_CATEGORY_BASICINFO,
+ OBJECT_GENERAL_INDEX_ATTRIBUTES,
+ L"Object attributes",
+ NULL
+ );
+
+ if (context->HandleItem->Attributes & OBJ_PERMANENT)
+ PhAppendStringBuilder2(&stringBuilder, L"Permanent, ");
+ if (context->HandleItem->Attributes & OBJ_EXCLUSIVE)
+ PhAppendStringBuilder2(&stringBuilder, L"Exclusive, ");
+ if (context->HandleItem->Attributes & OBJ_KERNEL_HANDLE)
+ PhAppendStringBuilder2(&stringBuilder, L"Kernel object, ");
+ if (context->HandleItem->Attributes & PH_OBJ_KERNEL_ACCESS_ONLY)
+ PhAppendStringBuilder2(&stringBuilder, L"Kernel only access, ");
+
+ // Remove the trailing ", ".
+ if (PhEndsWithString2(stringBuilder.String, L", ", FALSE))
+ PhRemoveEndStringBuilder(&stringBuilder, 2);
- PhAddListViewGroupItem(context->ListViewHandle, PH_PLUGIN_HANDLE_GENERAL_CATEGORY_BASICINFO, OBJECT_GENERAL_INDEX_ATTRIBUTES, L"Object attributes", NULL);
+ Attributes = PH_AUTO(PhFinalStringBuilderString(&stringBuilder));
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, PhGetString(Attributes));
+ // Show creation time (for symbolic links)
+ if (EtObjectManagerTimeCached.QuadPart != 0)
{
- // Show object attributes
- PPH_STRING Attributes;
- PH_STRING_BUILDER stringBuilder;
+ SYSTEMTIME systemTime;
+
+ index = PhAddIListViewGroupItem(
+ context->ListViewClass,
+ PH_HANDLE_GENERAL_CATEGORY_BASICINFO,
+ OBJECT_GENERAL_INDEX_CREATIONTIME,
+ L"Creation time",
+ NULL
+ );
- PhInitializeStringBuilder(&stringBuilder, 10);
- if (context->HandleItem->Attributes & OBJ_PERMANENT)
- PhAppendStringBuilder2(&stringBuilder, L"Permanent, ");
- if (context->HandleItem->Attributes & OBJ_EXCLUSIVE)
- PhAppendStringBuilder2(&stringBuilder, L"Exclusive, ");
- if (context->HandleItem->Attributes & OBJ_KERNEL_HANDLE)
- PhAppendStringBuilder2(&stringBuilder, L"Kernel object, ");
- if (context->HandleItem->Attributes & PH_OBJ_KERNEL_ACCESS_ONLY)
- PhAppendStringBuilder2(&stringBuilder, L"Kernel only access, ");
-
- // Remove the trailing ", ".
- if (PhEndsWithString2(stringBuilder.String, L", ", FALSE))
- PhRemoveEndStringBuilder(&stringBuilder, 2);
-
- Attributes = PH_AUTO(PhFinalStringBuilderString(&stringBuilder));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_ATTRIBUTES, 1, PhGetString(Attributes));
+ PhLargeIntegerToLocalSystemTime(&systemTime, &EtObjectManagerTimeCached);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, PhaFormatDateTime(&systemTime)->Buffer);
+ }
+
+ // Remove irrelevant information if we couldn't open real object
+ if (PhEqualString2(context->HandleItem->TypeName, L"ALPC Port", TRUE))
+ {
+ if (!context->HandleItem->Object)
+ {
+ if (EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_FLAGS, &index))
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, NULL);
+ if (EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_SEQUENCENUMBER, &index))
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, NULL);
+ if (EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_PORTCONTEXT, &index))
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, NULL);
+ }
+
+ if (EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_ALPCCLIENT, &index))
+ PhRemoveIListViewItem(context->ListViewClass, index);
+ if (EtFindIListViewItemByIndexParam(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_ALPCSERVER, &index))
+ PhRemoveIListViewItem(context->ListViewClass, index);
+ }
+ }
+ else if ((ULONG_PTR)context->OwnerPlugin == ((ULONG_PTR)PluginInstance | OBJECT_CHILD_HANDLEPROP_WINDOW))
+ {
+ if (!PhIsNullOrEmptyString(context->HandleItem->ObjectName) &&
+ !PhEqualString(context->HandleItem->ObjectName, context->HandleItem->BestObjectName, TRUE))
+ {
+ // I don't know why new row always appending in the back. This stupid full rebuild of section only one workaround
+ PPH_STRING accessString = PH_AUTO(PhGetIListViewItemText(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_ACCESSMASK, 1));
+ PhRemoveIListViewItem(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_ACCESSMASK);
+ PhRemoveIListViewItem(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_OBJECT);
+ PhRemoveIListViewItem(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_TYPE);
+ PhRemoveIListViewItem(context->ListViewClass, PH_HANDLE_GENERAL_INDEX_NAME);
+
+ index = PhAddIListViewGroupItem(context->ListViewClass, PH_HANDLE_GENERAL_CATEGORY_BASICINFO, 0, L"Name", NULL);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, PhGetString(context->HandleItem->BestObjectName));
+ index = PhAddIListViewGroupItem(context->ListViewClass,PH_HANDLE_GENERAL_CATEGORY_BASICINFO, 1, L"Original name", NULL);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, PhGetString(context->HandleItem->ObjectName));
+ index = PhAddIListViewGroupItem(context->ListViewClass, PH_HANDLE_GENERAL_CATEGORY_BASICINFO, 2, L"Type", NULL);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, PhGetString(context->HandleItem->TypeName));
+ index = PhAddIListViewGroupItem(context->ListViewClass, PH_HANDLE_GENERAL_CATEGORY_BASICINFO, 3, L"Object address", NULL);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, context->HandleItem->ObjectString);
+ index = PhAddIListViewGroupItem(context->ListViewClass, PH_HANDLE_GENERAL_CATEGORY_BASICINFO, 4, L"Granted access", NULL);
+ PhSetIListViewSubItem(context->ListViewClass, index, 1, PhGetString(accessString));
}
}
// General ET plugin extensions
if (!PhIsNullOrEmptyString(context->HandleItem->TypeName))
{
- // Show Driver image information
+ // Show Driver information
if (PhEqualString2(context->HandleItem->TypeName, L"Driver", TRUE))
{
HANDLE driverObject;
PPH_STRING driverName;
KPH_DRIVER_BASIC_INFORMATION basicInfo;
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DRIVER, L"Driver information");
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERIMAGE, L"Driver Image", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERSERVICE, L"Driver Service Name", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERSIZE, L"Driver Size", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERSTART, L"Driver Start Address", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERFLAGS, L"Driver Flags", NULL);
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DRIVER, L"Driver information");
+
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERIMAGE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERIMAGE, L"Driver Image", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERSERVICE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERSERVICE, L"Driver Service Name", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERSIZE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERSIZE, L"Driver Size", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERSTART] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERSTART, L"Driver Start Address", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERFLAGS] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DRIVER, OBJECT_GENERAL_INDEX_DRIVERFLAGS, L"Driver Flags", NULL);
if (KsiLevel() == KphLevelMax &&
NT_SUCCESS(EtDuplicateHandleFromProcessEx(
@@ -440,13 +528,13 @@ VOID EtHandlePropertiesWindowInitialized(
{
if (NT_SUCCESS(PhGetDriverImageFileName(driverObject, &driverName)))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DRIVERIMAGE, 1, PhGetString(driverName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERIMAGE], 1, PhGetString(driverName));
PhDereferenceObject(driverName);
}
if (NT_SUCCESS(PhGetDriverServiceKeyName(driverObject, &driverName)))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DRIVERSERVICE, 1, PhGetString(driverName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERSERVICE], 1, PhGetString(driverName));
PhDereferenceObject(driverName);
}
@@ -458,23 +546,20 @@ VOID EtHandlePropertiesWindowInitialized(
NULL
)))
{
- PhSetListViewSubItem(
- context->ListViewHandle,
- OBJECT_GENERAL_INDEX_DRIVERSIZE, 1,
- PhGetString(PH_AUTO_T(PH_STRING, PhFormatSize(basicInfo.DriverSize, ULONG_MAX)))
- );
+ PPH_STRING size = PH_AUTO(PhFormatSize(basicInfo.DriverSize, ULONG_MAX));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERSIZE], 1, PhGetString(size));
PhPrintPointer(string, basicInfo.DriverStart);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DRIVERSTART, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERSTART], 1, string);
PhPrintPointer(string, ULongToPtr(basicInfo.Flags));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DRIVERFLAGS, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DRIVERFLAGS], 1, string);
}
NtClose(driverObject);
}
}
- // Show Device drivers information
+ // Show Device information
else if (PhEqualString2(context->HandleItem->TypeName, L"Device", TRUE))
{
HANDLE deviceObject;
@@ -484,12 +569,13 @@ VOID EtHandlePropertiesWindowInitialized(
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING objectName;
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DEVICE, L"Device information");
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVLOW, L"Lower-edge driver", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVLOWPATH, L"Lower-edge driver image", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVHIGH, L"Upper-edge driver", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVHIGHPATH, L"Upper-edge driver Image", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEPNPNAME, L"PnP Device Name", NULL);
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DEVICE, L"Device information");
+
+ PhAddIListViewGroupItem(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVLOW, L"Lower-edge driver", NULL);
+ PhAddIListViewGroupItem(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVLOWPATH, L"Lower-edge driver image", NULL);
+ PhAddIListViewGroupItem(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVHIGH, L"Upper-edge driver", NULL);
+ PhAddIListViewGroupItem(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEDRVHIGHPATH, L"Upper-edge driver Image", NULL);
+ PhAddIListViewGroupItem(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DEVICE, OBJECT_GENERAL_INDEX_DEVICEPNPNAME, L"PnP Device Name", NULL);
if (KsiLevel() == KphLevelMax &&
!PhIsNullOrEmptyString(context->HandleItem->ObjectName))
@@ -503,13 +589,13 @@ VOID EtHandlePropertiesWindowInitialized(
{
if (NT_SUCCESS(PhGetDriverName(driverObject, &driverName)))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DEVICEDRVHIGH, 1, PhGetString(driverName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DEVICEDRVHIGH], 1, PhGetString(driverName));
PhDereferenceObject(driverName);
}
if (NT_SUCCESS(PhGetDriverImageFileName(driverObject, &driverName)))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DEVICEDRVHIGHPATH, 1, PhGetString(driverName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DEVICEDRVHIGHPATH], 1, PhGetString(driverName));
PhDereferenceObject(driverName);
}
@@ -522,13 +608,13 @@ VOID EtHandlePropertiesWindowInitialized(
{
if (NT_SUCCESS(PhGetDriverName(driverObject, &driverName)))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DEVICEDRVLOW, 1, PhGetString(driverName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DEVICEDRVLOW], 1, PhGetString(driverName));
PhDereferenceObject(driverName);
}
if (NT_SUCCESS(PhGetDriverImageFileName(driverObject, &driverName)))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DEVICEDRVLOWPATH, 1, PhGetString(driverName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DEVICEDRVLOWPATH], 1, PhGetString(driverName));
PhDereferenceObject(driverName);
}
@@ -555,11 +641,12 @@ VOID EtHandlePropertiesWindowInitialized(
PhMoveReference(&devicePdoName, PhFormatString(L"%s (%s)", PhGetString(devicePdoName), PhGetString(driveLetter)));
PhDereferenceObject(driveLetter);
}
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DEVICEPNPNAME, 1, PhGetString(devicePdoName));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DEVICEPNPNAME], 1, PhGetString(devicePdoName));
PhDereferenceObject(devicePdoName);
PhDereferenceObject(driverName);
}
}
+ // Show WindowStation information
else if (PhEqualString2(context->HandleItem->TypeName, L"WindowStation", TRUE))
{
HWINSTA hWinStation;
@@ -568,16 +655,19 @@ VOID EtHandlePropertiesWindowInitialized(
PH_STRINGREF stationName;
PH_STRINGREF pathPart;
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_WINDOWSTATION, L"Window Station information");
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_WINDOWSTATION, OBJECT_GENERAL_INDEX_WINSTATYPE, L"Type", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_WINDOWSTATION, OBJECT_GENERAL_INDEX_WINSTAVISIBLE, L"Visible", NULL);
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_WINDOWSTATION, L"Window Station information");
+
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_WINSTATYPE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_WINDOWSTATION, OBJECT_GENERAL_INDEX_WINSTATYPE, L"Type", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_WINSTAVISIBLE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_WINDOWSTATION, OBJECT_GENERAL_INDEX_WINSTAVISIBLE, L"Visible", NULL);
if (!PhIsNullOrEmptyString(context->HandleItem->ObjectName))
{
- if (!PhSplitStringRefAtLastChar(&context->HandleItem->ObjectName->sr, OBJ_NAME_PATH_SEPARATOR, &pathPart, &stationName))
+ if (!PhSplitStringRefAtLastChar(&context->HandleItem->ObjectName->sr, L'\\', &pathPart, &stationName))
stationName = context->HandleItem->ObjectName->sr;
stationType = PH_AUTO(EtGetWindowStationType(&stationName));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_WINSTATYPE, 1, PhGetString(stationType));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_WINSTATYPE], 1, PhGetString(stationType));
}
if (NT_SUCCESS(EtDuplicateHandleFromProcessEx(
@@ -596,20 +686,25 @@ VOID EtHandlePropertiesWindowInitialized(
NULL
))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_WINSTAVISIBLE, 1, userFlags.dwFlags & WSF_VISIBLE ? L"True" : L"False");
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_WINSTAVISIBLE], 1,
+ userFlags.dwFlags & WSF_VISIBLE ? L"True" : L"False");
}
-
CloseWindowStation(hWinStation);
}
}
+ // Show Desktop information
else if (PhEqualString2(context->HandleItem->TypeName, L"Desktop", TRUE))
{
HDESK hDesktop;
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DESKTOP, L"Desktop information");
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DESKTOP, OBJECT_GENERAL_INDEX_DESKTOPIO, L"Input desktop", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DESKTOP, OBJECT_GENERAL_INDEX_DESKTOPSID, L"User SID", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_DESKTOP, OBJECT_GENERAL_INDEX_DESKTOPHEAP, L"Heap size", NULL);
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_DESKTOP, L"Desktop information");
+
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DESKTOPIO] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DESKTOP, OBJECT_GENERAL_INDEX_DESKTOPIO, L"Input desktop", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DESKTOPSID] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DESKTOP, OBJECT_GENERAL_INDEX_DESKTOPSID, L"User SID", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_DESKTOPHEAP] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_DESKTOP, OBJECT_GENERAL_INDEX_DESKTOPHEAP, L"Heap size", NULL);
if (NT_SUCCESS(EtDuplicateHandleFromProcessEx(
(PHANDLE)&hDesktop,
@@ -626,24 +721,24 @@ VOID EtHandlePropertiesWindowInitialized(
if (GetUserObjectInformation(hDesktop, UOI_IO, &vInfo, sizeof(vInfo), NULL))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DESKTOPIO, 1, !!vInfo ? L"True" : L"False");
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DESKTOPIO], 1, !!vInfo ? L"True" : L"False");
}
if (GetUserObjectInformation(hDesktop, UOI_USER_SID, UserSid, SECURITY_MAX_SID_SIZE, &length))
{
PPH_STRING sid = PH_AUTO(PhSidToStringSid(UserSid));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DESKTOPSID, 1, PhGetString(sid));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DESKTOPSID], 1, PhGetString(sid));
}
if (GetUserObjectInformation(hDesktop, UOI_HEAPSIZE, &vInfo, sizeof(vInfo), NULL))
{
- PPH_STRING size = PH_AUTO(PhFormatSize(vInfo * 1024, ULONG_MAX));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_DESKTOPHEAP, 1, PhGetString(size));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_DESKTOPHEAP], 1, PhaFormatSize(vInfo * 1024, ULONG_MAX)->Buffer);
}
CloseDesktop(hDesktop);
}
}
+ // Show Type information
else if (PhEqualString2(context->HandleItem->TypeName, L"Type", TRUE))
{
PH_STRINGREF firstPart;
@@ -654,22 +749,34 @@ VOID EtHandlePropertiesWindowInitialized(
PPH_STRING accessString;
PH_STRING_BUILDER stringBuilder;
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, L"Type information");
- PhAddListViewGroupItem(context->ListViewHandle,OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEINDEX, L"Index", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEOBJECTS, L"Objects", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEHANDLES, L"Handles", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPEAKOBJECTS, L"Peak Objects", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPEAKHANDLES, L"Peak Handles", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPOOLTYPE, L"Pool Type", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPAGECHARGE, L"Default Paged Charge", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPENPAGECHARGE, L"Default NP Charge", NULL);
+ IListView_RemoveGroup(context->ListViewClass, PH_HANDLE_GENERAL_CATEGORY_QUOTA);
+
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_TYPE, L"Type information");
+
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEINDEX] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEINDEX, L"Index", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEOBJECTS] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEOBJECTS, L"Objects", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEHANDLES] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEHANDLES, L"Handles", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPEAKOBJECTS] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPEAKOBJECTS, L"Peak Objects", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPEAKHANDLES] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPEAKHANDLES, L"Peak Handles", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPOOLTYPE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPOOLTYPE, L"Pool Type", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPAGECHARGE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPEPAGECHARGE, L"Default Paged Charge", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPENPAGECHARGE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE, OBJECT_GENERAL_INDEX_TYPENPAGECHARGE, L"Default NP Charge", NULL);
if (!PhIsNullOrEmptyString(context->HandleItem->ObjectName) &&
- PhSplitStringRefAtLastChar(&context->HandleItem->ObjectName->sr, OBJ_NAME_PATH_SEPARATOR, &firstPart, &typeName))
+ PhSplitStringRefAtLastChar(&context->HandleItem->ObjectName->sr, L'\\', &firstPart, &typeName))
{
typeIndex = PhGetObjectTypeNumber(&typeName);
- if (typeIndex != ULONG_MAX && NT_SUCCESS(PhEnumObjectTypes(&objectTypes)))
+ if (typeIndex != ULONG_MAX &&
+ NT_SUCCESS(PhEnumObjectTypes(&objectTypes)))
{
objectType = PH_FIRST_OBJECT_TYPE(objectTypes);
@@ -678,16 +785,15 @@ VOID EtHandlePropertiesWindowInitialized(
if (objectType->TypeIndex == typeIndex)
{
PhPrintUInt32(string, objectType->TypeIndex);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEINDEX, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEINDEX], 1, string);
PhPrintUInt32(string, objectType->TotalNumberOfObjects);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEOBJECTS, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEOBJECTS], 1, string);
PhPrintUInt32(string, objectType->TotalNumberOfHandles);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEHANDLES, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEHANDLES], 1, string);
PhPrintUInt32(string, objectType->HighWaterNumberOfObjects);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEPEAKOBJECTS, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPEAKOBJECTS], 1, string);
PhPrintUInt32(string, objectType->HighWaterNumberOfHandles);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEPEAKHANDLES, 1, string);
- PhPrintUInt32(string, objectType->DefaultPagedPoolCharge);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPEAKHANDLES], 1, string);
PWSTR poolTypeString = L"";
switch (objectType->PoolType)
@@ -697,30 +803,38 @@ VOID EtHandlePropertiesWindowInitialized(
case NonPagedPoolNx: poolTypeString = L"Non Paged NX"; break;
case PagedPoolSessionNx: poolTypeString = L"Paged Session NX"; break;
}
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPOOLTYPE], 1, poolTypeString);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEPOOLTYPE, 1, poolTypeString);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEPAGECHARGE, 1, string);
+ PhPrintUInt32(string, objectType->DefaultPagedPoolCharge);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEPAGECHARGE], 1, string);
PhPrintUInt32(string, objectType->DefaultNonPagedPoolCharge);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPENPAGECHARGE, 1, string);
-
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, L"Type access information");
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEVALIDMASK, L"Valid Access Mask", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICREAD, L"Generic Read", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICWRITE, L"Generic Write", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICEXECUTE, L"Generic Execute", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICALL, L"Generic All", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEINVALIDATTRIBUTES, L"Invalid Attributes", NULL);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPENPAGECHARGE], 1, string);
+
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, L"Type access information");
+
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEVALIDMASK] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEVALIDMASK, L"Valid Access Mask", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICREAD] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICREAD, L"Generic Read", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICWRITE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICWRITE, L"Generic Write", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICEXECUTE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICEXECUTE, L"Generic Execute", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICALL] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEGENERICALL, L"Generic All", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEINVALIDATTRIBUTES] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_TYPE_ACCESS, OBJECT_GENERAL_INDEX_TYPEINVALIDATTRIBUTES, L"Invalid Attributes", NULL);
accessString = PH_AUTO(EtGetAccessString2(&typeName, objectType->ValidAccessMask));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEVALIDMASK, 1, PhGetString(accessString));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEVALIDMASK], 1, PhGetString(accessString));
accessString = PH_AUTO(EtGetAccessString2(&typeName, objectType->GenericMapping.GenericRead));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEGENERICREAD, 1, PhGetString(accessString));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICREAD], 1, PhGetString(accessString));
accessString = PH_AUTO(EtGetAccessString2(&typeName, objectType->GenericMapping.GenericWrite));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEGENERICWRITE, 1, PhGetString(accessString));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICWRITE], 1, PhGetString(accessString));
accessString = PH_AUTO(EtGetAccessString2(&typeName, objectType->GenericMapping.GenericExecute));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEGENERICEXECUTE, 1, PhGetString(accessString));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICEXECUTE], 1, PhGetString(accessString));
accessString = PH_AUTO(EtGetAccessString2(&typeName, objectType->GenericMapping.GenericAll));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEGENERICALL, 1, PhGetString(accessString));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEGENERICALL], 1, PhGetString(accessString));
PhInitializeStringBuilder(&stringBuilder, 10);
if (objectType->InvalidAttributes & OBJ_KERNEL_HANDLE)
@@ -749,7 +863,7 @@ VOID EtHandlePropertiesWindowInitialized(
PhRemoveEndStringBuilder(&stringBuilder, 2);
accessString = PH_AUTO(PhFinalStringBuilderString(&stringBuilder));
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_TYPEINVALIDATTRIBUTES, 1, PhGetString(accessString));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_TYPEINVALIDATTRIBUTES], 1, PhGetString(accessString));
break;
}
@@ -759,6 +873,7 @@ VOID EtHandlePropertiesWindowInitialized(
}
}
}
+ // Show Session information
else if (PhEqualString2(context->HandleItem->TypeName, L"Session", TRUE))
{
PH_STRINGREF firstPart;
@@ -768,18 +883,27 @@ VOID EtHandlePropertiesWindowInitialized(
ULONG sessionId;
SYSTEMTIME systemTime;
- PhAddListViewGroup(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, L"Session information");
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONNAME, L"Session Name", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONID, L"Session ID", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONUSERNAME, L"User name", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONSTATE, L"State", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONLOGON, L"Logon time", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONCONNECT, L"Connect time", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONDISCONNECT, L"Disconnect time", NULL);
- PhAddListViewGroupItem(context->ListViewHandle, OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONLASTINPUT, L"Last input time", NULL);
+ PhAddIListViewGroup(context->ListViewClass, OBJECT_GENERAL_CATEGORY_SESSION, L"Session information");
+
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONNAME] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONNAME, L"Session Name", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONID] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONID, L"Session ID", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONUSERNAME] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONUSERNAME, L"User name", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONSTATE] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONSTATE, L"State", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONLOGON] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONLOGON, L"Logon time", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONCONNECT] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONCONNECT, L"Connect time", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONDISCONNECT] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONDISCONNECT, L"Disconnect time", NULL);
+ EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONLASTINPUT] = PhAddIListViewGroupItem(context->ListViewClass,
+ OBJECT_GENERAL_CATEGORY_SESSION, OBJECT_GENERAL_INDEX_SESSIONLASTINPUT, L"Last input time", NULL);
if (!PhIsNullOrEmptyString(context->HandleItem->ObjectName) &&
- PhSplitStringRefAtLastChar(&context->HandleItem->ObjectName->sr, OBJ_NAME_PATH_SEPARATOR, &firstPart, &sessionName) &&
+ PhSplitStringRefAtLastChar(&context->HandleItem->ObjectName->sr, L'\\', &firstPart, &sessionName) &&
(sessionId = EtSessionIdFromObjectName(&sessionName)) != ULONG_MAX)
{
if (WinStationQueryInformationW(
@@ -791,25 +915,28 @@ VOID EtHandlePropertiesWindowInitialized(
&returnLength
))
{
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONNAME, 1, winStationInfo.WinStationName);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONNAME], 1, winStationInfo.WinStationName);
PhPrintUInt32(string, sessionId);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONID, 1, string);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONID], 1, string);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONUSERNAME, 1, PhaFormatString(
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONUSERNAME], 1,
+ PhaFormatString(
L"%s%c%s",
winStationInfo.Domain,
winStationInfo.Domain[0] != UNICODE_NULL ? OBJ_NAME_PATH_SEPARATOR : UNICODE_NULL,
winStationInfo.UserName)->Buffer);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONSTATE, 1, EtMapSessionConnectState(winStationInfo.ConnectState));
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONSTATE], 1,
+ EtMapSessionConnectState(winStationInfo.ConnectState));
+
PhLargeIntegerToLocalSystemTime(&systemTime, &winStationInfo.LogonTime);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONLOGON, 1, PhaFormatDateTime(&systemTime)->Buffer);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONLOGON], 1, PhaFormatDateTime(&systemTime)->Buffer);
PhLargeIntegerToLocalSystemTime(&systemTime, &winStationInfo.ConnectTime);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONCONNECT, 1, PhaFormatDateTime(&systemTime)->Buffer);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONCONNECT], 1, PhaFormatDateTime(&systemTime)->Buffer);
PhLargeIntegerToLocalSystemTime(&systemTime, &winStationInfo.DisconnectTime);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONDISCONNECT, 1, PhaFormatDateTime(&systemTime)->Buffer);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONDISCONNECT], 1, PhaFormatDateTime(&systemTime)->Buffer);
PhLargeIntegerToLocalSystemTime(&systemTime, &winStationInfo.LastInputTime);
- PhSetListViewSubItem(context->ListViewHandle, OBJECT_GENERAL_INDEX_SESSIONLASTINPUT, 1, PhaFormatDateTime(&systemTime)->Buffer);
+ PhSetIListViewSubItem(context->ListViewClass, EtListViewRowCache[OBJECT_GENERAL_INDEX_SESSIONLASTINPUT], 1, PhaFormatDateTime(&systemTime)->Buffer);
}
}
}
@@ -827,9 +954,7 @@ PPH_STRING EtGetWindowStationType(
)
{
if (PhEqualStringRef2(StationName, T_WINSTA_INTERACTIVE, TRUE))
- {
return PhCreateString(L"Interactive Window Station");
- }
PH_FORMAT format[3];
@@ -902,22 +1027,25 @@ VOID EtHandlePropertiesWindowUninitializing(
_In_ PVOID Parameter
)
{
- PPH_PLUGIN_HANDLE_PROPERTIES_WINDOW_CONTEXT context = Parameter;
+ PPH_HANDLE_PROPERTIES_CONTEXT context = Parameter;
- if (context->HandleItem->Handle && context->ProcessId == NtCurrentProcessId())
+ if (context->OwnerPlugin == PluginInstance)
{
- PhRemoveItemList(EtObjectManagerOwnHandles, PhFindItemList(EtObjectManagerOwnHandles, context->HandleItem->Handle));
- PhDereferenceObject(EtObjectManagerOwnHandles);
+ if (context->HandleItem->Handle && context->ProcessId == NtCurrentProcessId())
+ {
+ PhRemoveItemList(EtObjectManagerOwnHandles, PhFindItemList(EtObjectManagerOwnHandles, context->HandleItem->Handle));
+ PhDereferenceObject(EtObjectManagerOwnHandles);
- NtClose(context->HandleItem->Handle);
- }
+ NtClose(context->HandleItem->Handle);
+ }
- //PhRemoveItemSimpleHashtable(EtObjectManagerPropWindows, context->ParentWindow);
- //PhDereferenceObject(EtObjectManagerPropWindows);
+ PhRemoveItemSimpleHashtable(EtObjectManagerPropWindows, context->ParentWindow);
+ PhDereferenceObject(EtObjectManagerPropWindows);
- PhSaveWindowPlacementToSetting(SETTING_NAME_OBJMGR_PROPERTIES_WINDOW_POSITION, NULL, context->ParentWindow);
+ PhSaveWindowPlacementToSetting(SETTING_NAME_OBJMGR_PROPERTIES_WINDOW_POSITION, NULL, context->ParentWindow);
- PhDereferenceObject(context->HandleItem);
+ PhDereferenceObject(context->HandleItem);
+ }
}
static HPROPSHEETPAGE EtpCommonCreatePage(
@@ -1009,7 +1137,7 @@ INT_PTR CALLBACK EtpTpWorkerFactoryPageDlgProc(
{
PhLoadSymbolProviderOptions(symbolProvider);
PhLoadSymbolProviderModules(symbolProvider, context->ProcessId);
-
+
symbol = PhGetSymbolFromAddress(
symbolProvider,
basicInfo.StartRoutine,
@@ -1052,7 +1180,7 @@ INT_PTR CALLBACK EtpTpWorkerFactoryPageDlgProc(
NtClose(workerFactoryHandle);
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
}
@@ -1216,11 +1344,10 @@ VOID EtpEnumObjectHandles(
PVOID* processHandlePtr;
HANDLE processHandle;
PPH_KEY_VALUE_PAIR procEntry;
- ULONG j = 0;
PPH_STRING objectName;
BOOLEAN objectNameMatched;
- BOOLEAN useWorkQueue = KsiLevel() < KphLevelMed && (isDevice || isTypeObject && (Context->HandleItem->TypeIndex == EtFileTypeIndex));
+ BOOLEAN useWorkQueue = KsiLevel() < KphLevelMed && (isDevice || isTypeObject && PhEndsWithString2(Context->HandleItem->ObjectName, L"File", TRUE));
if (useWorkQueue)
PhInitializeWorkQueue(&workQueue, 1, 20, 1000);
@@ -1319,7 +1446,7 @@ VOID EtpEnumObjectHandles(
}
}
- if ((handleInfo->Object && handleInfo->Object == Context->HandleItem->Object) || objectNameMatched)
+ if (handleInfo->Object == Context->HandleItem->Object || objectNameMatched)
{
if (useWorkQueue) PhAcquireQueuedLockExclusive(&searchResultsLock);
PhAddItemList(searchResults, handleInfo);
@@ -1333,8 +1460,18 @@ VOID EtpEnumObjectHandles(
PhWaitForWorkQueue(&workQueue);
}
- while (PhEnumHashtable(processHandleHashtable, &procEntry, &j))
- NtClose(procEntry->Value);
+ {
+ ULONG j = 0;
+ while (PhEnumHashtable(processHandleHashtable, &procEntry, &j))
+ {
+ NTSTATUS status = NtClose(procEntry->Value);
+
+ if (!NT_SUCCESS(status))
+ {
+ PhShowStatus(NULL, L"Unidentified third party object.", status, 0);
+ }
+ }
+ }
PhDereferenceObject(processHandleHashtable);
@@ -1365,31 +1502,31 @@ VOID EtpEnumObjectHandles(
ClientId.UniqueProcess = entry->ProcessId;
columnString = PH_AUTO(PhGetClientIdName(&ClientId));
- lvItemIndex = PhAddListViewItem(
- Context->ListViewHandle,
+ lvItemIndex = PhAddIListViewItem(
+ Context->ListViewClass,
entry->OwnHandle ? ownHandlesIndex++ : MAXINT, // object own handles first
PhGetString(columnString),
entry
);
PhPrintPointer(value, (PVOID)handleInfo->HandleValue);
- PhSetListViewSubItem(Context->ListViewHandle, lvItemIndex, ETHNLVC_HANDLE, value);
+ PhSetIListViewSubItem(Context->ListViewClass, lvItemIndex, ETHNLVC_HANDLE, value);
columnString = PH_AUTO(EtGetAccessString(Context->HandleItem->TypeName, handleInfo->GrantedAccess));
- PhSetListViewSubItem(Context->ListViewHandle, lvItemIndex, ETHNLVC_ACCESS, PhGetString(columnString));
+ PhSetIListViewSubItem(Context->ListViewClass, lvItemIndex, ETHNLVC_ACCESS, PhGetString(columnString));
switch (handleInfo->HandleAttributes & (OBJ_PROTECT_CLOSE | OBJ_INHERIT))
{
case OBJ_PROTECT_CLOSE:
- PhSetListViewSubItem(Context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected");
+ PhSetIListViewSubItem(Context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected");
entry->Color = colorProtected, entry->UseCustomColor = TRUE;
break;
case OBJ_INHERIT:
- PhSetListViewSubItem(Context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Inherit");
+ PhSetIListViewSubItem(Context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Inherit");
entry->Color = colorInherit, entry->UseCustomColor = TRUE;
break;
case OBJ_PROTECT_CLOSE | OBJ_INHERIT:
- PhSetListViewSubItem(Context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected, Inherit");
+ PhSetIListViewSubItem(Context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected, Inherit");
entry->Color = colorProtectedInherit, entry->UseCustomColor = TRUE;
break;
}
@@ -1405,8 +1542,8 @@ VOID EtpEnumObjectHandles(
{
if (!Context->ColumnsAdded)
{
- Context->ColumnsAdded = !!PhAddListViewColumn(Context->ListViewHandle, ETHNLVC_NAME, ETHNLVC_NAME, ETHNLVC_NAME, LVCFMT_LEFT, 200, L"Name");
- PhAddListViewColumn(Context->ListViewHandle, ETHNLVC_ORIGNAME, ETHNLVC_ORIGNAME, ETHNLVC_ORIGNAME, LVCFMT_LEFT, 200, L"Original name");
+ Context->ColumnsAdded = !!PhAddIListViewColumn(Context->ListViewClass, ETHNLVC_NAME, ETHNLVC_NAME, ETHNLVC_NAME, LVCFMT_LEFT, 200, L"Name");
+ PhAddIListViewColumn(Context->ListViewClass, ETHNLVC_ORIGNAME, ETHNLVC_ORIGNAME, ETHNLVC_ORIGNAME, LVCFMT_LEFT, 200, L"Original name");
}
if (useWorkQueue && entry->HandleItem->TypeIndex == EtFileTypeIndex)
@@ -1433,7 +1570,7 @@ VOID EtpEnumObjectHandles(
PhDeleteWorkQueue(&workQueue);
}
- Context->TotalHandlesCount = ListView_GetItemCount(Context->ListViewHandle);
+ IListView_GetItemCount(Context->ListViewClass, &Context->TotalHandlesCount);
Context->OwnHandlesCount = ownHandlesIndex;
}
@@ -1457,10 +1594,11 @@ VOID EtUpdateHandleItem(
)
{
HANDLE processHandle;
+ BOOLEAN useKsi = KsiLevel() >= KphLevelMed;
if (NT_SUCCESS(PhOpenProcess(
&processHandle,
- (KsiLevel() >= KphLevelMed ? PROCESS_QUERY_LIMITED_INFORMATION : PROCESS_DUP_HANDLE),
+ (useKsi ? PROCESS_QUERY_LIMITED_INFORMATION : PROCESS_DUP_HANDLE),
ProcessId
)))
{
@@ -1475,6 +1613,15 @@ VOID EtUpdateHandleItem(
);
NtClose(processHandle);
+
+ if (useKsi && HandleItem->ObjectName && PhStartsWithStringRef2(&HandleItem->ObjectName->sr, L"\\Device\\Afd", TRUE))
+ {
+ if (NT_SUCCESS(PhOpenProcess(&processHandle, PROCESS_DUP_HANDLE, ProcessId)))
+ {
+ PhGetHandleInformation(processHandle, HandleItem->Handle, HandleItem->TypeIndex, NULL, NULL, NULL, &HandleItem->BestObjectName);
+ NtClose(processHandle);
+ }
+ }
}
if (PhIsNullOrEmptyString(HandleItem->TypeName))
@@ -1488,7 +1635,7 @@ VOID EtpShowHandleProperties(
{
EtUpdateHandleItem(Entry->ProcessId, Entry->HandleItem);
- PhShowHandlePropertiesEx(WindowHandle, Entry->ProcessId, Entry->HandleItem, NULL, NULL);
+ PhShowHandlePropertiesEx(WindowHandle, Entry->ProcessId, Entry->HandleItem, (PPH_PLUGIN)((ULONG_PTR)PluginInstance | OBJECT_CHILD_HANDLEPROP_WINDOW), NULL);
}
VOID EtpUpdateGeneralTab(
@@ -1521,10 +1668,10 @@ VOID EtpUpdateGeneralTab(
)))
{
PhPrintUInt32(string, basicInfo.PointerCount);
- PhSetListViewSubItem(generalPageList, PH_PLUGIN_HANDLE_GENERAL_INDEX_REFERENCES, 1, string);
+ PhSetListViewSubItem(generalPageList, PH_HANDLE_GENERAL_INDEX_REFERENCES, 1, string);
PhPrintUInt32(string, Context->ProcessId == NtCurrentProcessId() ? OBJECT_CORRECT_HANDLES_COUNT(basicInfo.HandleCount) : basicInfo.HandleCount);
- PhSetListViewSubItem(generalPageList, PH_PLUGIN_HANDLE_GENERAL_INDEX_HANDLES, 1, string);
+ PhSetListViewSubItem(generalPageList, PH_HANDLE_GENERAL_INDEX_HANDLES, 1, string);
}
if (processHandle != NtCurrentProcess())
@@ -1547,7 +1694,7 @@ VOID EtpCloseObjectHandles(
if (PhUiCloseHandles(Context->WindowHandle, ListviewItems[i]->ProcessId, &ListviewItems[i]->HandleItem, 1, TRUE))
{
ownHandle = !!ListviewItems[i]->OwnHandle;
- PhRemoveListViewItem(Context->ListViewHandle, PhFindListViewItemByParam(Context->ListViewHandle, INT_ERROR, ListviewItems[i]));
+ PhRemoveIListViewItem(Context->ListViewClass, PhFindIListViewItemByParam(Context->ListViewClass, INT_ERROR, ListviewItems[i]));
PhClearReference(&ListviewItems[i]->HandleItem);
PhFree(ListviewItems[i]);
@@ -1573,7 +1720,7 @@ static COLORREF NTAPI EtpColorItemColorFunction(
PET_HANDLE_ENTRY entry = Param;
COLORREF color = entry->UseCustomColor ?
entry->Color :
- !!PhGetIntegerSetting(L"EnableThemeSupport") ? PhGetIntegerSetting(L"ThemeWindowBackgroundColor") : GetSysColor(COLOR_WINDOW);
+ PhIsThemeSupportEnabled() ? PhGetIntegerSetting(L"ThemeWindowBackgroundColor") : GetSysColor(COLOR_WINDOW);
return color;
}
@@ -1623,14 +1770,14 @@ VOID EtpHandlesFreeListViewItems(
{
INT index = INT_ERROR;
- while ((index = PhFindListViewItemByFlags(
- Context->ListViewHandle,
+ while ((index = PhFindIListViewItemByFlags(
+ Context->ListViewClass,
index,
LVNI_ALL
)) != INT_ERROR)
{
PET_HANDLE_ENTRY entry;
- if (PhGetListViewItemParam(Context->ListViewHandle, index, &entry))
+ if (PhGetIListViewItemParam(Context->ListViewClass, index, &entry))
{
PhClearReference(&entry->HandleItem);
PhFree(entry);
@@ -1668,13 +1815,14 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
{
context->WindowHandle = hwndDlg;
context->ListViewHandle = GetDlgItem(hwndDlg, IDC_LIST);
+ context->ListViewClass = PhGetListViewInterface(context->ListViewHandle);
PhSetListViewStyle(context->ListViewHandle, TRUE, TRUE);
PhSetControlTheme(context->ListViewHandle, L"explorer");
- PhAddListViewColumn(context->ListViewHandle, ETHNLVC_PROCESS, ETHNLVC_PROCESS, ETHNLVC_PROCESS, LVCFMT_LEFT, 120, L"Process");
- PhAddListViewColumn(context->ListViewHandle, ETHNLVC_HANDLE, ETHNLVC_HANDLE, ETHNLVC_HANDLE, LVCFMT_LEFT, 50, L"Handle");
- PhAddListViewColumn(context->ListViewHandle, ETHNLVC_ACCESS, ETHNLVC_ACCESS, ETHNLVC_ACCESS, LVCFMT_LEFT, 125, L"Access");
- PhAddListViewColumn(context->ListViewHandle, ETHNLVC_ATTRIBUTES, ETHNLVC_ATTRIBUTES, ETHNLVC_ATTRIBUTES, LVCFMT_LEFT, 70, L"Attributes");
+ PhAddIListViewColumn(context->ListViewClass, ETHNLVC_PROCESS, ETHNLVC_PROCESS, ETHNLVC_PROCESS, LVCFMT_LEFT, 120, L"Process");
+ PhAddIListViewColumn(context->ListViewClass, ETHNLVC_HANDLE, ETHNLVC_HANDLE, ETHNLVC_HANDLE, LVCFMT_LEFT, 50, L"Handle");
+ PhAddIListViewColumn(context->ListViewClass, ETHNLVC_ACCESS, ETHNLVC_ACCESS, ETHNLVC_ACCESS, LVCFMT_LEFT, 125, L"Access");
+ PhAddIListViewColumn(context->ListViewClass, ETHNLVC_ATTRIBUTES, ETHNLVC_ATTRIBUTES, ETHNLVC_ATTRIBUTES, LVCFMT_LEFT, 70, L"Attributes");
PhSetExtendedListView(context->ListViewHandle);
ExtendedListView_SetSort(context->ListViewHandle, 0, NoSortOrder);
ExtendedListView_SetItemColorFunction(context->ListViewHandle, EtpColorItemColorFunction);
@@ -1684,7 +1832,7 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
EtpEnumObjectHandles(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_SIZE:
@@ -1696,66 +1844,57 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
case WM_DESTROY:
{
EtpHandlesFreeListViewItems(context);
+
+ PhDestroyListViewInterface(context->ListViewClass);
}
break;
case WM_NCDESTROY:
{
PhDeleteLayoutManager(&context->LayoutManager);
PhRemoveWindowContext(hwndDlg, PH_WINDOW_CONTEXT_DEFAULT);
+ PhFree(context);
}
break;
case WM_KEYDOWN:
{
- PET_HANDLE_ENTRY* listviewItems;
- ULONG numberOfItems;
-
switch (LOWORD(wParam))
{
case VK_RETURN:
+ if (GetFocus() == context->ListViewHandle)
{
- if (GetFocus() == context->ListViewHandle)
- {
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
+ PET_HANDLE_ENTRY entry;
+ PPH_PROCESS_ITEM processItem;
- if (numberOfItems == 1)
+ if (entry = PhGetSelectedIListViewItemParam(context->ListViewClass))
+ {
+ if (GetKeyState(VK_CONTROL) < 0)
{
- if (GetKeyState(VK_CONTROL) < 0)
+ if (processItem = PhReferenceProcessItem(entry->ProcessId))
{
- PPH_PROCESS_ITEM processItem;
-
- if (processItem = PhReferenceProcessItem(listviewItems[0]->ProcessId))
- {
- SystemInformer_ShowProcessProperties(processItem);
- PhDereferenceObject(processItem);
- PhFree(listviewItems);
- return TRUE;
- }
- }
- else
- {
- EtpShowHandleProperties(hwndDlg, listviewItems[0]);
- PhFree(listviewItems);
+ SystemInformer_ShowProcessProperties(processItem);
+ PhDereferenceObject(processItem);
return TRUE;
}
}
-
- PhFree(listviewItems);
+ else
+ {
+ EtpShowHandleProperties(hwndDlg, entry);
+ return TRUE;
+ }
}
}
break;
case VK_DELETE:
+ if (GetFocus() == context->ListViewHandle)
{
- if (GetFocus() == context->ListViewHandle)
- {
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
-
- if (numberOfItems != 0)
- {
- EtpCloseObjectHandles(context, listviewItems, numberOfItems);
- return TRUE;
- }
+ PET_HANDLE_ENTRY* listviewItems;
+ ULONG numberOfItems;
- PhFree(listviewItems);
+ PhGetSelectedIListViewItemParams(context->ListViewClass, &listviewItems, &numberOfItems);
+ if (numberOfItems != 0)
+ {
+ EtpCloseObjectHandles(context, listviewItems, numberOfItems);
+ return TRUE;
}
}
break;
@@ -1779,7 +1918,7 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
LPNMITEMACTIVATE info = (LPNMITEMACTIVATE)header;
PET_HANDLE_ENTRY entry;
- if (entry = PhGetSelectedListViewItemParam(context->ListViewHandle))
+ if (entry = PhGetSelectedIListViewItemParam(context->ListViewClass))
{
if (GetKeyState(VK_CONTROL) < 0)
{
@@ -1832,8 +1971,7 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
PET_HANDLE_ENTRY* listviewItems;
ULONG numberOfItems;
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
-
+ PhGetSelectedIListViewItemParams(context->ListViewClass, &listviewItems, &numberOfItems);
if (numberOfItems != 0)
{
POINT point;
@@ -1851,7 +1989,7 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
point.y = GET_Y_LPARAM(lParam);
if (point.x == -1 && point.y == -1)
- PhGetListViewContextMenuPoint(context->ListViewHandle, &point);
+ PhGetIListViewContextMenuPoint(context->ListViewClass, &point);
menu = PhCreateEMenu();
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_CLOSEHANDLE, L"C&lose\bDel", NULL, NULL), ULONG_MAX);
@@ -1865,7 +2003,7 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
PhInsertEMenuItem(menu, propMenuItem = PhCreateEMenuItem(0, IDC_PROPERTIES, L"Prope&rties\bEnter", NULL, NULL), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuSeparator(), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_COPY, L"&Copy\bCtrl+C", NULL, NULL), ULONG_MAX);
- PhInsertCopyListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle);
+ PhInsertCopyIListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle, context->ListViewClass);
PhSetFlagsEMenuItem(menu, IDC_PROPERTIES, PH_EMENU_DEFAULT, PH_EMENU_DEFAULT);
if (numberOfItems > 1)
@@ -1911,119 +2049,115 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
{
switch (item->Id)
{
- case IDC_CLOSEHANDLE:
- {
+ case IDC_CLOSEHANDLE:
if (numberOfItems != 0)
{
EtpCloseObjectHandles(context, listviewItems, numberOfItems);
}
- }
- break;
- case IDC_HANDLE_PROTECTED:
- case IDC_HANDLE_INHERIT:
- {
- // Toggle the appropriate bit.
-
- if (item->Id == IDC_HANDLE_PROTECTED)
- attributes ^= OBJ_PROTECT_CLOSE;
- else if (item->Id == IDC_HANDLE_INHERIT)
- attributes ^= OBJ_INHERIT;
-
- if (PhUiSetAttributesHandle(hwndDlg, listviewItems[0]->ProcessId, listviewItems[0]->HandleItem, attributes))
+ break;
+ case IDC_HANDLE_PROTECTED:
+ case IDC_HANDLE_INHERIT:
{
+ // Toggle the appropriate bit.
+
if (item->Id == IDC_HANDLE_PROTECTED)
- listviewItems[0]->HandleItem->Attributes ^= OBJ_PROTECT_CLOSE;
+ attributes ^= OBJ_PROTECT_CLOSE;
else if (item->Id == IDC_HANDLE_INHERIT)
- listviewItems[0]->HandleItem->Attributes ^= OBJ_INHERIT;
+ attributes ^= OBJ_INHERIT;
- // Update list row
-
- LONG lvItemIndex = PhFindListViewItemByParam(context->ListViewHandle, INT_ERROR, listviewItems[0]);
- listviewItems[0]->UseCustomColor = listviewItems[0]->OwnHandle;
-
- switch (listviewItems[0]->HandleItem->Attributes & (OBJ_PROTECT_CLOSE | OBJ_INHERIT))
+ if (PhUiSetAttributesHandle(hwndDlg, listviewItems[0]->ProcessId, listviewItems[0]->HandleItem, attributes))
{
- case OBJ_PROTECT_CLOSE:
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected");
- listviewItems[0]->Color = PhGetIntegerSetting(L"ColorProtectedHandles"), listviewItems[0]->UseCustomColor = TRUE;
- break;
- case OBJ_INHERIT:
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Inherit");
- listviewItems[0]->Color = PhGetIntegerSetting(L"ColorInheritHandles"), listviewItems[0]->UseCustomColor = TRUE;
- break;
- case OBJ_PROTECT_CLOSE | OBJ_INHERIT:
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected, Inherit");
- listviewItems[0]->Color = PhGetIntegerSetting(L"ColorPartiallySuspended"), listviewItems[0]->UseCustomColor = TRUE;
- break;
- default:
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETHNLVC_ATTRIBUTES, L"");
- break;
+ if (item->Id == IDC_HANDLE_PROTECTED)
+ listviewItems[0]->HandleItem->Attributes ^= OBJ_PROTECT_CLOSE;
+ else if (item->Id == IDC_HANDLE_INHERIT)
+ listviewItems[0]->HandleItem->Attributes ^= OBJ_INHERIT;
+
+ // Update list row
+
+ LONG lvItemIndex = PhFindIListViewItemByParam(context->ListViewClass, INT_ERROR, listviewItems[0]);
+ listviewItems[0]->UseCustomColor = listviewItems[0]->OwnHandle;
+
+ switch (listviewItems[0]->HandleItem->Attributes & (OBJ_PROTECT_CLOSE | OBJ_INHERIT))
+ {
+ case OBJ_PROTECT_CLOSE:
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected");
+ listviewItems[0]->Color = PhGetIntegerSetting(L"ColorProtectedHandles"), listviewItems[0]->UseCustomColor = TRUE;
+ break;
+ case OBJ_INHERIT:
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Inherit");
+ listviewItems[0]->Color = PhGetIntegerSetting(L"ColorInheritHandles"), listviewItems[0]->UseCustomColor = TRUE;
+ break;
+ case OBJ_PROTECT_CLOSE | OBJ_INHERIT:
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"Protected, Inherit");
+ listviewItems[0]->Color = PhGetIntegerSetting(L"ColorPartiallySuspended"), listviewItems[0]->UseCustomColor = TRUE;
+ break;
+ default:
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETHNLVC_ATTRIBUTES, L"");
+ break;
+ }
+
+ if (listviewItems[0]->OwnHandle)
+ listviewItems[0]->Color = PhGetIntegerSetting(L"ColorOwnProcesses");
+
+ IListView_SetItemState(context->ListViewClass, INT_ERROR, 0, LVIS_SELECTED, 0);
}
-
- if (listviewItems[0]->OwnHandle)
- listviewItems[0]->Color = PhGetIntegerSetting(L"ColorOwnProcesses");
-
- ListView_SetItemState(context->ListViewHandle, -1, 0, LVIS_SELECTED);
}
- }
- break;
- case IDC_PROPERTIES:
- {
- EtpShowHandleProperties(hwndDlg, listviewItems[0]);
- }
- break;
- case IDC_GOTOPROCESS:
- {
- PPH_PROCESS_ITEM processItem;
+ break;
+ case IDC_PROPERTIES:
+ {
+ EtpShowHandleProperties(hwndDlg, listviewItems[0]);
+ }
+ break;
+ case IDC_GOTOPROCESS:
+ {
+ PPH_PROCESS_ITEM processItem;
- if (processItem = PhReferenceProcessItem(listviewItems[0]->ProcessId))
+ if (processItem = PhReferenceProcessItem(listviewItems[0]->ProcessId))
+ {
+ SystemInformer_ShowProcessProperties(processItem);
+ PhDereferenceObject(processItem);
+ }
+ }
+ break;
+ case PHAPP_ID_HANDLE_OBJECTPROPERTIES1:
{
- SystemInformer_ShowProcessProperties(processItem);
- PhDereferenceObject(processItem);
+ PhShowHandleObjectProperties1(hwndDlg, &info);
}
- }
- break;
- case PHAPP_ID_HANDLE_OBJECTPROPERTIES1:
- {
- PhShowHandleObjectProperties1(hwndDlg, &info);
- }
- break;
- case PHAPP_ID_HANDLE_OBJECTPROPERTIES2:
- {
- PhShowHandleObjectProperties2(hwndDlg, &info);
- }
- break;
- case IDC_SECURITY:
- {
- PET_HANDLE_OPEN_CONTEXT context;
-
- context = PhAllocateZero(sizeof(ET_HANDLE_OPEN_CONTEXT));
- context->HandleItem = PhReferenceObject(listviewItems[0]->HandleItem);
- context->ProcessId = listviewItems[0]->ProcessId;
- EtUpdateHandleItem(context->ProcessId, context->HandleItem);
-
- PhEditSecurity(
- !!PhGetIntegerSetting(L"ForceNoParent") ? NULL : hwndDlg,
- PhGetString(context->HandleItem->ObjectName),
- PhGetString(context->HandleItem->TypeName),
- EtpProcessHandleOpenCallback,
- EtpProcessHandleCloseCallback,
- context
- );
- }
- break;
- case IDC_COPY:
- {
- PhCopyListView(context->ListViewHandle);
- }
- break;
+ break;
+ case PHAPP_ID_HANDLE_OBJECTPROPERTIES2:
+ {
+ PhShowHandleObjectProperties2(hwndDlg, &info);
+ }
+ break;
+ case IDC_SECURITY:
+ {
+ PET_HANDLE_OPEN_CONTEXT context;
+
+ context = PhAllocateZero(sizeof(ET_HANDLE_OPEN_CONTEXT));
+ context->HandleItem = PhReferenceObject(listviewItems[0]->HandleItem);
+ context->ProcessId = listviewItems[0]->ProcessId;
+ EtUpdateHandleItem(context->ProcessId, context->HandleItem);
+
+ PhEditSecurity(
+ !!PhGetIntegerSetting(L"ForceNoParent") ? NULL : hwndDlg,
+ PhGetString(context->HandleItem->ObjectName),
+ PhGetString(context->HandleItem->TypeName),
+ EtpProcessHandleOpenCallback,
+ EtpProcessHandleCloseCallback,
+ context
+ );
+ }
+ break;
+ case IDC_COPY:
+ {
+ PhCopyIListView(context->ListViewHandle, context->ListViewClass);
+ }
+ break;
}
PhDestroyEMenu(menu);
}
}
-
- PhFree(listviewItems);
}
break;
case WM_COMMAND:
@@ -2035,7 +2169,7 @@ INT_PTR CALLBACK EtpObjHandlesPageDlgProc(
PH_SORT_ORDER sortOrder;
EtpHandlesFreeListViewItems(context);
- ListView_DeleteAllItems(context->ListViewHandle);
+ IListView_DeleteAllItems(context->ListViewClass);
PhSetDialogItemText(context->WindowHandle, IDC_OBJ_HANDLESTOTAL, L"");
PhSetDialogItemText(context->WindowHandle, IDC_OBJ_HANDLESBYOBJECT, L"");
PhSetDialogItemText(context->WindowHandle, IDC_OBJ_HANDLESBYNAME, L"");
@@ -2064,7 +2198,7 @@ static BOOL CALLBACK EtpEnumDesktopsCallback(
HDESK hDesktop;
UINT lvItemIndex;
- lvItemIndex = PhAddListViewItem(context->ListViewHandle, MAXINT, lpszDesktop, PhCreateString(lpszDesktop));
+ lvItemIndex = PhAddIListViewItem(context->ListViewClass, MAXINT, lpszDesktop, PhCreateString(lpszDesktop));
if (hDesktop = OpenDesktop(lpszDesktop, 0, FALSE, DESKTOP_READOBJECTS))
{
@@ -2076,19 +2210,17 @@ static BOOL CALLBACK EtpEnumDesktopsCallback(
if (GetUserObjectInformation(hDesktop, UOI_USER_SID, UserSid, SECURITY_MAX_SID_SIZE, &length))
{
PPH_STRING sid = PH_AUTO(PhSidToStringSid(UserSid));
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETDTLVC_SID, PhGetString(sid));
- PhFree(UserSid);
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETDTLVC_SID, PhGetString(sid));
}
if (GetUserObjectInformation(hDesktop, UOI_HEAPSIZE, &vInfo, sizeof(vInfo), NULL))
{
- PPH_STRING size = PH_AUTO(PhFormatString(L"%d MB", vInfo / 1024));
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETDTLVC_HEAP, PhGetString(size));
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETDTLVC_HEAP, PhaFormatSize(vInfo * 1024, ULONG_MAX)->Buffer);
}
if (GetUserObjectInformation(hDesktop, UOI_IO, &vInfo, sizeof(vInfo), NULL))
{
- PhSetListViewSubItem(context->ListViewHandle, lvItemIndex, ETDTLVC_IO, !!vInfo ? L"True" : L"False");
+ PhSetIListViewSubItem(context->ListViewClass, lvItemIndex, ETDTLVC_IO, !!vInfo ? L"True" : L"False");
}
CloseDesktop(hDesktop);
@@ -2136,7 +2268,7 @@ static NTSTATUS EtpOpenSecurityDesktopHandle(
return status;
}
-static NTSTATUS EtpCloseSecurityDesktop(
+static NTSTATUS EtpCloseSecurityDesktopHandle(
_In_ HANDLE Handle,
_In_ BOOLEAN Release,
_In_opt_ PVOID Context
@@ -2188,7 +2320,7 @@ VOID EtpOpenDesktopSecurity(
PhGetString(deskName),
L"Desktop",
EtpOpenSecurityDesktopHandle,
- EtpCloseSecurityDesktop,
+ EtpCloseSecurityDesktopHandle,
OpenContext
);
}
@@ -2222,15 +2354,17 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
case WM_INITDIALOG:
{
HWINSTA hWinStation;
+
context->WindowHandle = hwndDlg;
context->ListViewHandle = GetDlgItem(hwndDlg, IDC_LIST);
+ context->ListViewClass = PhGetListViewInterface(context->ListViewHandle);
PhSetListViewStyle(context->ListViewHandle, TRUE, TRUE);
PhSetControlTheme(context->ListViewHandle, L"explorer");
- PhAddListViewColumn(context->ListViewHandle, ETDTLVC_NAME, ETDTLVC_NAME, ETDTLVC_NAME, LVCFMT_LEFT, 152, L"Name");
- PhAddListViewColumn(context->ListViewHandle, ETDTLVC_SID, ETDTLVC_SID, ETDTLVC_SID, LVCFMT_LEFT, 105, L"SID");
- PhAddListViewColumn(context->ListViewHandle, ETDTLVC_HEAP, ETDTLVC_HEAP, ETDTLVC_HEAP, LVCFMT_LEFT, 62, L"Heap Size");
- PhAddListViewColumn(context->ListViewHandle, ETDTLVC_IO, ETDTLVC_IO, ETDTLVC_IO, LVCFMT_LEFT, 45, L"Input");
+ PhAddIListViewColumn(context->ListViewClass, ETDTLVC_NAME, ETDTLVC_NAME, ETDTLVC_NAME, LVCFMT_LEFT, 152, L"Name");
+ PhAddIListViewColumn(context->ListViewClass, ETDTLVC_SID, ETDTLVC_SID, ETDTLVC_SID, LVCFMT_LEFT, 105, L"SID");
+ PhAddIListViewColumn(context->ListViewClass, ETDTLVC_HEAP, ETDTLVC_HEAP, ETDTLVC_HEAP, LVCFMT_LEFT, 62, L"Heap Size");
+ PhAddIListViewColumn(context->ListViewClass, ETDTLVC_IO, ETDTLVC_IO, ETDTLVC_IO, LVCFMT_LEFT, 45, L"Input");
PhSetExtendedListView(context->ListViewHandle);
ExtendedListView_SetSort(context->ListViewHandle, 0, NoSortOrder);
PhInitializeLayoutManager(&context->LayoutManager, hwndDlg);
@@ -2258,7 +2392,7 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
ExtendedListView_SetRedraw(context->ListViewHandle, TRUE);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_SIZE:
@@ -2271,24 +2405,30 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
{
INT index = INT_ERROR;
- while ((index = PhFindListViewItemByFlags(
- context->ListViewHandle,
+ while ((index = PhFindIListViewItemByFlags(
+ context->ListViewClass,
index,
LVNI_ALL
)) != INT_ERROR)
{
PPH_STRING deskName;
- if (PhGetListViewItemParam(context->ListViewHandle, index, &deskName))
+ if (PhGetIListViewItemParam(context->ListViewClass, index, &deskName))
{
PhDereferenceObject(deskName);
}
}
+
+ if (context->ListViewClass)
+ {
+ IListView_Release(context->ListViewClass);
+ }
}
break;
case WM_NCDESTROY:
{
PhDeleteLayoutManager(&context->LayoutManager);
PhRemoveWindowContext(hwndDlg, PH_WINDOW_CONTEXT_DEFAULT);
+ PhFree(context);
}
break;
case WM_NOTIFY:
@@ -2298,28 +2438,25 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
LPNMHDR header = (LPNMHDR)lParam;
- if (header->code == NM_DBLCLK)
+ if (header->code == NM_DBLCLK &&
+ header->hwndFrom == context->ListViewHandle)
{
- if (header->hwndFrom != context->ListViewHandle)
- break;
-
LPNMITEMACTIVATE info = (LPNMITEMACTIVATE)header;
- PPH_STRING deskName;
+ PPH_STRING desktop;
- if (deskName = PhGetSelectedListViewItemParam(context->ListViewHandle))
+ if (desktop = PhGetSelectedIListViewItemParam(context->ListViewClass))
{
- EtpOpenDesktopSecurity(context, deskName);
+ EtpOpenDesktopSecurity(context, desktop);
}
}
}
break;
case WM_CONTEXTMENU:
{
- PVOID* listviewItems;
+ PPH_STRING* listviewItems;
ULONG numberOfItems;
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
-
+ PhGetSelectedIListViewItemParams(context->ListViewClass, &listviewItems, &numberOfItems);
if (numberOfItems != 0)
{
POINT point;
@@ -2331,13 +2468,13 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
point.y = GET_Y_LPARAM(lParam);
if (point.x == -1 && point.y == -1)
- PhGetListViewContextMenuPoint(context->ListViewHandle, &point);
+ PhGetIListViewContextMenuPoint(context->ListViewClass, &point);
menu = PhCreateEMenu();
PhInsertEMenuItem(menu, secMenuItem = PhCreateEMenuItem(0, IDC_SECURITY, L"&Security\bEnter", NULL, NULL), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuSeparator(), ULONG_MAX);
PhInsertEMenuItem(menu, PhCreateEMenuItem(0, IDC_COPY, L"&Copy\bCtrl+C", NULL, NULL), ULONG_MAX);
- PhInsertCopyListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle);
+ PhInsertCopyIListViewEMenuItem(menu, IDC_COPY, context->ListViewHandle, context->ListViewClass);
PhSetFlagsEMenuItem(menu, IDC_SECURITY, PH_EMENU_DEFAULT, PH_EMENU_DEFAULT);
if (numberOfItems > 1)
PhSetDisabledEMenuItem(secMenuItem);
@@ -2356,7 +2493,7 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
switch (item->Id)
{
case IDC_COPY:
- PhCopyListView(context->ListViewHandle);
+ PhCopyIListView(context->ListViewHandle, context->ListViewClass);
break;
case IDC_SECURITY:
EtpOpenDesktopSecurity(context, listviewItems[0]);
@@ -2370,18 +2507,16 @@ INT_PTR CALLBACK EtpWinStaPageDlgProc(
break;
case WM_KEYDOWN:
{
- PPH_STRING* listviewItems;
- ULONG numberOfItems;
+ PPH_STRING desktop;
switch (LOWORD(wParam))
{
case VK_RETURN:
if (GetFocus() == context->ListViewHandle)
{
- PhGetSelectedListViewItemParams(context->ListViewHandle, &listviewItems, &numberOfItems);
- if (numberOfItems == 1)
+ if (desktop = PhGetSelectedIListViewItemParam(context->ListViewClass))
{
- EtpOpenDesktopSecurity(context, listviewItems[0]);
+ EtpOpenDesktopSecurity(context, desktop);
return TRUE;
}
}
diff --git a/plugins/ExtendedTools/pooldialog.c b/plugins/ExtendedTools/pooldialog.c
index 873f9179d21f..6cee0f65254f 100644
--- a/plugins/ExtendedTools/pooldialog.c
+++ b/plugins/ExtendedTools/pooldialog.c
@@ -215,7 +215,7 @@ INT_PTR CALLBACK EtPoolMonDlgProc(
&context->ProcessesUpdatedCallbackRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM)context->TreeNewHandle, TRUE);
}
diff --git a/plugins/ExtendedTools/pooldialogbig.c b/plugins/ExtendedTools/pooldialogbig.c
index 12d4e4af3944..5c9f0d9a787c 100644
--- a/plugins/ExtendedTools/pooldialogbig.c
+++ b/plugins/ExtendedTools/pooldialogbig.c
@@ -124,7 +124,7 @@ INT_PTR CALLBACK EtBigPoolMonDlgProc(
else
PhCenterWindow(hwndDlg, NULL);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtUpdateBigPoolTable(context);
}
diff --git a/plugins/ExtendedTools/reparse.c b/plugins/ExtendedTools/reparse.c
index fa083fbd11a6..aa0893862e57 100644
--- a/plugins/ExtendedTools/reparse.c
+++ b/plugins/ExtendedTools/reparse.c
@@ -1007,7 +1007,7 @@ INT_PTR CALLBACK EtFindSecurityIdsDlgProc(
PhAddListViewColumn(context->ListViewHandle, 0, 0, 0, LVCFMT_LEFT, 40, L"#");
PhAddListViewColumn(context->ListViewHandle, 1, 1, 1, LVCFMT_LEFT, 250, L"Filename");
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
if (context->FileList)
{
@@ -1205,7 +1205,7 @@ INT_PTR CALLBACK EtReparseDlgProc(
break;
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EnableWindow(GetDlgItem(hwndDlg, IDRETRY), FALSE);
diff --git a/plugins/ExtendedTools/smbios.c b/plugins/ExtendedTools/smbios.c
index 336183fc2268..aea73758f033 100644
--- a/plugins/ExtendedTools/smbios.c
+++ b/plugins/ExtendedTools/smbios.c
@@ -4274,7 +4274,7 @@ INT_PTR CALLBACK EtSMBIOSDlgProc(
EtEnumerateSMBIOSEntries(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/tpm.c b/plugins/ExtendedTools/tpm.c
index db573c983fae..50c9df546275 100644
--- a/plugins/ExtendedTools/tpm.c
+++ b/plugins/ExtendedTools/tpm.c
@@ -781,7 +781,7 @@ INT_PTR CALLBACK EtTpmDlgProc(
else
PhCenterWindow(hwndDlg, context->ParentWindowHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtEnumerateTpmEntries(context);
}
diff --git a/plugins/ExtendedTools/tpm_editor.c b/plugins/ExtendedTools/tpm_editor.c
index 5e8fdbadbec6..7e6af7a80cab 100644
--- a/plugins/ExtendedTools/tpm_editor.c
+++ b/plugins/ExtendedTools/tpm_editor.c
@@ -166,7 +166,7 @@ INT_PTR CALLBACK EtTpmEditorDlgProc(
}
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM)context->HexEditHandle, TRUE);
}
diff --git a/plugins/ExtendedTools/unldll.c b/plugins/ExtendedTools/unldll.c
index 051e42f128aa..4aa08dbb48d4 100644
--- a/plugins/ExtendedTools/unldll.c
+++ b/plugins/ExtendedTools/unldll.c
@@ -515,7 +515,7 @@ INT_PTR CALLBACK EtpUnloadedDllsDlgProc(
return FALSE;
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/ExtendedTools/waitchain.c b/plugins/ExtendedTools/waitchain.c
index 663907cb73e9..c6677a088523 100644
--- a/plugins/ExtendedTools/waitchain.c
+++ b/plugins/ExtendedTools/waitchain.c
@@ -406,7 +406,7 @@ INT_PTR CALLBACK WaitChainDlgProc(
else
PhCenterWindow(hwndDlg, context->ParentWindowHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
EtWaitChainSetTreeStatusMessage(context, FALSE);
diff --git a/plugins/ExtendedTools/wswatch.c b/plugins/ExtendedTools/wswatch.c
index ed878896a70a..d4679371bb99 100644
--- a/plugins/ExtendedTools/wswatch.c
+++ b/plugins/ExtendedTools/wswatch.c
@@ -515,7 +515,7 @@ INT_PTR CALLBACK EtpWsWatchDlgProc(
PhSetWindowText(context->WindowHandle, PH_AUTO_T(PH_STRING, EtpCreateWindowTitle(context))->Buffer);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/HardwareDevices/deviceprops.c b/plugins/HardwareDevices/deviceprops.c
index d40c2ec32f56..d019a94c62d3 100644
--- a/plugins/HardwareDevices/deviceprops.c
+++ b/plugins/HardwareDevices/deviceprops.c
@@ -279,10 +279,7 @@ INT_PTR CALLBACK DevicePropGeneralDlgProc(
ExtendedListView_SetColumnWidth(context->GeneralListViewHandle, 1, ELVSCW_AUTOSIZE_REMAININGSPACE);
}
- if (!!PhGetIntegerSetting(L"EnableThemeSupport")) // TODO: Required for compat (dmex)
- PhInitializeWindowTheme(GetParent(hwndDlg), !!PhGetIntegerSetting(L"EnableThemeSupport"));
- else
- PhInitializeWindowTheme(hwndDlg, FALSE);
+ PhInitializeWindowTheme(GetParent(hwndDlg));
}
break;
case WM_DESTROY:
@@ -683,7 +680,7 @@ INT_PTR CALLBACK DevicePropPropertiesDlgProc(
DeviceInitializePropsPage(hwndDlg, context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -857,7 +854,7 @@ INT_PTR CALLBACK DevicePropInterfacesDlgProc(
DeviceInitializeInterfacesPage(hwndDlg, context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -985,7 +982,7 @@ INT_PTR CALLBACK DevicePropResourcesDlgProc(
PhSetListViewSubItem(context->ResourcesListViewHandle, lvItemIndex, 1, PhGetString(resource->Setting));
}
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/HardwareDevices/devicetree.c b/plugins/HardwareDevices/devicetree.c
index b1c4257954a4..f7c8a39286bf 100644
--- a/plugins/HardwareDevices/devicetree.c
+++ b/plugins/HardwareDevices/devicetree.c
@@ -1381,12 +1381,7 @@ VOID DevicesTreeInitialize(
TreeNew_SetRowHeight(DeviceTreeHandle, treelistCustomRowSize);
}
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
- {
- PhInitializeWindowTheme(DeviceTreeHandle, TRUE);
- PhSetControlTheme(DeviceTreeHandle, L"DarkMode_Explorer");
- TreeNew_ThemeSupport(DeviceTreeHandle, TRUE);
- }
+ PhInitializeWindowTheme(DeviceTreeHandle);
TreeNew_SetTriState(DeviceTreeHandle, TRUE);
TreeNew_SetRedraw(DeviceTreeHandle, TRUE);
@@ -1414,7 +1409,7 @@ BOOLEAN DevicesTabPageCallback(
PH_TREENEW_CREATEPARAMS treelistCreateParams = { 0 };
thinRows = PhGetIntegerSetting(L"ThinRows") ? TN_STYLE_THIN_ROWS : 0;
- treelistBorder = (PhGetIntegerSetting(L"TreeListBorderEnable") && !PhGetIntegerSetting(L"EnableThemeSupport")) ? WS_BORDER : 0;
+ treelistBorder = (PhGetIntegerSetting(L"TreeListBorderEnable") && !PhIsThemeSupportEnabled()) ? WS_BORDER : 0;
treelistCustomColors = PhGetIntegerSetting(L"TreeListCustomColorsEnable") ? TN_STYLE_CUSTOM_COLORS : 0;
if (treelistCustomColors)
diff --git a/plugins/HardwareDevices/diskdetails.c b/plugins/HardwareDevices/diskdetails.c
index 66d7f02eed21..06083f3c4575 100644
--- a/plugins/HardwareDevices/diskdetails.c
+++ b/plugins/HardwareDevices/diskdetails.c
@@ -662,11 +662,8 @@ INT_PTR CALLBACK DiskDeviceFileSystemDetailsDlgProc(
// Note: Load settings after querying devices. (dmex)
PhLoadListViewColumnsFromSetting(SETTING_NAME_DISK_COUNTERS_COLUMNS, context->ListViewHandle);
- if (!!PhGetIntegerSetting(L"EnableThemeSupport")) // TODO: Required for compat (dmex)
- PhInitializeWindowTheme(GetParent(hwndDlg), !!PhGetIntegerSetting(L"EnableThemeSupport"));
- else
- PhInitializeWindowTheme(hwndDlg, FALSE);
-
+ PhInitializeWindowTheme(GetParent(hwndDlg));
+
PhRegisterCallback(
PhGetGeneralCallback(GeneralCallbackProcessProviderUpdatedEvent),
DiskDeviceProcessesUpdatedHandler,
@@ -837,7 +834,7 @@ INT_PTR CALLBACK DiskDeviceSmartDetailsDlgProc(
DiskDeviceQuerySmart(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/HardwareDevices/gpudetails.c b/plugins/HardwareDevices/gpudetails.c
index 83689e609b50..fdee327cf974 100644
--- a/plugins/HardwareDevices/gpudetails.c
+++ b/plugins/HardwareDevices/gpudetails.c
@@ -426,7 +426,7 @@ INT_PTR CALLBACK GraphicsDeviceDetailsDlgProc(
else
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
GraphicsDeviceQueryAdapterDetails(context);
diff --git a/plugins/HardwareDevices/gpunodes.c b/plugins/HardwareDevices/gpunodes.c
index b6f1bdbeab41..34ea955f58d9 100644
--- a/plugins/HardwareDevices/gpunodes.c
+++ b/plugins/HardwareDevices/gpunodes.c
@@ -241,7 +241,7 @@ INT_PTR CALLBACK GraphicsDeviceNodesDlgProc(
&context->ProcessesUpdatedCallbackRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/HardwareDevices/gpuoptions.c b/plugins/HardwareDevices/gpuoptions.c
index 89d3493a9040..45890d6e6bf8 100644
--- a/plugins/HardwareDevices/gpuoptions.c
+++ b/plugins/HardwareDevices/gpuoptions.c
@@ -511,6 +511,7 @@ VOID FindGraphicsDevices(
PhFree(entry);
}
PhReleaseQueuedLockShared(&GraphicsDevicesListLock);
+ PhDereferenceObject(deviceList);
// HACK: Show all unknown devices.
PhAcquireQueuedLockShared(&GraphicsDevicesListLock);
diff --git a/plugins/HardwareDevices/netdetails.c b/plugins/HardwareDevices/netdetails.c
index fd25dccdbe94..4d5fd8b83b66 100644
--- a/plugins/HardwareDevices/netdetails.c
+++ b/plugins/HardwareDevices/netdetails.c
@@ -686,7 +686,7 @@ INT_PTR CALLBACK NetAdapterDetailsDlgProc(
&context->NotifyHandle
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport")); // HACK
+ PhInitializeWindowTheme(hwndDlg); // HACK
}
break;
case WM_DESTROY:
diff --git a/plugins/NetworkTools/options.c b/plugins/NetworkTools/options.c
index 5d08e689fed4..c36cc18de5e4 100644
--- a/plugins/NetworkTools/options.c
+++ b/plugins/NetworkTools/options.c
@@ -199,7 +199,7 @@ INT_PTR CALLBACK OptionsGeoLiteDlgProc(
PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDC_KEY_EDIT));
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/NetworkTools/ping.c b/plugins/NetworkTools/ping.c
index c4b24b27e9ff..8ce3e4b1f68e 100644
--- a/plugins/NetworkTools/ping.c
+++ b/plugins/NetworkTools/ping.c
@@ -432,7 +432,7 @@ INT_PTR CALLBACK NetworkPingWndProc(
&context->ProcessesUpdatedRegistration
);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_COMMAND:
diff --git a/plugins/NetworkTools/tracert.c b/plugins/NetworkTools/tracert.c
index 75c12f6afa0b..84701dfaff06 100644
--- a/plugins/NetworkTools/tracert.c
+++ b/plugins/NetworkTools/tracert.c
@@ -795,7 +795,7 @@ INT_PTR CALLBACK TracertDlgProc(
PhReferenceObject(context);
PhCreateThread2(NetworkTracertThreadStart, context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/plugins/NetworkTools/whois.c b/plugins/NetworkTools/whois.c
index 25eaff0cbba9..abf344b314ff 100644
--- a/plugins/NetworkTools/whois.c
+++ b/plugins/NetworkTools/whois.c
@@ -20,27 +20,6 @@ VOID RichEditSetText(
_In_ PWSTR Text
)
{
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
- {
- CHARFORMAT cf;
-
- memset(&cf, 0, sizeof(CHARFORMAT));
- cf.cbSize = sizeof(CHARFORMAT);
- cf.dwMask = CFM_COLOR;
-
- switch (PhGetIntegerSetting(L"GraphColorMode"))
- {
- case 0: // New colors
- cf.crTextColor = RGB(0x0, 0x0, 0x0);
- break;
- case 1: // Old colors
- cf.crTextColor = RGB(0xff, 0xff, 0xff);
- break;
- }
-
- SendMessage(RichEditHandle, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&cf);
- }
-
SetFocus(RichEditHandle);
SendMessage(RichEditHandle, WM_SETREDRAW, FALSE, 0);
SendMessage(RichEditHandle, EM_SETSEL, 0, -1); // -2
@@ -917,7 +896,7 @@ INT_PTR CALLBACK WhoisDlgProc(
else
PhCenterWindow(hwndDlg, context->ParentWindowHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
PhReferenceObject(context);
PhCreateThread2(NetworkWhoisThreadStart, (PVOID)context);
diff --git a/plugins/OnlineChecks/options.c b/plugins/OnlineChecks/options.c
index 1411c53a6d47..fb1d9e611d16 100644
--- a/plugins/OnlineChecks/options.c
+++ b/plugins/OnlineChecks/options.c
@@ -110,7 +110,7 @@ INT_PTR CALLBACK OptionsGeoLiteDlgProc(
PhSetDialogFocus(WindowHandle, GetDlgItem(WindowHandle, IDC_KEY_EDIT));
- PhInitializeWindowTheme(WindowHandle, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_DESTROY:
diff --git a/plugins/ToolStatus/customizesb.c b/plugins/ToolStatus/customizesb.c
index f47d4b18cbc0..7ff1e11a3513 100644
--- a/plugins/ToolStatus/customizesb.c
+++ b/plugins/ToolStatus/customizesb.c
@@ -290,28 +290,22 @@ INT_PTR CALLBACK CustomizeStatusBarDialogProc(
context->WindowDpi = PhGetWindowDpi(hwndDlg);
context->FontHandle = PhCreateIconTitleFont(context->WindowDpi);
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
- {
- context->BrushNormal = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowBackgroundColor"));
- context->BrushHot = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlightColor"));
- context->BrushPushed = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlight2Color"));
- context->TextColor = PhGetIntegerSetting(L"ThemeWindowTextColor");
- }
- else
- {
- context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
- context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
- context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
- context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
- }
+ context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
+ context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
+ context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
+ context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
+ context->BrushNormalDark = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowBackgroundColor"));
+ context->BrushHotDark = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlightColor"));
+ context->BrushPushedDark = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlight2Color"));
+ context->TextColorDark = PhGetIntegerSetting(L"ThemeWindowTextColor");
ListBox_SetItemHeight(context->AvailableListHandle, 0, PhGetDpi(22, context->WindowDpi)); // BitmapHeight
ListBox_SetItemHeight(context->CurrentListHandle, 0, PhGetDpi(22, context->WindowDpi)); // BitmapHeight
CustomizeLoadStatusBarItems(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
PhSetDialogFocus(context->WindowHandle, context->CurrentListHandle);
}
@@ -331,6 +325,15 @@ INT_PTR CALLBACK CustomizeStatusBarDialogProc(
if (context->BrushPushed)
DeleteBrush(context->BrushPushed);
+ if (context->BrushNormalDark)
+ DeleteBrush(context->BrushNormalDark);
+
+ if (context->BrushHotDark)
+ DeleteBrush(context->BrushHotDark);
+
+ if (context->BrushPushedDark)
+ DeleteBrush(context->BrushPushedDark);
+
if (context->FontHandle)
DeleteFont(context->FontHandle);
}
@@ -595,12 +598,12 @@ INT_PTR CALLBACK CustomizeStatusBarDialogProc(
SetBkMode(bufferDc, TRANSPARENT);
if (isSelected || isFocused)
- FillRect(bufferDc, &bufferRect, context->BrushHot);
+ FillRect(bufferDc, &bufferRect, PhIsThemeSupportEnabled() ? context->BrushHotDark : context->BrushHot);
else
- FillRect(bufferDc, &bufferRect, context->BrushNormal);
+ FillRect(bufferDc, &bufferRect, PhIsThemeSupportEnabled() ? context->BrushNormalDark : context->BrushNormal);
if (!button->IsVirtual)
- SetTextColor(bufferDc, context->TextColor);
+ SetTextColor(bufferDc, PhIsThemeSupportEnabled() ? context->TextColorDark : context->TextColor);
else
SetTextColor(bufferDc, GetSysColor(COLOR_GRAYTEXT));
diff --git a/plugins/ToolStatus/customizetb.c b/plugins/ToolStatus/customizetb.c
index 32724014ac40..32a158f36be1 100644
--- a/plugins/ToolStatus/customizetb.c
+++ b/plugins/ToolStatus/customizetb.c
@@ -514,20 +514,15 @@ INT_PTR CALLBACK CustomizeToolbarDialogProc(
context->FontHandle = PhCreateIconTitleFont(context->WindowDpi);
context->CXWidth = PhGetDpi(16, context->WindowDpi);
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
- {
- context->BrushNormal = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowBackgroundColor"));
- context->BrushHot = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlightColor"));
- context->BrushPushed = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlight2Color"));
- context->TextColor = PhGetIntegerSetting(L"ThemeWindowTextColor");
- }
- else
- {
- context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
- context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
- context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
- context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
- }
+ context->BrushNormal = GetSysColorBrush(COLOR_WINDOW);
+ context->BrushHot = CreateSolidBrush(RGB(145, 201, 247));
+ context->BrushPushed = CreateSolidBrush(RGB(153, 209, 255));
+ context->TextColor = GetSysColor(COLOR_WINDOWTEXT);
+
+ context->BrushNormalDark = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowBackgroundColor"));
+ context->BrushHotDark = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlightColor"));
+ context->BrushPushedDark = CreateSolidBrush(PhGetIntegerSetting(L"ThemeWindowHighlight2Color"));
+ context->TextColorDark = PhGetIntegerSetting(L"ThemeWindowTextColor");
ListBox_SetItemHeight(context->AvailableListHandle, 0, context->CXWidth + 6); // BitmapHeight
ListBox_SetItemHeight(context->CurrentListHandle, 0, context->CXWidth + 6); // BitmapHeight
@@ -535,7 +530,7 @@ INT_PTR CALLBACK CustomizeToolbarDialogProc(
CustomizeLoadToolbarItems(context);
CustomizeLoadToolbarSettings(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
PhSetDialogFocus(context->WindowHandle, context->CurrentListHandle);
}
@@ -555,6 +550,15 @@ INT_PTR CALLBACK CustomizeToolbarDialogProc(
if (context->BrushPushed)
DeleteBrush(context->BrushPushed);
+ if (context->BrushNormalDark)
+ DeleteBrush(context->BrushNormalDark);
+
+ if (context->BrushHotDark)
+ DeleteBrush(context->BrushHotDark);
+
+ if (context->BrushPushedDark)
+ DeleteBrush(context->BrushPushedDark);
+
if (context->FontHandle)
DeleteFont(context->FontHandle);
}
@@ -888,13 +892,13 @@ INT_PTR CALLBACK CustomizeToolbarDialogProc(
SelectFont(bufferDc, context->FontHandle);
SetBkMode(bufferDc, TRANSPARENT);
- if (isFocused || isSelected)
- FillRect(bufferDc, &bufferRect, context->BrushHot);
+ if (isSelected || isFocused)
+ FillRect(bufferDc, &bufferRect, PhIsThemeSupportEnabled() ? context->BrushHotDark : context->BrushHot);
else
- FillRect(bufferDc, &bufferRect, context->BrushNormal);
+ FillRect(bufferDc, &bufferRect, PhIsThemeSupportEnabled() ? context->BrushNormalDark : context->BrushNormal);
if (!itemContext->IsVirtual)
- SetTextColor(bufferDc, context->TextColor);
+ SetTextColor(bufferDc, PhIsThemeSupportEnabled() ? context->TextColorDark : context->TextColor);
else
SetTextColor(bufferDc, GetSysColor(COLOR_GRAYTEXT));
diff --git a/plugins/ToolStatus/main.c b/plugins/ToolStatus/main.c
index 771d31e84369..3c1baabf1e75 100644
--- a/plugins/ToolStatus/main.c
+++ b/plugins/ToolStatus/main.c
@@ -1107,8 +1107,9 @@ LRESULT CALLBACK MainWindowCallbackProc(
break;
case NM_CUSTOMDRAW:
{
- if (EnableThemeSupport)
- return PhThemeWindowDrawRebar((LPNMCUSTOMDRAW)lParam);
+ // Rebar is drawing in PhpThemeWindowSubclassProc of main window
+ //if (EnableThemeSupport)
+ // return PhThemeWindowDrawRebar((LPNMCUSTOMDRAW)lParam);
}
break;
}
@@ -1267,8 +1268,9 @@ LRESULT CALLBACK MainWindowCallbackProc(
break;
case NM_CUSTOMDRAW:
{
- if (EnableThemeSupport)
- return PhThemeWindowDrawToolbar((LPNMTBCUSTOMDRAW)lParam);
+ // Toolbar is drawing in PhpThemeWindowSubclassProc of main window
+ //if (EnableThemeSupport)
+ // return PhThemeWindowDrawToolbar((LPNMTBCUSTOMDRAW)lParam);
}
break;
}
@@ -1739,6 +1741,8 @@ VOID UpdateCachedSettings(
IconSingleClick = !!PhGetIntegerSetting(L"IconSingleClick");
EnableAvxSupport = !!PhGetIntegerSetting(L"EnableAvxSupport");
EnableGraphMaxScale = !!PhGetIntegerSetting(L"EnableGraphMaxScale");
+ EnableThemeSupport = PhIsThemeSupportEnabled();
+ InvalidateRect(RebarHandle, NULL, TRUE);
if (ToolbarInitialized)
{
@@ -1756,7 +1760,7 @@ VOID NTAPI LoadCallback(
SearchBoxDisplayMode = PhGetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE);
TaskbarListIconType = PhGetIntegerSetting(SETTING_NAME_TASKBARDISPLAYSTYLE);
RestoreRowAfterSearch = !!PhGetIntegerSetting(SETTING_NAME_RESTOREROWAFTERSEARCH);
- EnableThemeSupport = !!PhGetIntegerSetting(L"EnableThemeSupport");
+ EnableThemeSupport = PhIsThemeSupportEnabled();
UpdateGraphs = !PhGetIntegerSetting(L"StartHidden");
TabInfoHashtable = PhCreateSimpleHashtable(3);
diff --git a/plugins/ToolStatus/toolstatus.h b/plugins/ToolStatus/toolstatus.h
index fa283a0352a8..e39247e73d04 100644
--- a/plugins/ToolStatus/toolstatus.h
+++ b/plugins/ToolStatus/toolstatus.h
@@ -475,6 +475,10 @@ typedef struct _CUSTOMIZE_CONTEXT
HBRUSH BrushPushed;
HBRUSH BrushHot;
COLORREF TextColor;
+ HBRUSH BrushNormalDark;
+ HBRUSH BrushPushedDark;
+ HBRUSH BrushHotDark;
+ COLORREF TextColorDark;
LONG WindowDpi;
INT CXWidth;
diff --git a/plugins/Updater/options.c b/plugins/Updater/options.c
index b1769bbaf471..4e0ab43395d0 100644
--- a/plugins/Updater/options.c
+++ b/plugins/Updater/options.c
@@ -563,7 +563,7 @@ INT_PTR CALLBACK TextDlgProc(
//PhSetWindowText(GetDlgItem(hwndDlg, IDC_TEXT), PhGetString(context->BuildMessage));
PhCreateThread2(PhpUpdaterQueryCommitHistoryThread, hwndDlg);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -697,7 +697,7 @@ INT_PTR CALLBACK TextDlgProc(
if (PhEqualString(commitHash, shortCommitHash, TRUE))
{
newFont = context->ListViewBoldFont;
- if (PhGetIntegerSetting(L"EnableThemeSupport"))
+ if (PhIsThemeSupportEnabled())
customDraw->clrText = RGB(125, 125, 125);
else
customDraw->clrText = GetSysColor(COLOR_WINDOWTEXT);
diff --git a/plugins/UserNotes/prpcmpage.c b/plugins/UserNotes/prpcmpage.c
index 9ac7d664919e..909b610e813e 100644
--- a/plugins/UserNotes/prpcmpage.c
+++ b/plugins/UserNotes/prpcmpage.c
@@ -72,7 +72,7 @@ INT_PTR CALLBACK ProcessCommentPageDlgProc(
if (!processItem->CommandLine)
EnableWindow(context->MatchCommandlineHandle, FALSE);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -268,7 +268,7 @@ INT_PTR CALLBACK ServiceCommentPageDlgProc(
PhSetDialogItemText(hwndDlg, IDC_COMMENT, comment->Buffer);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -360,7 +360,7 @@ UINT_PTR CALLBACK ColorDlgHookProc(
{
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_CTLCOLORBTN:
diff --git a/plugins/WindowExplorer/wnddlg.c b/plugins/WindowExplorer/wnddlg.c
index e74cecd229e3..ef344b139562 100644
--- a/plugins/WindowExplorer/wnddlg.c
+++ b/plugins/WindowExplorer/wnddlg.c
@@ -859,7 +859,7 @@ INT_PTR CALLBACK WepWindowsDlgProc(
PhSetDialogFocus(hwndDlg, context->TreeNewHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -1309,7 +1309,7 @@ INT_PTR CALLBACK WepWindowsDlgProc(
{
if (!WeShowWindowProperties(hwndDlg, selectedNode->WindowHandle, !!selectedNode->WindowMessageOnly, &selectedNode->ClientId))
{
- PhShowError2(hwndDlg, L"The window does not exist.", L"%s", L"");
+ //PhShowError2(hwndDlg, L"The window does not exist.", L"%s", L"");
}
}
}
@@ -1413,6 +1413,8 @@ INT_PTR CALLBACK WepWindowsDlgProc(
// break;
case WE_WM_FINDWINDOW:
{
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_REFRESH, BN_CLICKED), 0);
+
// Direct all mouse events to this window.
SetCapture(hwndDlg);
@@ -1629,7 +1631,7 @@ INT_PTR CALLBACK WepWindowsPageProc(
WepRefreshWindows(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -2023,7 +2025,7 @@ INT_PTR CALLBACK WepWindowsPageProc(
{
if (!WeShowWindowProperties(hwndDlg, selectedNode->WindowHandle, !!selectedNode->WindowMessageOnly, &selectedNode->ClientId))
{
- PhShowError2(hwndDlg, L"The window does not exist.", L"%s", L"");
+ //PhShowError2(hwndDlg, L"The window does not exist.", L"%s", L"");
}
}
}
@@ -2119,6 +2121,8 @@ INT_PTR CALLBACK WepWindowsPageProc(
break;
case WE_WM_FINDWINDOW:
{
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_REFRESH, BN_CLICKED), 0);
+
// Direct all mouse events to this window.
SetCapture(hwndDlg);
diff --git a/plugins/WindowExplorer/wndprp.c b/plugins/WindowExplorer/wndprp.c
index 2b6233d0b5cb..7dc6ac73a6eb 100644
--- a/plugins/WindowExplorer/wndprp.c
+++ b/plugins/WindowExplorer/wndprp.c
@@ -1499,10 +1499,7 @@ INT_PTR CALLBACK WepWindowGeneralDlgProc(
ExtendedListView_SetColumnWidth(context->ListViewHandle, 1, ELVSCW_AUTOSIZE_REMAININGSPACE);
- if (!!PhGetIntegerSetting(L"EnableThemeSupport")) // TODO: Required for compat (dmex)
- PhInitializeWindowTheme(GetParent(hwndDlg), !!PhGetIntegerSetting(L"EnableThemeSupport"));
- else
- PhInitializeWindowTheme(hwndDlg, FALSE);
+ PhInitializeWindowTheme(GetParent(hwndDlg));
}
break;
case WM_DESTROY:
@@ -1723,7 +1720,7 @@ static INT_PTR CALLBACK WepWindowPropEditDlgProc(
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDCANCEL));
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -1911,7 +1908,7 @@ INT_PTR CALLBACK WepWindowPropListDlgProc(
WepRefreshWindowProps(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -2183,7 +2180,7 @@ INT_PTR CALLBACK WepWindowPropStoreDlgProc(
WepRefreshWindowPropertyStorage(context);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -2394,7 +2391,7 @@ INT_PTR CALLBACK WepWindowPreviewDlgProc(
PhAddListViewColumn(lvHandle, 1, 1, 1, LVCFMT_LEFT, 100, L"Value");
PhSetExtendedListView(lvHandle);
- PhInitializeWindowTheme(hwndDlg, !!PhGetIntegerSetting(L"EnableThemeSupport"));
+ PhInitializeWindowTheme(hwndDlg);
PhSetTimer(hwndDlg, PH_WINDOW_TIMER_DEFAULT, 1000, NULL);
}
diff --git a/plugins/WindowExplorer/wndtree.c b/plugins/WindowExplorer/wndtree.c
index 2a3e7c8e225a..ecdf8bc273ac 100644
--- a/plugins/WindowExplorer/wndtree.c
+++ b/plugins/WindowExplorer/wndtree.c
@@ -58,7 +58,7 @@ BOOLEAN WeWindowTreeFilterCallback(
if (windowNode->WindowHandleString[0])
{
- if (PhSearchControlMatchLongHintZ(context->SearchMatchHandle, windowNode->WindowHandleString))
+ if (PhSearchControlMatchPointer(context->SearchMatchHandle, windowNode->WindowHandle))
return TRUE;
}
@@ -484,7 +484,7 @@ BOOLEAN NTAPI WepWindowTreeNewCallback(
node = (PWE_WINDOW_NODE)getNodeColor->Node;
if (!node->WindowVisible)
- getNodeColor->ForeColor = RGB(0x55, 0x55, 0x55);
+ getNodeColor->ForeColor = PhGetIntegerSetting(L"ColorServiceStop");
if (node->WindowMessageOnly)
{
diff --git a/tools/CustomBuildTool/HeaderGen.cs b/tools/CustomBuildTool/HeaderGen.cs
index c09effbdbd88..a134b06daad4 100644
--- a/tools/CustomBuildTool/HeaderGen.cs
+++ b/tools/CustomBuildTool/HeaderGen.cs
@@ -55,7 +55,8 @@ public static class HeaderGen
"sysinfo.h",
"procgrp.h",
"miniinfo.h",
- "hndlmenu.h"
+ "hndlmenu.h",
+ "hndlprp.h"
];
private static List OrderHeaderFiles(List headerFiles)
diff --git a/tools/peview/attributes.c b/tools/peview/attributes.c
index 6190557d0095..f60823e223a9 100644
--- a/tools/peview/attributes.c
+++ b/tools/peview/attributes.c
@@ -145,7 +145,7 @@ INT_PTR CALLBACK PvpPeExtendedAttributesDlgProc(
PvEnumerateFileExtendedAttributes(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/cfgprp.c b/tools/peview/cfgprp.c
index b7e70deec030..8fdfa1c92083 100644
--- a/tools/peview/cfgprp.c
+++ b/tools/peview/cfgprp.c
@@ -230,7 +230,7 @@ INT_PTR CALLBACK PvpPeCgfDlgProc(
PvpPeCgfEnumGuardFunctions(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/chcol.c b/tools/peview/chcol.c
index 178b43cc88ed..c190db998d5d 100644
--- a/tools/peview/chcol.c
+++ b/tools/peview/chcol.c
@@ -390,7 +390,7 @@ INT_PTR CALLBACK PvColumnsDlgProc(
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_INACTIVE, LBN_SELCHANGE), (LPARAM)context->InactiveWindowHandle);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_ACTIVE, LBN_SELCHANGE), (LPARAM)context->ActiveWindowHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
PhSetDialogFocus(hwndDlg, GetDlgItem(hwndDlg, IDCANCEL));
}
diff --git a/tools/peview/clrprp.c b/tools/peview/clrprp.c
index 91ee14bc0d27..cee09e739ad8 100644
--- a/tools/peview/clrprp.c
+++ b/tools/peview/clrprp.c
@@ -520,7 +520,7 @@ INT_PTR CALLBACK PvpPeClrDlgProc(
PvpPeClrEnumSections(clrMetaData, context->ListViewHandle);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/clrprptables.c b/tools/peview/clrprptables.c
index 906229f5b616..38318e21c3e8 100644
--- a/tools/peview/clrprptables.c
+++ b/tools/peview/clrprptables.c
@@ -144,7 +144,7 @@ INT_PTR CALLBACK PvpPeClrTablesDlgProc(
PvClrEnumerateTables(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/clrtableimportprp.c b/tools/peview/clrtableimportprp.c
index 961984e1cdef..0fcfc49579df 100644
--- a/tools/peview/clrtableimportprp.c
+++ b/tools/peview/clrtableimportprp.c
@@ -144,7 +144,7 @@ INT_PTR CALLBACK PvpPeClrImportsDlgProc(
PvpEnumerateClrImports(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/debugprp.c b/tools/peview/debugprp.c
index 5e4c0ce3ea73..80025f3ae9a8 100644
--- a/tools/peview/debugprp.c
+++ b/tools/peview/debugprp.c
@@ -164,7 +164,7 @@ INT_PTR CALLBACK PvpPeDebugDlgProc(
PhFree(debug.DebugEntries);
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/delayhook.c b/tools/peview/delayhook.c
deleted file mode 100644
index a05c8708910d..000000000000
--- a/tools/peview/delayhook.c
+++ /dev/null
@@ -1,2176 +0,0 @@
-/*
- * Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
- *
- * This file is part of System Informer.
- *
- * Authors:
- *
- * dmex 2022-2023
- *
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "settings.h"
-
-// https://learn.microsoft.com/en-us/windows/win32/winmsg/about-window-procedures#window-procedure-superclassing
-static WNDPROC PhDefaultMenuWindowProcedure = NULL;
-static WNDPROC PhDefaultDialogWindowProcedure = NULL;
-static WNDPROC PhDefaultRebarWindowProcedure = NULL;
-static WNDPROC PhDefaultComboBoxWindowProcedure = NULL;
-static WNDPROC PhDefaultStaticWindowProcedure = NULL;
-static WNDPROC PhDefaultStatusbarWindowProcedure = NULL;
-static WNDPROC PhDefaultEditWindowProcedure = NULL;
-static WNDPROC PhDefaultHeaderWindowProcedure = NULL;
-static BOOLEAN PhDefaultEnableStreamerMode = FALSE;
-static BOOLEAN PhDefaultEnableThemeAcrylicWindowSupport = FALSE;
-static BOOLEAN PhDefaultEnableThemeAnimation = FALSE;
-
-LRESULT CALLBACK PhMenuWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- switch (WindowMessage)
- {
- case WM_NCCREATE:
- {
- //CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
-
- if (PhEnableThemeSupport)
- {
- HFONT fontHandle;
- LONG windowDpi = PhGetWindowDpi(WindowHandle);
-
- if (fontHandle = PhCreateMessageFont(windowDpi))
- {
- PhSetWindowContext(WindowHandle, (ULONG)'font', fontHandle);
- SetWindowFont(WindowHandle, fontHandle, TRUE);
- }
- }
- }
- break;
- case WM_CREATE:
- {
- //CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
-
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
- }
-
- if (PhEnableThemeSupport)
- {
- if (PhEnableThemeAcrylicSupport)
- {
- // Note: DWM crashes if called from WM_NCCREATE (dmex)
- PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
- }
- }
- }
- break;
- case WM_NCDESTROY:
- {
- if (PhEnableThemeSupport)
- {
- HFONT fontHandle;
-
- fontHandle = PhGetWindowContext(WindowHandle, (ULONG)'font');
- PhRemoveWindowContext(WindowHandle, (ULONG)'font');
-
- if (fontHandle)
- {
- DeleteFont(fontHandle);
- }
- }
- }
- break;
- }
-
- return CallWindowProc(PhDefaultMenuWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-}
-
-LRESULT CALLBACK PhDialogWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- switch (WindowMessage)
- {
- case WM_CREATE:
- {
- //CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
- //IsTopLevelWindow(createStruct->hwndParent)
-
- if (WindowHandle == GetAncestor(WindowHandle, GA_ROOT))
- {
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
- }
-
- if (PhEnableThemeSupport && PhDefaultEnableThemeAcrylicWindowSupport)
- {
- // Note: DWM crashes if called from WM_NCCREATE (dmex)
- PhSetWindowAcrylicCompositionColor(WindowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
- }
- }
- }
- break;
- }
-
- return CallWindowProc(PhDefaultDialogWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-}
-
-LRESULT CALLBACK PhRebarWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- switch (WindowMessage)
- {
- case WM_CTLCOLOREDIT:
- {
- HDC hdc = (HDC)wParam;
-
- SetBkMode(hdc, TRANSPARENT);
- SetTextColor(hdc, PhThemeWindowTextColor);
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- return (INT_PTR)PhGetStockBrush(DC_BRUSH);
- }
- break;
- }
-
- return CallWindowProc(PhDefaultRebarWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-}
-
-LRESULT CALLBACK PhComboBoxWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- LRESULT result = CallWindowProc(PhDefaultComboBoxWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
- switch (WindowMessage)
- {
- case WM_NCCREATE:
- {
- //CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
- COMBOBOXINFO info = { sizeof(COMBOBOXINFO) };
-
- if (SendMessage(WindowHandle, CB_GETCOMBOBOXINFO, 0, (LPARAM)&info))
- {
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(info.hwndList, WDA_EXCLUDEFROMCAPTURE);
- }
- }
- }
- break;
- }
-
- return result;
-}
-
-LRESULT CALLBACK PhStaticWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- if (WindowMessage == WM_NCCREATE)
- {
- LONG_PTR style = PhGetWindowStyle(WindowHandle);
-
- if ((style & SS_ICON) == SS_ICON)
- {
- PhSetWindowContext(WindowHandle, SCHAR_MAX, (PVOID)TRUE);
- }
- }
-
- if (WindowMessage != WM_KILLFOCUS && !PhGetWindowContext(WindowHandle, SCHAR_MAX))
- return CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
- switch (WindowMessage)
- {
- case WM_NCDESTROY:
- PhRemoveWindowContext(WindowHandle, SCHAR_MAX);
- break;
- case WM_ERASEBKGND:
- return TRUE;
- case WM_KILLFOCUS:
- {
- WCHAR windowClassName[MAX_PATH];
- HWND ParentHandle = GetParent(WindowHandle);
- if (!GetClassName(ParentHandle, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
- if (PhEqualStringZ(windowClassName, L"CHECKLIST_ACLUI", FALSE))
- {
- RECT rectClient;
- GetClientRect(WindowHandle, &rectClient);
- PhInflateRect(&rectClient, 2, 2);
- MapWindowRect(WindowHandle, ParentHandle, &rectClient);
- InvalidateRect(ParentHandle, &rectClient, TRUE); // fix the annoying white border left by the previous active control
- }
- }
- break;
- case WM_PAINT:
- {
- HICON iconHandle;
- PAINTSTRUCT ps;
- RECT clientRect;
- WCHAR windowClassName[MAX_PATH];
-
- if (!GetClassName(GetParent(WindowHandle), windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
- if (PhEqualStringZ(windowClassName, L"CHECKLIST_ACLUI", FALSE))
- {
- if (iconHandle = (HICON)(UINT_PTR)CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, STM_GETICON, 0, 0))
- {
- static PH_INITONCE initOnce = PH_INITONCE_INIT;
- static HFONT hCheckFont = NULL;
-
- HDC hdc = BeginPaint(WindowHandle, &ps);
- GetClientRect(WindowHandle, &clientRect);
-
- HDC bufferDc = CreateCompatibleDC(hdc);
- HBITMAP bufferBitmap = CreateCompatibleBitmap(hdc, clientRect.right, clientRect.bottom);
- HBITMAP oldBufferBitmap = SelectBitmap(bufferDc, bufferBitmap);
-
- enum { nocheck, check, graycheck } checkType = nocheck;
- INT startX = clientRect.left + (clientRect.right - clientRect.bottom) / 2 + 1;
- INT startY = clientRect.top + (clientRect.bottom - clientRect.top) / 2;
-
- DrawIconEx(bufferDc, clientRect.left, clientRect.top, iconHandle, clientRect.right - clientRect.left, clientRect.bottom - clientRect.top,
- 0, NULL, DI_NORMAL);
-
- for (INT x = startX, y = startY; x < clientRect.right; x++)
- {
- COLORREF pixel = GetPixel(bufferDc, x, y);
- if (pixel == RGB(0xB4, 0xB4, 0xB4))
- {
- checkType = graycheck;
- goto draw_acl_check;
- }
- }
- for (INT x = startX, y = startY; x < clientRect.right; x++)
- {
- COLORREF pixel = GetPixel(bufferDc, x, y);
- if (pixel == RGB(0, 0, 0) || pixel == PhThemeWindowTextColor)
- {
- checkType = check;
- goto draw_acl_check;
- }
- }
-
- draw_acl_check:
- if (checkType == check || checkType == graycheck) // right is checked or special permission checked
- {
- if (PhBeginInitOnce(&initOnce)) // cache font
- {
- hCheckFont = CreateFont(
- clientRect.bottom - clientRect.top - 1,
- clientRect.right - clientRect.left - 3,
- 0, 0,
- FW_BOLD, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
- CLIP_DEFAULT_PRECIS, CLEARTYPE_QUALITY,
- VARIABLE_PITCH, L"Segoe UI");
- PhEndInitOnce(&initOnce);
- }
-
- SetBkMode(hdc, TRANSPARENT);
- SetTextColor(hdc, checkType == check ? PhThemeWindowTextColor : RGB(0xB4, 0xB4, 0xB4));
- SelectFont(hdc, hCheckFont);
- //HFONT hFontOriginal = SelectFont(hdc, hCheckFont);
- FillRect(hdc, &clientRect, PhThemeWindowBackgroundBrush);
- DrawText(hdc, L"✓", 1, &clientRect, DT_CENTER | DT_VCENTER);
- //SelectFont(hdc, hFontOriginal);
- }
-
- SelectBitmap(bufferDc, oldBufferBitmap);
- DeleteBitmap(bufferBitmap);
- DeleteDC(bufferDc);
- EndPaint(WindowHandle, &ps);
- return 0;
- }
- }
- //else if (iconHandle = (HICON)(UINT_PTR)CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, STM_GETICON, 0, 0)) // Static_GetIcon(WindowHandle, 0)
- //{
- // PAINTSTRUCT ps;
- // if (PhGetWindowContext(GetParent(WindowHandle), LONG_MAX) &&
- // BeginPaint(WindowHandle, &ps))
- // {
- // // Fix artefacts when window moving back from off-screen (Dart Vanya)
- // hdc = GetDC(WindowHandle);
- // GetClientRect(WindowHandle, &clientRect);
-
- // FillRect(hdc, &clientRect, PhThemeWindowBackgroundBrush);
-
- // DrawIconEx(
- // hdc,
- // clientRect.left,
- // clientRect.top,
- // iconHandle,
- // clientRect.right - clientRect.left,
- // clientRect.bottom - clientRect.top,
- // 0,
- // NULL,
- // DI_NORMAL
- // );
-
- // ReleaseDC(WindowHandle, hdc);
- // EndPaint(WindowHandle, &ps);
- // }
- //}
- }
- }
-
- return CallWindowProc(PhDefaultStaticWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-}
-
-typedef struct _PHP_THEME_WINDOW_STATUSBAR_CONTEXT
-{
- struct
- {
- BOOLEAN Flags;
- union
- {
- BOOLEAN NonMouseActive : 1;
- BOOLEAN MouseActive : 1;
- BOOLEAN HotTrack : 1;
- BOOLEAN Hot : 1;
- BOOLEAN Spare : 4;
- };
- };
-
- HTHEME ThemeHandle;
- POINT CursorPos;
-
- HDC BufferedDc;
- HBITMAP BufferedOldBitmap;
- HBITMAP BufferedBitmap;
- RECT BufferedContextRect;
-} PHP_THEME_WINDOW_STATUSBAR_CONTEXT, *PPHP_THEME_WINDOW_STATUSBAR_CONTEXT;
-
-VOID ThemeWindowStatusBarCreateBufferedContext(
- _In_ PPHP_THEME_WINDOW_STATUSBAR_CONTEXT Context,
- _In_ HDC Hdc,
- _In_ RECT BufferRect
- )
-{
- Context->BufferedDc = CreateCompatibleDC(Hdc);
-
- if (!Context->BufferedDc)
- return;
-
- Context->BufferedContextRect = BufferRect;
- Context->BufferedBitmap = CreateCompatibleBitmap(
- Hdc,
- Context->BufferedContextRect.right,
- Context->BufferedContextRect.bottom
- );
-
- Context->BufferedOldBitmap = SelectBitmap(Context->BufferedDc, Context->BufferedBitmap);
-}
-
-VOID ThemeWindowStatusBarDestroyBufferedContext(
- _In_ PPHP_THEME_WINDOW_STATUSBAR_CONTEXT Context
- )
-{
- if (Context->BufferedDc && Context->BufferedOldBitmap)
- {
- SelectBitmap(Context->BufferedDc, Context->BufferedOldBitmap);
- }
-
- if (Context->BufferedBitmap)
- {
- DeleteBitmap(Context->BufferedBitmap);
- Context->BufferedBitmap = NULL;
- }
-
- if (Context->BufferedDc)
- {
- DeleteDC(Context->BufferedDc);
- Context->BufferedDc = NULL;
- }
-}
-
-LONG ThemeWindowStatusBarUpdateRectToIndex(
- _In_ HWND WindowHandle,
- _In_ WNDPROC WindowProcedure,
- _In_ PRECT UpdateRect,
- _In_ LONG Count
- )
-{
- for (LONG i = 0; i < Count; i++)
- {
- RECT blockRect = { 0 };
-
- if (!CallWindowProc(WindowProcedure, WindowHandle, SB_GETRECT, (WPARAM)i, (WPARAM)&blockRect))
- continue;
-
- if (
- UpdateRect->bottom == blockRect.bottom &&
- //UpdateRect->left == blockRect.left &&
- UpdateRect->right == blockRect.right
- //UpdateRect->top == blockRect.top
- )
- {
- return i;
- }
- }
-
- return INT_ERROR;
-}
-
-VOID ThemeWindowStatusBarDrawPart(
- _In_ PPHP_THEME_WINDOW_STATUSBAR_CONTEXT Context,
- _In_ HWND WindowHandle,
- _In_ HDC bufferDc,
- _In_ PRECT clientRect,
- _In_ LONG Index
- )
-{
- RECT blockRect = { 0 };
- WCHAR text[0x80] = { 0 };
-
- if (!CallWindowProc(PhDefaultStatusbarWindowProcedure, WindowHandle, SB_GETRECT, (WPARAM)Index, (WPARAM)&blockRect))
- return;
- if (!RectVisible(bufferDc, &blockRect))
- return;
- if (CallWindowProc(PhDefaultStatusbarWindowProcedure, WindowHandle, SB_GETTEXTLENGTH, (WPARAM)Index, 0) >= RTL_NUMBER_OF(text))
- return;
- if (!CallWindowProc(PhDefaultStatusbarWindowProcedure, WindowHandle, SB_GETTEXT, (WPARAM)Index, (LPARAM)text))
- return;
-
- if (PhPtInRect(&blockRect, Context->CursorPos))
- {
- SetTextColor(bufferDc, PhThemeWindowTextColor);
- SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor);
- blockRect.left -= 3, blockRect.top -= 1;
- FillRect(bufferDc, &blockRect, PhGetStockBrush(DC_BRUSH));
- blockRect.left += 3, blockRect.top += 1;
- }
- else
- {
- RECT separator;
- SetTextColor(bufferDc, PhThemeWindowTextColor);
- FillRect(bufferDc, &blockRect, PhThemeWindowBackgroundBrush);
-
- separator = blockRect;
- separator.left = separator.right - 1;
- PhInflateRect(&separator, 0, -1);
- SetDCBrushColor(bufferDc, PhThemeWindowHighlightColor);
- FillRect(bufferDc, &separator, PhGetStockBrush(DC_BRUSH));
- }
-
- blockRect.left += 2, blockRect.bottom -= 1;
- DrawText(
- bufferDc,
- text,
- (UINT)PhCountStringZ(text),
- &blockRect,
- DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_HIDEPREFIX
- );
- blockRect.left -= 2, blockRect.bottom += 1;
-}
-
-VOID ThemeWindowRenderStatusBar(
- _In_ PPHP_THEME_WINDOW_STATUSBAR_CONTEXT Context,
- _In_ HWND WindowHandle,
- _In_ HDC bufferDc,
- _In_ PRECT clientRect
- )
-{
- SetBkMode(bufferDc, TRANSPARENT);
- SelectFont(bufferDc, GetWindowFont(WindowHandle));
-
- FillRect(bufferDc, clientRect, PhThemeWindowBackgroundBrush);
-
- LONG blockCount = (LONG)CallWindowProc(
- PhDefaultStatusbarWindowProcedure,
- WindowHandle,
- SB_GETPARTS,
- 0, 0
- );
-
- //INT index = ThemeWindowStatusBarUpdateRectToIndex( // used with BeginBufferedPaint (dmex)
- // WindowHandle,
- // WindowProcedure,
- // clientRect,
- // blockCount
- // );
- //
- //if (index == UINT_MAX)
- {
- RECT sizeGripRect;
- LONG dpi;
-
- dpi = PhGetWindowDpi(WindowHandle);
- sizeGripRect.left = clientRect->right - PhGetSystemMetrics(SM_CXHSCROLL, dpi);
- sizeGripRect.top = clientRect->bottom - PhGetSystemMetrics(SM_CYVSCROLL, dpi);
- sizeGripRect.right = clientRect->right;
- sizeGripRect.bottom = clientRect->bottom;
-
- if (Context->ThemeHandle)
- {
- //if (IsThemeBackgroundPartiallyTransparent(Context->ThemeHandle, SP_GRIPPER, 0))
- // DrawThemeParentBackground(WindowHandle, bufferDc, NULL);
-
- PhDrawThemeBackground(Context->ThemeHandle, bufferDc, SP_GRIPPER, 0, &sizeGripRect, &sizeGripRect);
- }
- else
- {
- DrawFrameControl(bufferDc, &sizeGripRect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
- }
-
- // Top statusbar border will be drawn by bottom tabcontrol border
-
- for (LONG i = 0; i < blockCount; i++)
- {
- ThemeWindowStatusBarDrawPart(Context, WindowHandle, bufferDc, clientRect, i);
- }
- }
- //else
- //{
- // ThemeWindowStatusBarDrawPart(Context, WindowHandle, bufferDc, clientRect, WindowProcedure, index);
- //}
-}
-
-LRESULT CALLBACK PhStatusBarWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- PPHP_THEME_WINDOW_STATUSBAR_CONTEXT context = NULL;
-
- if (WindowMessage == WM_NCCREATE)
- {
- context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_STATUSBAR_CONTEXT));
- context->ThemeHandle = PhOpenThemeData(WindowHandle, VSCLASS_STATUS, PhGetWindowDpi(WindowHandle));
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
- PhSetWindowContext(WindowHandle, LONG_MAX, context);
- }
- else
- {
- context = PhGetWindowContext(WindowHandle, LONG_MAX);
- }
-
- if (context)
- {
- switch (WindowMessage)
- {
- case WM_NCDESTROY:
- {
- PhRemoveWindowContext(WindowHandle, LONG_MAX);
-
- ThemeWindowStatusBarDestroyBufferedContext(context);
-
- if (context->ThemeHandle)
- {
- PhCloseThemeData(context->ThemeHandle);
- }
-
- PhFree(context);
- }
- break;
- case WM_THEMECHANGED:
- {
- if (context->ThemeHandle)
- {
- PhCloseThemeData(context->ThemeHandle);
- context->ThemeHandle = NULL;
- }
-
- context->ThemeHandle = PhOpenThemeData(WindowHandle, VSCLASS_STATUS, PhGetWindowDpi(WindowHandle));
- }
- break;
- case WM_ERASEBKGND:
- return TRUE;
- case WM_MOUSEMOVE:
- {
- if (!context->MouseActive)
- {
- TRACKMOUSEEVENT trackEvent =
- {
- sizeof(TRACKMOUSEEVENT),
- TME_LEAVE,
- WindowHandle,
- 0
- };
-
- TrackMouseEvent(&trackEvent);
- context->MouseActive = TRUE;
- }
-
- context->CursorPos.x = GET_X_LPARAM(lParam);
- context->CursorPos.y = GET_Y_LPARAM(lParam);
-
- InvalidateRect(WindowHandle, NULL, FALSE);
- }
- break;
- case WM_MOUSELEAVE:
- {
- context->MouseActive = FALSE;
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
-
- InvalidateRect(WindowHandle, NULL, FALSE);
- }
- break;
- case WM_PAINT:
- {
- //PAINTSTRUCT ps;
- //HDC BufferedHDC;
- //HPAINTBUFFER BufferedPaint;
- //
- //if (!BeginPaint(WindowHandle, &ps))
- // break;
- //
- //if (BufferedPaint = BeginBufferedPaint(ps.hdc, &ps.rcPaint, BPBF_COMPATIBLEBITMAP, NULL, &BufferedHDC))
- //{
- // ThemeWindowRenderStatusBar(context, WindowHandle, BufferedHDC, &ps.rcPaint, oldWndProc);
- // EndBufferedPaint(BufferedPaint, TRUE);
- //}
- //else
- {
- RECT clientRect;
- RECT bufferRect;
- HDC hdc;
-
- GetClientRect(WindowHandle, &clientRect);
- bufferRect.left = 0;
- bufferRect.top = 0;
- bufferRect.right = clientRect.right - clientRect.left;
- bufferRect.bottom = clientRect.bottom - clientRect.top;
-
- hdc = GetDC(WindowHandle);
-
- if (context->BufferedDc && (
- context->BufferedContextRect.right < bufferRect.right ||
- context->BufferedContextRect.bottom < bufferRect.bottom))
- {
- ThemeWindowStatusBarDestroyBufferedContext(context);
- }
-
- if (!context->BufferedDc)
- {
- ThemeWindowStatusBarCreateBufferedContext(context, hdc, bufferRect);
- }
-
- if (context->BufferedDc)
- {
- ThemeWindowRenderStatusBar(
- context,
- WindowHandle,
- context->BufferedDc,
- &clientRect
- );
-
- BitBlt(hdc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom, context->BufferedDc, 0, 0, SRCCOPY);
- }
-
- ReleaseDC(WindowHandle, hdc);
- }
-
- //EndPaint(WindowHandle, &ps);
- }
- goto DefaultWndProc;
- }
- }
-
- return CallWindowProc(PhDefaultStatusbarWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
-DefaultWndProc:
- return DefWindowProc(WindowHandle, WindowMessage, wParam, lParam);
-}
-
-LRESULT CALLBACK PhEditWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- switch (WindowMessage)
- {
- case WM_NCPAINT:
- {
- HDC hdc;
- ULONG flags;
- RECT windowRect;
- HRGN updateRegion;
-
- // The searchbox control does its own theme drawing.
- if (PhGetWindowContext(WindowHandle, SHRT_MAX))
- break;
-
- updateRegion = (HRGN)wParam;
-
- if (updateRegion == HRGN_FULL)
- updateRegion = NULL;
-
- flags = DCX_WINDOW | DCX_LOCKWINDOWUPDATE | DCX_USESTYLE;
-
- if (updateRegion)
- flags |= DCX_INTERSECTRGN | DCX_NODELETERGN;
-
- if (hdc = GetDCEx(WindowHandle, updateRegion, flags))
- {
- GetWindowRect(WindowHandle, &windowRect);
- PhOffsetRect(&windowRect, -windowRect.left, -windowRect.top);
-
- if (GetFocus() == WindowHandle)
- {
- // A little bit nicer and contrast color (Dart Vanya)
- SetDCBrushColor(hdc, PhMakeColorBrighter(GetSysColor(COLOR_HOTLIGHT), 85)); // PhThemeWindowHighlightColor
- FrameRect(hdc, &windowRect, PhGetStockBrush(DC_BRUSH));
- }
- else
- {
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FrameRect(hdc, &windowRect, PhGetStockBrush(DC_BRUSH));
- }
-
- ReleaseDC(WindowHandle, hdc);
- return 0;
- }
- }
- break;
- }
-
- return CallWindowProc(PhDefaultEditWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-}
-
-typedef struct _PHP_THEME_WINDOW_HEADER_CONTEXT
-{
- HTHEME ThemeHandle;
- BOOLEAN MouseActive;
- POINT CursorPos;
-} PHP_THEME_WINDOW_HEADER_CONTEXT, *PPHP_THEME_WINDOW_HEADER_CONTEXT;
-
-VOID ThemeWindowRenderHeaderControl(
- _In_ PPHP_THEME_WINDOW_HEADER_CONTEXT Context,
- _In_ HWND WindowHandle,
- _In_ HDC bufferDc,
- _In_ PRECT clientRect
- )
-{
- SetBkMode(bufferDc, TRANSPARENT);
- SelectFont(bufferDc, GetWindowFont(WindowHandle));
-
- FillRect(bufferDc, clientRect, PhThemeWindowBackgroundBrush);
-
- //INT headerItemCount = Header_GetItemCount(WindowHandle);
- INT headerItemCount = (INT)CallWindowProc(
- PhDefaultHeaderWindowProcedure,
- WindowHandle,
- HDM_GETITEMCOUNT,
- 0, 0
- );
-
- for (INT i = 0; i < headerItemCount; i++)
- {
- RECT headerRect = { 0 };
-
- //Header_GetItemRect(WindowHandle, i, &headerRect);
- if (!(BOOL)CallWindowProc(
- PhDefaultHeaderWindowProcedure,
- WindowHandle,
- HDM_GETITEMRECT,
- (WPARAM)i,
- (LPARAM)&headerRect
- ))
- {
- continue;
- }
-
- if (PhPtInRect(&headerRect, Context->CursorPos))
- {
- SetTextColor(bufferDc, PhThemeWindowTextColor);
- SetDCBrushColor(bufferDc, PhThemeWindowBackground2Color); // PhThemeWindowHighlightColor);
- FillRect(bufferDc, &headerRect, PhGetStockBrush(DC_BRUSH));
- //FrameRect(bufferDc, &headerRect, GetSysColorBrush(COLOR_HIGHLIGHT));
- }
- else
- {
- SetTextColor(bufferDc, PhThemeWindowTextColor);
- FillRect(bufferDc, &headerRect, PhThemeWindowBackgroundBrush);
-
- //FrameRect(hdc, &headerRect, GetSysColorBrush(COLOR_HIGHLIGHT));
- //SetDCPenColor(hdc, RGB(0, 255, 0));
- //SetDCBrushColor(hdc, RGB(0, 255, 0));
- //DrawEdge(hdc, &headerRect, BDR_RAISEDOUTER | BF_FLAT, BF_RIGHT);
-
- //RECT frameRect;
- //frameRect.bottom = headerRect.bottom - 2;
- //frameRect.left = headerRect.right - 1;
- //frameRect.right = headerRect.right;
- //frameRect.top = headerRect.top;
- //SetDCBrushColor(hdc, RGB(68, 68, 68)); // RGB(0x77, 0x77, 0x77));
- //FrameRect(hdc, &headerRect, PhGetStockBrush(DC_BRUSH));
-
- //PatBlt(DrawInfo->hDC, DrawInfo->rcItem.right - 1, DrawInfo->rcItem.top, 1, DrawInfo->rcItem.bottom - DrawInfo->rcItem.top, PATCOPY);
- //PatBlt(DrawInfo->hDC, DrawInfo->rcItem.left, DrawInfo->rcItem.bottom - 1, DrawInfo->rcItem.right - DrawInfo->rcItem.left, 1, PATCOPY);
- DrawEdge(bufferDc, &headerRect, BDR_RAISEDOUTER, BF_RIGHT);
- }
-
- INT drawTextFlags = DT_SINGLELINE | DT_HIDEPREFIX | DT_WORD_ELLIPSIS;
- WCHAR headerText[0x80] = { 0 };
- HDITEM headerItem;
-
- ZeroMemory(&headerItem, sizeof(HDITEM));
- headerItem.mask = HDI_TEXT | HDI_FORMAT;
- headerItem.cchTextMax = MAX_PATH;
- headerItem.pszText = headerText;
-
- //Header_GetItem(WindowHandle, i, &headerItem);
- if (!(BOOL)CallWindowProc(
- PhDefaultHeaderWindowProcedure,
- WindowHandle,
- HDM_GETITEM,
- (WPARAM)i,
- (LPARAM)&headerItem
- ))
- {
- break;
- }
-
- if (headerItem.fmt & HDF_SORTUP)
- {
- if (Context->ThemeHandle)
- {
- RECT sortArrowRect = headerRect;
- SIZE sortArrowSize;
-
- if (PhGetThemePartSize(
- Context->ThemeHandle,
- bufferDc,
- HP_HEADERSORTARROW,
- HSAS_SORTEDUP,
- NULL,
- TS_TRUE,
- &sortArrowSize
- ))
- {
- sortArrowRect.bottom = sortArrowSize.cy;
- }
-
- PhDrawThemeBackground(
- Context->ThemeHandle,
- bufferDc,
- HP_HEADERSORTARROW,
- HSAS_SORTEDUP,
- &sortArrowRect,
- NULL
- );
- }
- }
- else if (headerItem.fmt & HDF_SORTDOWN)
- {
- if (Context->ThemeHandle)
- {
- RECT sortArrowRect = headerRect;
- SIZE sortArrowSize;
-
- if (PhGetThemePartSize(
- Context->ThemeHandle,
- bufferDc,
- HP_HEADERSORTARROW,
- HSAS_SORTEDDOWN,
- NULL,
- TS_TRUE,
- &sortArrowSize
- ))
- {
- sortArrowRect.bottom = sortArrowSize.cy;
- }
-
- PhDrawThemeBackground(
- Context->ThemeHandle,
- bufferDc,
- HP_HEADERSORTARROW,
- HSAS_SORTEDDOWN,
- &sortArrowRect,
- NULL
- );
- }
- }
-
- if (headerItem.fmt & HDF_RIGHT)
- drawTextFlags |= DT_VCENTER | DT_RIGHT;
- else
- drawTextFlags |= DT_VCENTER | DT_LEFT;
-
- headerRect.left += 4;
- headerRect.right -= 8;
- DrawText(
- bufferDc,
- headerText,
- (UINT)PhCountStringZ(headerText),
- &headerRect,
- drawTextFlags
- );
- }
-}
-
-LRESULT CALLBACK PhHeaderWindowHookProcedure(
- _In_ HWND WindowHandle,
- _In_ UINT WindowMessage,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- PPHP_THEME_WINDOW_HEADER_CONTEXT context = NULL;
-
- if (WindowMessage == WM_NCCREATE)
- {
- CREATESTRUCT* createStruct = (CREATESTRUCT*)lParam;
-
- if (createStruct->hwndParent)
- {
- WCHAR windowClassName[MAX_PATH];
-
- if (!GetClassName(createStruct->hwndParent, windowClassName, RTL_NUMBER_OF(windowClassName)))
- windowClassName[0] = UNICODE_NULL;
-
- if (PhEqualStringZ(windowClassName, L"PhTreeNew", FALSE))
- {
- LONG_PTR windowStyle = PhGetWindowStyle(createStruct->hwndParent);
-
- if (BooleanFlagOn(windowStyle, TN_STYLE_CUSTOM_HEADERDRAW))
- {
- PhSetControlTheme(WindowHandle, L"DarkMode_ItemsView");
-
- return CallWindowProc(PhDefaultHeaderWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
- }
- }
- }
-
- context = PhAllocateZero(sizeof(PHP_THEME_WINDOW_HEADER_CONTEXT));
- context->ThemeHandle = PhOpenThemeData(WindowHandle, VSCLASS_HEADER, PhGetWindowDpi(WindowHandle));
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
- PhSetWindowContext(WindowHandle, LONG_MAX, context);
-
- PhSetControlTheme(WindowHandle, L"DarkMode_ItemsView");
-
- InvalidateRect(WindowHandle, NULL, FALSE);
- }
- else
- {
- context = PhGetWindowContext(WindowHandle, LONG_MAX);
- }
-
- if (context)
- {
- switch (WindowMessage)
- {
- case WM_NCDESTROY:
- {
- PhRemoveWindowContext(WindowHandle, LONG_MAX);
-
- if (context->ThemeHandle)
- {
- PhCloseThemeData(context->ThemeHandle);
- }
-
- PhFree(context);
- }
- break;
- case WM_THEMECHANGED:
- {
- if (context->ThemeHandle)
- {
- PhCloseThemeData(context->ThemeHandle);
- context->ThemeHandle = NULL;
- }
-
- context->ThemeHandle = PhOpenThemeData(WindowHandle, VSCLASS_HEADER, PhGetWindowDpi(WindowHandle));
- }
- break;
- case WM_ERASEBKGND:
- return TRUE;
- case WM_MOUSEMOVE:
- {
- if (GetCapture() == WindowHandle)
- break;
-
- if (!context->MouseActive)
- {
- TRACKMOUSEEVENT trackEvent =
- {
- sizeof(TRACKMOUSEEVENT),
- TME_LEAVE,
- WindowHandle,
- 0
- };
-
- TrackMouseEvent(&trackEvent);
- context->MouseActive = TRUE;
- }
-
- context->CursorPos.x = GET_X_LPARAM(lParam);
- context->CursorPos.y = GET_Y_LPARAM(lParam);
-
- InvalidateRect(WindowHandle, NULL, FALSE);
- }
- break;
- case WM_CONTEXTMENU:
- {
- LRESULT result = CallWindowProc(PhDefaultHeaderWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
- InvalidateRect(WindowHandle, NULL, TRUE);
-
- return result;
- }
- break;
- case WM_MOUSELEAVE:
- {
- LRESULT result = CallWindowProc(PhDefaultHeaderWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
- context->MouseActive = FALSE;
- context->CursorPos.x = LONG_MIN;
- context->CursorPos.y = LONG_MIN;
-
- InvalidateRect(WindowHandle, NULL, TRUE);
-
- return result;
- }
- break;
- case WM_PAINT:
- {
- // Don't apply header theme for unsupported dialogs: Advanced Security, Digital Signature Details, etc. (Dart Vanya)
- if (!PhIsDarkModeAllowedForWindow(GetParent(WindowHandle)))
- {
- PhRemoveWindowContext(WindowHandle, LONG_MAX);
- if (context->ThemeHandle)
- PhCloseThemeData(context->ThemeHandle);
- PhFree(context);
- PhSetControlTheme(WindowHandle, L"Explorer");
- break;
- }
-
- //PAINTSTRUCT ps;
- //HDC BufferedHDC;
- //HPAINTBUFFER BufferedPaint;
- //
- //if (!BeginPaint(WindowHandle, &ps))
- // break;
- //
- //DEBUG_BEGINPAINT_RECT(WindowHandle, ps.rcPaint);
- //
- //if (BufferedPaint = BeginBufferedPaint(ps.hdc, &ps.rcPaint, BPBF_COMPATIBLEBITMAP, NULL, &BufferedHDC))
- //{
- // ThemeWindowRenderHeaderControl(context, WindowHandle, BufferedHDC, &ps.rcPaint, oldWndProc);
- // EndBufferedPaint(BufferedPaint, TRUE);
- //}
- //else
- {
- RECT clientRect;
- HDC hdc;
- HDC bufferDc;
- HBITMAP bufferBitmap;
- HBITMAP oldBufferBitmap;
-
- GetClientRect(WindowHandle, &clientRect);
-
- hdc = GetDC(WindowHandle);
- bufferDc = CreateCompatibleDC(hdc);
- bufferBitmap = CreateCompatibleBitmap(hdc, clientRect.right, clientRect.bottom);
- oldBufferBitmap = SelectBitmap(bufferDc, bufferBitmap);
-
- ThemeWindowRenderHeaderControl(context, WindowHandle, bufferDc, &clientRect);
-
- BitBlt(hdc, clientRect.left, clientRect.top, clientRect.right, clientRect.bottom, bufferDc, 0, 0, SRCCOPY);
- SelectBitmap(bufferDc, oldBufferBitmap);
- DeleteBitmap(bufferBitmap);
- DeleteDC(bufferDc);
- ReleaseDC(WindowHandle, hdc);
- }
-
- //EndPaint(WindowHandle, &ps);
- }
- goto DefaultWndProc;
- }
- }
-
- return CallWindowProc(PhDefaultHeaderWindowProcedure, WindowHandle, WindowMessage, wParam, lParam);
-
-DefaultWndProc:
- return DefWindowProc(WindowHandle, WindowMessage, wParam, lParam);
-}
-
-VOID PhRegisterDialogSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, L"#32770", &wcex))
- return;
-
- PhDefaultDialogWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhDialogWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(L"#32770", NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterMenuSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, L"#32768", &wcex))
- return;
-
- PhDefaultMenuWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhMenuWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(L"#32768", NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterRebarSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, REBARCLASSNAME, &wcex))
- return;
-
- PhDefaultRebarWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhRebarWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(REBARCLASSNAME, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterComboBoxSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_COMBOBOX, &wcex))
- return;
-
- PhDefaultComboBoxWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhComboBoxWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_COMBOBOX, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterStaticSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_STATIC, &wcex))
- return;
-
- PhDefaultStaticWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhStaticWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_STATIC, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterStatusBarSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, STATUSCLASSNAME, &wcex))
- return;
-
- PhDefaultStatusbarWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhStatusBarWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(STATUSCLASSNAME, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterEditSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_EDIT, &wcex))
- return;
-
- PhDefaultEditWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhEditWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_EDIT, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-VOID PhRegisterHeaderSuperClass(
- VOID
- )
-{
- WNDCLASSEX wcex = { sizeof(WNDCLASSEX) };
-
- if (!GetClassInfoEx(NULL, WC_HEADER, &wcex))
- return;
-
- PhDefaultHeaderWindowProcedure = wcex.lpfnWndProc;
- wcex.lpfnWndProc = PhHeaderWindowHookProcedure;
- wcex.style = wcex.style | CS_PARENTDC | CS_GLOBALCLASS;
-
- UnregisterClass(WC_HEADER, NULL);
- if (RegisterClassEx(&wcex) == INVALID_ATOM)
- {
- PhShowStatus(NULL, L"Unable to register window class.", 0, GetLastError());
- }
-}
-
-// Detours export procedure hooks
-
-static HRESULT (WINAPI* DefaultDrawThemeBackground)(
- _In_ HTHEME Theme,
- _In_ HDC Hdc,
- _In_ INT PartId,
- _In_ INT StateId,
- _In_ LPCRECT Rect,
- _In_ LPCRECT ClipRect
- ) = NULL;
-
-static HRESULT (WINAPI* DefaultDrawThemeBackgroundEx)(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCRECT pRect,
- _In_ const DTBGOPTS* pOptions
- ) = NULL;
-
-static HRESULT(WINAPI* DefaultDrawThemeText)(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCWSTR pszText,
- _In_ int cchText,
- _In_ DWORD dwTextFlags,
- _In_ DWORD dwTextFlags2,
- _In_ LPCRECT pRect
- ) = NULL;
-
-static HRESULT(WINAPI* DefaultDrawThemeTextEx)(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCWSTR pszText,
- _In_ int cchText,
- _In_ DWORD dwTextFlags,
- _Inout_ LPRECT pRect,
- _In_ const DTTOPTS* pOptions
- ) = NULL;
-
-int (WINAPI* DefaultComCtl32DrawTextW)(
- _In_ HDC hdc,
- _Inout_ LPCWSTR lpchText,
- _In_ int cchText,
- _Inout_ LPRECT lprc,
- _In_ UINT format
- ) = NULL;
-
-static HRESULT(WINAPI* DefaultTaskDialogIndirect)(
- _In_ const TASKDIALOGCONFIG* pTaskConfig,
- _Out_opt_ int* pnButton,
- _Out_opt_ int* pnRadioButton,
- _Out_opt_ BOOL* pfVerificationFlagChecked
- ) = NULL;
-
-static HRESULT(WINAPI* DefaultGetThemeColor)(
- _In_ HTHEME hTheme,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ int iPropId,
- _Out_ COLORREF* pColor
- ) = NULL;
-
-// uxtheme.dll ordinal 49
-static HTHEME(WINAPI* DefaultOpenNcThemeData)(
- _In_ HWND hwnd,
- _In_ LPCWSTR pszClassList
- ) = NULL;
-
-static BOOL (WINAPI* DefaultSystemParametersInfo)(
- _In_ UINT uiAction,
- _In_ UINT uiParam,
- _Pre_maybenull_ _Post_valid_ PVOID pvParam,
- _In_ UINT fWinIni
- ) = NULL;
-
-static HWND (WINAPI* DefaultCreateWindowEx)(
- _In_ ULONG ExStyle,
- _In_opt_ PCWSTR ClassName,
- _In_opt_ PCWSTR WindowName,
- _In_ ULONG Style,
- _In_ INT X,
- _In_ INT Y,
- _In_ INT Width,
- _In_ INT Height,
- _In_opt_ HWND Parent,
- _In_opt_ HMENU Menu,
- _In_opt_ PVOID Instance,
- _In_opt_ PVOID Param
- ) = NULL;
-
-typedef struct _TASKDIALOG_CALLBACK_WRAP
-{
- PFTASKDIALOGCALLBACK pfCallback;
- LONG_PTR lpCallbackData;
-} TASKDIALOG_CALLBACK_WRAP, *PTASKDIALOG_CALLBACK_WRAP;
-
-typedef struct _TASKDIALOG_COMMON_CONTEXT
-{
- WNDPROC DefaultWindowProc;
- ULONG Painting;
-} TASKDIALOG_COMMON_CONTEXT, *PTASKDIALOG_COMMON_CONTEXT;
-
-typedef struct _TASKDIALOG_WINDOW_CONTEXT
-{
- WNDPROC DefaultWindowProc;
- ULONG Painting;
- PTASKDIALOG_CALLBACK_WRAP CallbackData;
-} TASKDIALOG_WINDOW_CONTEXT, *PTASKDIALOG_WINDOW_CONTEXT;
-
-#define TASKDIALOG_CONTEXT_TAG (ULONG)'TDLG'
-
-#define GETCLASSNAME_OR_NULL(WindowHandle, ClassName) if (!GetClassName(WindowHandle, ClassName, RTL_NUMBER_OF(ClassName))) ClassName[0] = UNICODE_NULL
-
-HRESULT CALLBACK ThemeTaskDialogCallbackHook(
- _In_ HWND hwndDlg,
- _In_ UINT uMsg,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam,
- _In_ LONG_PTR dwRefData
- );
-
-LRESULT CALLBACK ThemeTaskDialogMasterSubclass(
- _In_ HWND hwnd,
- _In_ UINT uMsg,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- );
-
-BOOLEAN CALLBACK PhInitializeTaskDialogTheme(
- _In_ HWND hwndDlg,
- _In_opt_ PVOID Context
- );
-
-HRESULT PhDrawThemeBackgroundHook(
- _In_ HTHEME Theme,
- _In_ HDC Hdc,
- _In_ LONG PartId,
- _In_ LONG StateId,
- _In_ LPCRECT Rect,
- _In_ LPCRECT ClipRect
- )
-{
- WCHAR className[MAX_PATH];
- BOOLEAN hasThemeClass = PhGetThemeClass(Theme, className, RTL_NUMBER_OF(className));
-
- if (WindowsVersion >= WINDOWS_11 && hasThemeClass)
- {
- if (PhEqualStringZ(className, VSCLASS_MENU, TRUE))
- {
- if (PartId == MENU_POPUPGUTTER || PartId == MENU_POPUPBORDERS)
- {
- FillRect(Hdc, Rect, PhThemeWindowBackgroundBrush);
- return S_OK;
- }
- }
- }
-
- if (hasThemeClass && PhEqualStringZ(className, VSCLASS_PROGRESS, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(Hdc) == NULL*/)
- {
- if (PartId == PP_TRANSPARENTBAR || PartId == PP_TRANSPARENTBARVERT) // Progress bar background
- {
- FillRect(Hdc, Rect, PhThemeWindowBackgroundBrush);
- SetDCBrushColor(Hdc, RGB(0x60, 0x60, 0x60));
- FrameRect(Hdc, Rect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- }
- }
-
- return DefaultDrawThemeBackground(Theme, Hdc, PartId, StateId, Rect, ClipRect);
-}
-
-HRESULT WINAPI PhDrawThemeBackgroundExHook(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCRECT pRect,
- _In_ const DTBGOPTS* pOptions
- )
-{
- WCHAR className[MAX_PATH];
-
- // Apply theme to ListView checkboxes
- if (iPartId == BP_CHECKBOX /*|| iPartId == BP_RADIOBUTTON*/)
- {
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) &&
- PhEqualStringZ(className, VSCLASS_BUTTON, TRUE))
- {
- HTHEME darkButtonTheme = PhOpenThemeData(NULL, L"DarkMode_Explorer::Button", 0);
- HRESULT retVal = DefaultDrawThemeBackgroundEx(darkButtonTheme ? darkButtonTheme : hTheme, hdc, iPartId, iStateId, pRect, pOptions);
- if (darkButtonTheme)
- PhCloseThemeData(darkButtonTheme);
- return retVal;
- }
- }
-
- // Micro optimization
- if ((iPartId == TDLG_PRIMARYPANEL || iPartId == TDLG_FOOTNOTEPANE || iPartId == TDLG_SECONDARYPANEL || iPartId == TDLG_FOOTNOTESEPARATOR || iPartId == TDLG_EXPANDOBUTTON) &&
- PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOG, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
- {
- switch (iPartId)
- {
- case TDLG_PRIMARYPANEL:
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- case TDLG_FOOTNOTEPANE:
- FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
- return S_OK;
- case TDLG_SECONDARYPANEL:
- {
- FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
- RECT rect = *pRect;
- rect.bottom = rect.top + 1;
- SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- PhOffsetRect(&rect, 0, 1);
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- }
- case TDLG_FOOTNOTESEPARATOR:
- {
- SetDCBrushColor(hdc, PhThemeWindowForegroundColor);
- FillRect(hdc, pRect, PhGetStockBrush(DC_BRUSH));
- RECT rect = *pRect;
- rect.top += 1;
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- return S_OK;
- }
- case TDLG_EXPANDOBUTTON:
- {
- // In Windows 11, buttons lack background, making them indistinguishable on dark backgrounds.
- // To address this, we invert the button. This technique isn't applicable to Windows 10 as it causes the button's border to appear chipped.
- static enum { yes, no, unknown } mustInvertButton = unknown;
- if (mustInvertButton == unknown)
- {
- DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
- int buttonCenterX = pOptions->rcClip.left + (pOptions->rcClip.right - pOptions->rcClip.left) / 2;
- int buttonCenterY = pOptions->rcClip.top + (pOptions->rcClip.bottom - pOptions->rcClip.top) / 2;
- COLORREF centerPixel = GetPixel(hdc, buttonCenterX, buttonCenterY);
- mustInvertButton = centerPixel == PhThemeWindowTextColor ? no : yes;
- }
- FillRect(hdc, pRect, PhThemeWindowBackgroundBrush);
- if (mustInvertButton == yes) InvertRect(hdc, pRect);
- HRESULT retVal = DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
- if (mustInvertButton == yes) InvertRect(hdc, pRect);
- return retVal;
- }
- }
- }
-
- return DefaultDrawThemeBackgroundEx(hTheme, hdc, iPartId, iStateId, pRect, pOptions);
-}
-
-HWND PhCreateWindowExHook(
- _In_ ULONG ExStyle,
- _In_opt_ PCWSTR ClassName,
- _In_opt_ PCWSTR WindowName,
- _In_ ULONG Style,
- _In_ LONG X,
- _In_ LONG Y,
- _In_ LONG Width,
- _In_ LONG Height,
- _In_opt_ HWND Parent,
- _In_opt_ HMENU Menu,
- _In_opt_ PVOID Instance,
- _In_opt_ PVOID Param
- )
-{
- HWND windowHandle = DefaultCreateWindowEx(
- ExStyle,
- ClassName,
- WindowName,
- Style,
- X,
- Y,
- Width,
- Height,
- Parent,
- Menu,
- Instance,
- Param
- );
-
- if (Parent == NULL)
- {
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(windowHandle, WDA_EXCLUDEFROMCAPTURE);
- }
-
- if (PhEnableThemeSupport && PhDefaultEnableThemeAcrylicWindowSupport)
- {
- PhSetWindowAcrylicCompositionColor(windowHandle, MakeABGRFromCOLORREF(0, RGB(10, 10, 10)));
- }
- }
- else if (PhEnableThemeSupport)
- {
- // Early subclassing of the SysLink control to eliminate blinking during page switches.
- if (!IS_INTRESOURCE(ClassName) && PhEqualStringZ((PWSTR)ClassName, WC_LINK, TRUE))
- {
- PhInitializeTaskDialogTheme(windowHandle, 0);
- }
- else if (!IS_INTRESOURCE(ClassName) && PhEqualStringZ((PWSTR)ClassName, WC_BUTTON, TRUE) &&
- PhGetWindowContext(GetAncestor(Parent, GA_ROOT), LONG_MAX))
- {
- PhSetControlTheme(windowHandle, L"DarkMode_Explorer");
- }
- }
-
- return windowHandle;
-}
-
-BOOL WINAPI PhSystemParametersInfoHook(
- _In_ UINT uiAction,
- _In_ UINT uiParam,
- _Pre_maybenull_ _Post_valid_ PVOID pvParam,
- _In_ UINT fWinIni
- )
-{
- if (uiAction == SPI_GETMENUFADE && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- if (uiAction == SPI_GETCLIENTAREAANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- if (uiAction == SPI_GETCOMBOBOXANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- if (uiAction == SPI_GETTOOLTIPANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- if (uiAction == SPI_GETMENUANIMATION && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- if (uiAction == SPI_GETTOOLTIPFADE && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- if (uiAction == SPI_GETMOUSEVANISH && pvParam)
- {
- *((PBOOL)pvParam) = FALSE;
- return TRUE;
- }
-
- return DefaultSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni);
-}
-
-//ULONG WINAPI GetSysColorHook(int nIndex)
-//{
-// if (nIndex == COLOR_WINDOW)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_MENUTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_WINDOWTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_CAPTIONTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_HIGHLIGHTTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_GRAYTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_BTNTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_INACTIVECAPTIONTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_BTNFACE)
-// return PhThemeWindowBackgroundColor;
-// if (nIndex == COLOR_BTNTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_BTNHIGHLIGHT)
-// return PhThemeWindowBackgroundColor;
-// if (nIndex == COLOR_INFOTEXT)
-// return PhThemeWindowTextColor;
-// if (nIndex == COLOR_INFOBK)
-// return PhThemeWindowBackgroundColor;
-// if (nIndex == COLOR_MENU)
-// return PhThemeWindowBackgroundColor;
-// if (nIndex == COLOR_HIGHLIGHT)
-// return PhThemeWindowForegroundColor;
-// return originalGetSysColor(nIndex);
-//}
-//
-//HBRUSH WINAPI GetSysColorBrushHook(_In_ int nIndex)
-//{
-// //if (nIndex == COLOR_WINDOW)
-// // return originalCreateSolidBrush(PhThemeWindowBackgroundColor);
-// if (nIndex == COLOR_BTNFACE)
-// return originalCreateSolidBrush(PhThemeWindowBackgroundColor);
-// return originalHook(nIndex);
-//}
-//
-// RGB(GetBValue(color), GetGValue(color), GetRValue(color));
-//#define RGB_FROM_COLOREF(cref) \
-// ((((cref) & 0x000000FF) << 16) | (((cref) & 0x0000FF00)) | (((cref) & 0x00FF0000) >> 16))
-
-HRESULT WINAPI PhDrawThemeTextHook(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCWSTR pszText,
- _In_ int cchText,
- _In_ DWORD dwTextFlags,
- _In_ DWORD dwTextFlags2,
- _In_ LPCRECT pRect
- )
-{
- if ((iPartId == BP_COMMANDLINK /*|| iPartId == BP_RADIOBUTTON*/) && iStateId != PBS_DISABLED)
- {
- WCHAR className[MAX_PATH];
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_BUTTON, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
- {
- DTTOPTS options = { sizeof(DTTOPTS), DTT_TEXTCOLOR, PhThemeWindowTextColor };
- return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, (LPRECT)pRect, &options);
- }
- }
-
- return DefaultDrawThemeText(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, dwTextFlags2, pRect);
-}
-
-HRESULT WINAPI PhDrawThemeTextExHook(
- _In_ HTHEME hTheme,
- _In_ HDC hdc,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ LPCWSTR pszText,
- _In_ int cchText,
- _In_ DWORD dwTextFlags,
- _Inout_ LPRECT pRect,
- _In_ const DTTOPTS* pOptions
- )
-{
- if (iPartId == BP_COMMANDLINK)
- {
- WCHAR className[MAX_PATH];
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_BUTTON, TRUE)
- /*|| WindowsVersion < WINDOWS_11 && WindowFromDC(hdc) == NULL*/)
- {
- DTTOPTS options = { sizeof(DTTOPTS) };
- if (pOptions)
- options = *pOptions;
- options.dwFlags |= DTT_TEXTCOLOR;
- DefaultGetThemeColor(hTheme, iPartId, iStateId, TMT_TEXTCOLOR, &options.crText);
- options.crText = PhMakeColorBrighter(options.crText, 90);
- return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, pRect, &options);
- }
- }
-
- return DefaultDrawThemeTextEx(hTheme, hdc, iPartId, iStateId, pszText, cchText, dwTextFlags, pRect, pOptions);
-}
-
-int PhDetoursComCtl32DrawTextW(
- _In_ HDC hdc,
- _Inout_ LPCWSTR lpchText,
- _In_ int cchText,
- _Inout_ LPRECT lprc,
- _In_ UINT format
- )
-{
- static PH_INITONCE initOnce = PH_INITONCE_INIT;
- static COLORREF colLinkNormal = RGB(0, 0 ,0);
- static COLORREF colLinkHot = RGB(0, 0, 0);
- static COLORREF colLinkPressed = RGB(0, 0, 0);
- HWND WindowHandle;
-
- if ((WindowHandle = WindowFromDC(hdc)) &&
- (PhIsDarkModeAllowedForWindow(WindowHandle) || PhGetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG))) // HACK
- {
- WCHAR windowClassName[MAX_PATH];
- GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
- if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
- {
- if (PhBeginInitOnce(&initOnce))
- {
- HTHEME hTextTheme = PhOpenThemeData(WindowHandle, VSCLASS_TEXTSTYLE, PhGetWindowDpi(WindowHandle));
- if (hTextTheme)
- {
- PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_NORMAL, TMT_TEXTCOLOR, &colLinkNormal);
- PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_HOT, TMT_TEXTCOLOR, &colLinkHot);
- PhGetThemeColor(hTextTheme, TEXT_HYPERLINKTEXT, TS_HYPERLINK_PRESSED, TMT_TEXTCOLOR, &colLinkPressed);
- PhCloseThemeData(hTextTheme);
- }
- PhEndInitOnce(&initOnce);
- }
-
- COLORREF color = GetTextColor(hdc);
-
- if (color == colLinkNormal || color == colLinkHot || color == colLinkPressed ||
- WindowsVersion < WINDOWS_11 && color == RGB(0x00, 0x66, 0xCC)) // on Windows 10 PhGetThemeColor returns 0xFFFFFF for any StateId
- {
- SetTextColor(hdc, PhMakeColorBrighter(color, 95));
- }
- }
- }
-
- return DefaultComCtl32DrawTextW(hdc, lpchText, cchText, lprc, format);
-}
-
-HRESULT PhGetThemeColorHook(
- _In_ HTHEME hTheme,
- _In_ int iPartId,
- _In_ int iStateId,
- _In_ int iPropId,
- _Out_ COLORREF* pColor
- )
-{
- WCHAR className[MAX_PATH];
-
- HRESULT retVal = DefaultGetThemeColor(hTheme, iPartId, iStateId, iPropId, pColor);
-
- if (iPropId == TMT_TEXTCOLOR && iPartId == TDLG_MAININSTRUCTIONPANE)
- {
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOGSTYLE, TRUE)
- /*|| WindowsVersion < WINDOWS_11*/)
- {
- *pColor = PhMakeColorBrighter(*pColor, 150); // Main header.
- }
- }
- else if (iPropId == TMT_TEXTCOLOR)
- {
- if (PhGetThemeClass(hTheme, className, RTL_NUMBER_OF(className)) && PhEqualStringZ(className, VSCLASS_TASKDIALOGSTYLE, TRUE)
- /*|| WindowsVersion < WINDOWS_11*/)
- {
- *pColor = PhThemeWindowTextColor; // Text color for check boxes, expanded text, and expander button text.
- }
- }
-
- return retVal;
-}
-
-HTHEME PhOpenNcThemeDataHook(
- _In_ HWND hwnd,
- _In_ LPCWSTR pszClassList
- )
-{
- if (PhEqualStringZ((PWSTR)pszClassList, VSCLASS_SCROLLBAR, TRUE) &&
- PhIsDarkModeAllowedForWindow(hwnd))
- {
- return DefaultOpenNcThemeData(NULL, L"Explorer::ScrollBar");
- }
-
- return DefaultOpenNcThemeData(hwnd, pszClassList);
-}
-
-BOOLEAN CALLBACK PhInitializeTaskDialogTheme(
- _In_ HWND WindowHandle,
- _In_opt_ PVOID CallbackData
- )
-{
- WCHAR windowClassName[MAX_PATH];
- PTASKDIALOG_COMMON_CONTEXT context;
- BOOLEAN windowHasContext = !!PhGetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG);
-
- if (CallbackData && !windowHasContext)
- {
- if (PhDefaultEnableStreamerMode)
- {
- SetWindowDisplayAffinity(WindowHandle, WDA_EXCLUDEFROMCAPTURE);
- }
-
- PhInitializeThemeWindowFrame(WindowHandle);
-
- PTASKDIALOG_WINDOW_CONTEXT context = PhAllocateZero(sizeof(TASKDIALOG_WINDOW_CONTEXT));
- context->DefaultWindowProc = PhSetWindowProcedure(WindowHandle, ThemeTaskDialogMasterSubclass);
- context->CallbackData = CallbackData;
- PhSetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG, context);
- windowHasContext = TRUE;
- }
-
- PhEnumChildWindows(
- WindowHandle,
- 0x1000,
- PhInitializeTaskDialogTheme,
- NULL
- );
-
- if (windowHasContext) // HACK
- return TRUE;
-
- GETCLASSNAME_OR_NULL(WindowHandle, windowClassName);
-
- context = PhAllocateZero(sizeof(TASKDIALOG_COMMON_CONTEXT));
- context->DefaultWindowProc = PhSetWindowProcedure(WindowHandle, ThemeTaskDialogMasterSubclass);
- PhSetWindowContext(WindowHandle, TASKDIALOG_CONTEXT_TAG, context);
-
- if (PhEqualStringZ(windowClassName, WC_BUTTON, FALSE) ||
- PhEqualStringZ(windowClassName, WC_SCROLLBAR, FALSE))
- {
- PhSetControlTheme(WindowHandle, L"DarkMode_Explorer");
- }
- //else if (PhEqualStringZ(windowClassName, WC_LINK, FALSE))
- //{
- // PhAllowDarkModeForWindow(WindowHandle); // this doesn't work, idk why
- //}
- else if (PhEqualStringZ(windowClassName, L"DirectUIHWND", FALSE))
- {
- //WINDOWPLACEMENT pos = { 0 };
- //GetWindowPlacement(GetParent(WindowHandle), &pos);
- PhSetControlTheme(WindowHandle, L"DarkMode_Explorer");
- //SetWindowPlacement(GetParent(WindowHandle), &pos);
- }
-
- return TRUE;
-}
-
-LRESULT CALLBACK ThemeTaskDialogMasterSubclass(
- _In_ HWND hwnd,
- _In_ UINT uMsg,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
- )
-{
- LRESULT result;
- PTASKDIALOG_COMMON_CONTEXT context;
- WNDPROC OldWndProc;
-
- if (!(context = PhGetWindowContext(hwnd, TASKDIALOG_CONTEXT_TAG)))
- return 0;
-
- OldWndProc = context->DefaultWindowProc;
-
- switch (uMsg)
- {
- case WM_ERASEBKGND:
- {
- HDC hdc = (HDC)wParam;
- RECT rect;
- WCHAR windowClassName[MAX_PATH];
-
- SetTextColor(hdc, PhThemeWindowTextColor); // Color for SysLink, which must be set in its parent.
-
- if (!context->Painting)
- {
- GETCLASSNAME_OR_NULL(hwnd, windowClassName);
- // Avoid erasing the background for links, as they will blink white on the extender and during page switches.
- if (!PhEqualStringZ(windowClassName, WC_LINK, FALSE))
- {
- GetClipBox(hdc, &rect);
- SetDCBrushColor(hdc, PhThemeWindowBackground2Color);
- FillRect(hdc, &rect, PhGetStockBrush(DC_BRUSH));
- }
- }
- }
- return TRUE;
- case WM_NOTIFY:
- {
- LPNMHDR data = (LPNMHDR)lParam;
-
- if (data->code == NM_CUSTOMDRAW)
- {
- LPNMCUSTOMDRAW customDraw = (LPNMCUSTOMDRAW)lParam;
- WCHAR className[MAX_PATH];
-
- if (!GetClassName(customDraw->hdr.hwndFrom, className, RTL_NUMBER_OF(className)))
- className[0] = UNICODE_NULL;
- if (PhEqualStringZ(className, WC_BUTTON, FALSE))
- {
- return PhThemeWindowDrawButton(customDraw);
- }
- }
- }
- break;
- case TDM_NAVIGATE_PAGE:
- {
- PTASKDIALOG_WINDOW_CONTEXT WindowContext = (PTASKDIALOG_WINDOW_CONTEXT)context;
- PTASKDIALOGCONFIG trueConfig = (PTASKDIALOGCONFIG)lParam;
- PTASKDIALOGCONFIG myConfig;
- TASKDIALOGCONFIG config = { sizeof(TASKDIALOGCONFIG) };
-
- WindowContext->CallbackData->pfCallback = trueConfig ? trueConfig->pfCallback : NULL;
- WindowContext->CallbackData->lpCallbackData = trueConfig ? trueConfig->lpCallbackData : 0;
- myConfig = trueConfig ? trueConfig : &config;
- myConfig->pfCallback = ThemeTaskDialogCallbackHook;
- myConfig->lpCallbackData = (LONG_PTR)WindowContext->CallbackData;
-
- return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, (LPARAM)myConfig);
- }
- case WM_DESTROY:
- {
- PhSetWindowProcedure(hwnd, OldWndProc);
- PhRemoveWindowContext(hwnd, TASKDIALOG_CONTEXT_TAG);
- PhFree(context);
- }
- return CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
- case WM_CTLCOLORDLG:
- return (LRESULT)PhThemeWindowBackgroundBrush; // Window background color when the extender resizes upward (Windows 10 only).
- }
-
- context->Painting++;
- result = CallWindowProc(OldWndProc, hwnd, uMsg, wParam, lParam);
- context->Painting--;
- return result;
-}
-
-HRESULT CALLBACK ThemeTaskDialogCallbackHook(
- _In_ HWND hwndDlg,
- _In_ UINT uMsg,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam,
- _In_ LONG_PTR dwRefData
- )
-{
- HRESULT result = S_OK;
-
- PTASKDIALOG_CALLBACK_WRAP CallbackData = (PTASKDIALOG_CALLBACK_WRAP)dwRefData;
-
- if (uMsg == TDN_DIALOG_CONSTRUCTED) // Called on each new page, including the first one.
- {
- PhInitializeTaskDialogTheme(hwndDlg, CallbackData);
- }
-
- if (CallbackData->pfCallback)
- result = CallbackData->pfCallback(hwndDlg, uMsg, wParam, lParam, CallbackData->lpCallbackData);
-
- return result;
-}
-
-// https://github.com/SFTRS/DarkTaskDialog
-HRESULT PhTaskDialogIndirectHook(
- _In_ const TASKDIALOGCONFIG* pTaskConfig,
- _Out_opt_ int* pnButton,
- _Out_opt_ int* pnRadioButton,
- _Out_opt_ BOOL* pfVerificationFlagChecked
- )
-{
- TASKDIALOG_CALLBACK_WRAP CallbackData;
- CallbackData.pfCallback = pTaskConfig->pfCallback;
- CallbackData.lpCallbackData = pTaskConfig->lpCallbackData;
- TASKDIALOGCONFIG myConfig = *pTaskConfig;
- myConfig.pfCallback = ThemeTaskDialogCallbackHook;
- myConfig.lpCallbackData = (LONG_PTR)&CallbackData;
-
- return DefaultTaskDialogIndirect(&myConfig, pnButton, pnRadioButton, pfVerificationFlagChecked);
-}
-
-VOID PhRegisterDetoursHooks(
- VOID
- )
-{
- NTSTATUS status;
- PVOID baseAddress;
-
- // For early TaskDialog with PhStartupParameters.ShowOptions
- if (!PhThemeWindowBackgroundBrush)
- {
- PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
- }
-
- if (baseAddress = PhGetLoaderEntryDllBaseZ(L"user32.dll"))
- {
- DefaultCreateWindowEx = PhGetDllBaseProcedureAddress(baseAddress, "CreateWindowExW", 0);
- DefaultSystemParametersInfo = PhGetDllBaseProcedureAddress(baseAddress, "SystemParametersInfoW", 0);
- }
-
- if (baseAddress = PhGetLoaderEntryDllBaseZ(L"uxtheme.dll"))
- {
- DefaultDrawThemeBackground = PhGetDllBaseProcedureAddress(baseAddress, "DrawThemeBackground", 0);
- DefaultDrawThemeBackgroundEx = PhGetDllBaseProcedureAddress(baseAddress, "DrawThemeBackgroundEx", 0);
- DefaultDrawThemeText = PhGetDllBaseProcedureAddress(baseAddress, "DrawThemeText", 0);
- DefaultDrawThemeTextEx = PhGetDllBaseProcedureAddress(baseAddress, "DrawThemeTextEx", 0);
- DefaultGetThemeColor = PhGetDllBaseProcedureAddress(baseAddress, "GetThemeColor", 0);
- DefaultOpenNcThemeData = PhGetDllBaseProcedureAddress(baseAddress, NULL, 49);
- }
-
- if (baseAddress = PhGetLoaderEntryDllBaseZ(L"Comctl32.dll"))
- {
- if (WindowsVersion >= WINDOWS_11) // TaskDialog theme on Windows 10 currently unsupported...
- DefaultTaskDialogIndirect = PhGetDllBaseProcedureAddress(baseAddress, "TaskDialogIndirect", 0);
- PhLoaderEntryDetourImportProcedure(baseAddress, "User32.dll", "DrawTextW", PhDetoursComCtl32DrawTextW, (PVOID*)&DefaultComCtl32DrawTextW);
- }
-
- if (!NT_SUCCESS(status = DetourTransactionBegin()))
- goto CleanupExit;
-
- if (PhEnableThemeSupport || PhEnableThemeAcrylicSupport)
- {
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeBackground, (PVOID)PhDrawThemeBackgroundHook)))
- goto CleanupExit;
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeBackgroundEx, (PVOID)PhDrawThemeBackgroundExHook)))
- goto CleanupExit;
- if (!PhDefaultEnableThemeAnimation)
- {
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultSystemParametersInfo, (PVOID)PhSystemParametersInfoHook)))
- goto CleanupExit;
- }
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeText, (PVOID)PhDrawThemeTextHook)))
- goto CleanupExit;
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultDrawThemeTextEx, (PVOID)PhDrawThemeTextExHook)))
- goto CleanupExit;
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultGetThemeColor, (PVOID)PhGetThemeColorHook)))
- goto CleanupExit;
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultOpenNcThemeData, (PVOID)PhOpenNcThemeDataHook)))
- goto CleanupExit;
- if (WindowsVersion >= WINDOWS_11)
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultTaskDialogIndirect, (PVOID)PhTaskDialogIndirectHook)))
- goto CleanupExit;
- }
-
- if (!NT_SUCCESS(status = DetourAttach((PVOID)&DefaultCreateWindowEx, (PVOID)PhCreateWindowExHook)))
- goto CleanupExit;
- if (!NT_SUCCESS(status = DetourTransactionCommit()))
- goto CleanupExit;
-
-CleanupExit:
-
- if (!NT_SUCCESS(status))
- {
- PhShowStatus(NULL, L"Unable to commit detours transaction.", status, 0);
- }
-}
-
-BOOLEAN PhIsThemeTransparencyEnabled(
- VOID
- )
-{
- static CONST PH_STRINGREF themesKeyName = PH_STRINGREF_INIT(L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize");
- BOOLEAN themesEnableTransparency = FALSE;
- HANDLE keyHandle;
-
- if (NT_SUCCESS(PhOpenKey(
- &keyHandle,
- KEY_QUERY_VALUE,
- PH_KEY_CURRENT_USER,
- &themesKeyName,
- 0
- )))
- {
- themesEnableTransparency = !!PhQueryRegistryUlongZ(keyHandle, L"EnableTransparency");
- NtClose(keyHandle);
- }
-
- return themesEnableTransparency;
-}
-
-VOID PvInitializeSuperclassControls(
- VOID
- )
-{
- PhDefaultEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");
-
- if (PhEnableThemeAcrylicSupport && !PhEnableThemeSupport)
- PhEnableThemeAcrylicSupport = FALSE;
- if (PhEnableThemeAcrylicSupport)
- PhEnableThemeAcrylicSupport = PhIsThemeTransparencyEnabled();
-
- if (PhEnableThemeSupport || PhDefaultEnableStreamerMode)
- {
- if (WindowsVersion >= WINDOWS_11)
- {
- PhDefaultEnableThemeAcrylicWindowSupport = !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
- }
-
- PhDefaultEnableThemeAnimation = !!PhGetIntegerSetting(L"EnableThemeAnimation");
- PhEnableThemeNativeButtons = !!PhGetIntegerSetting(L"EnableThemeNativeButtons");
-
- PhRegisterDialogSuperClass();
- PhRegisterMenuSuperClass();
- PhRegisterRebarSuperClass();
- PhRegisterComboBoxSuperClass();
- PhRegisterStaticSuperClass();
- PhRegisterStatusBarSuperClass();
- PhRegisterEditSuperClass();
- PhRegisterHeaderSuperClass();
-
- PhRegisterDetoursHooks();
- }
-}
diff --git a/tools/peview/ehcontprp.c b/tools/peview/ehcontprp.c
index cebb7a29b57a..b7788acc8a69 100644
--- a/tools/peview/ehcontprp.c
+++ b/tools/peview/ehcontprp.c
@@ -167,7 +167,7 @@ INT_PTR CALLBACK PvpPeEhContDlgProc(
PvEnumerateEHContinuationEntries(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/exlfdynamic.c b/tools/peview/exlfdynamic.c
index d397d76d948c..d84365ff2cca 100644
--- a/tools/peview/exlfdynamic.c
+++ b/tools/peview/exlfdynamic.c
@@ -182,7 +182,7 @@ INT_PTR CALLBACK PvpExlfDynamicDlgProc(
PvpProcessElfDynamic(lvHandle);
ExtendedListView_SortItems(lvHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/exlfexports.c b/tools/peview/exlfexports.c
index 194dd202665e..a6403338598c 100644
--- a/tools/peview/exlfexports.c
+++ b/tools/peview/exlfexports.c
@@ -81,7 +81,7 @@ INT_PTR CALLBACK PvpExlfExportsDlgProc(
PvpProcessElfExports(lvHandle);
ExtendedListView_SortItems(lvHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/exlfimports.c b/tools/peview/exlfimports.c
index 672578341941..4f4c362203ee 100644
--- a/tools/peview/exlfimports.c
+++ b/tools/peview/exlfimports.c
@@ -78,7 +78,7 @@ INT_PTR CALLBACK PvpExlfImportsDlgProc(
PvpProcessElfImports(lvHandle);
ExtendedListView_SortItems(lvHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/exlfprp.c b/tools/peview/exlfprp.c
index 7f6551a04e67..237d0b04646e 100644
--- a/tools/peview/exlfprp.c
+++ b/tools/peview/exlfprp.c
@@ -463,7 +463,7 @@ INT_PTR CALLBACK PvpExlfGeneralDlgProc(
PvpLoadWslSections(lvHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/expprp.c b/tools/peview/expprp.c
index ecaaa45689dc..ed371d70f607 100644
--- a/tools/peview/expprp.c
+++ b/tools/peview/expprp.c
@@ -454,7 +454,7 @@ INT_PTR CALLBACK PvPeExportsDlgProc(
PhCreateThread2(PvpPeExportsEnumerateThread, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/hashprp.c b/tools/peview/hashprp.c
index 6db8c3119f79..4c321ebf8d31 100644
--- a/tools/peview/hashprp.c
+++ b/tools/peview/hashprp.c
@@ -1357,7 +1357,7 @@ INT_PTR CALLBACK PvpPeHashesDlgProc(
PhCreateThread2(PvPeFileHashThread, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/impprp.c b/tools/peview/impprp.c
index 7e0447e39df3..e5fbec85bad3 100644
--- a/tools/peview/impprp.c
+++ b/tools/peview/impprp.c
@@ -473,7 +473,7 @@ INT_PTR CALLBACK PvPeImportsDlgProc(
PhCreateThread2(PvpPeImportsEnumerateThread, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/include/peview.h b/tools/peview/include/peview.h
index bb3694dbd3cc..7a9fc8d9fee3 100644
--- a/tools/peview/include/peview.h
+++ b/tools/peview/include/peview.h
@@ -56,10 +56,6 @@ BOOLEAN PvpLoadDbgHelp(
_Inout_ PPH_SYMBOL_PROVIDER* SymbolProvider
);
-VOID PvInitializeSuperclassControls(
- VOID
- );
-
// peprp
VOID PvPeProperties(
@@ -874,4 +870,8 @@ EXTERN_C HRESULT PvClrImageEnumTables(
_In_ PVOID Context
);
+NTSTATUS NTAPI PvReInitializeThemeThread(
+ _In_ PVOID Context
+ );
+
#endif
diff --git a/tools/peview/layout.c b/tools/peview/layout.c
index 502dd692154e..79af44118e78 100644
--- a/tools/peview/layout.c
+++ b/tools/peview/layout.c
@@ -1328,7 +1328,7 @@ INT_PTR CALLBACK PvpPeLayoutDlgProc(
TreeNew_NodesStructured(context->TreeNewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/ldprp.c b/tools/peview/ldprp.c
index 516ad5a2adc5..268ee56e1fd3 100644
--- a/tools/peview/ldprp.c
+++ b/tools/peview/ldprp.c
@@ -448,7 +448,7 @@ INT_PTR CALLBACK PvPeLoadConfigDlgProc(
}
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/libprp.c b/tools/peview/libprp.c
index f52cefd285dc..896335331b8d 100644
--- a/tools/peview/libprp.c
+++ b/tools/peview/libprp.c
@@ -156,7 +156,7 @@ INT_PTR CALLBACK PvpLibExportsDlgProc(
ExtendedListView_SortItems(lvHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/links.c b/tools/peview/links.c
index c6dc806c66cf..9175dc6c6d52 100644
--- a/tools/peview/links.c
+++ b/tools/peview/links.c
@@ -198,7 +198,7 @@ INT_PTR CALLBACK PvpPeLinksDlgProc(
PvpPeEnumerateFileLinks(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/main.c b/tools/peview/main.c
index f66238230f36..23ad7fe97786 100644
--- a/tools/peview/main.c
+++ b/tools/peview/main.c
@@ -120,7 +120,7 @@ INT WINAPI wWinMain(
PhGuiSupportInitialization();
PhSettingsInitialization();
PvInitializeSettings();
- PvInitializeSuperclassControls();
+ PhInitializeSuperclassControls();
PhShowWarning2(
NULL,
L"Warning.",
@@ -138,7 +138,7 @@ INT WINAPI wWinMain(
PvInitializeSettings();
PvPropInitialization();
PhTreeNewInitialization();
- PvInitializeSuperclassControls();
+ PhInitializeSuperclassControls();
PvpConnectKph();
if (!NT_SUCCESS(PhGetProcessCommandLineStringRef(&commandLine)))
diff --git a/tools/peview/mappings.c b/tools/peview/mappings.c
index 25e0b5aeefcb..e93ec763b817 100644
--- a/tools/peview/mappings.c
+++ b/tools/peview/mappings.c
@@ -204,7 +204,7 @@ INT_PTR CALLBACK PvpMappingsDlgProc(
PvEnumerateMappingsEntries(context->ListViewHandle);
- PhInitializeWindowTheme(WindowHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(WindowHandle);
}
break;
case WM_SHOWWINDOW:
diff --git a/tools/peview/options.c b/tools/peview/options.c
index 62e07c3708f1..0bd73852a9a5 100644
--- a/tools/peview/options.c
+++ b/tools/peview/options.c
@@ -14,9 +14,11 @@
typedef enum _PHP_OPTIONS_INDEX
{
PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT,
+ PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME,
PHP_OPTIONS_INDEX_ENABLE_LEGACY_TABS,
PHP_OPTIONS_INDEX_ENABLE_THEME_BORDER,
PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT,
+ PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE
} PHP_OPTIONS_GENERAL_INDEX;
typedef struct _PVP_PE_OPTIONS_CONTEXT
@@ -135,20 +137,24 @@ VOID PvLoadGeneralPage(
//PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_PLUGINS, L"Enable plugins", NULL);
//PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS, L"Enable undecorated symbols", NULL);
PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"Enable theme support", NULL);
+ PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"Use Windows app color mode", NULL);
//PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"Enable start as admin", NULL);
//PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_SHOW_ADVANCED_OPTIONS, L"Show advanced options", NULL);
PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_LEGACY_TABS, L"Enable legacy properties window", NULL);
PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_BORDER, L"Enable view borders", NULL);
PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT, L"Remember last selected window", NULL);
+ PhAddListViewItem(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"Enable streamer mode (disable window capture)", NULL);
//SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_WARNINGS, L"EnableWarnings");
//SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_PLUGINS, L"EnablePlugins");
//SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS, L"DbgHelpUndecorate");
SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
+ SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"EnableThemeUseWindowsTheme");
//SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"EnableStartAsAdmin");
SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_LEGACY_TABS, L"EnableLegacyPropertiesDialog");
SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_BORDER, L"EnableTreeListBorder");
SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT, L"MainWindowPageRestoreEnabled");
+ SetLvItemCheckForSetting(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
}
VOID PvGeneralPageSave(
@@ -172,15 +178,31 @@ VOID PvGeneralPageSave(
//SetSettingForLvItemCheck(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_WARNINGS, L"EnableWarnings");
//SetSettingForLvItemCheckRestartRequired(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_PLUGINS, L"EnablePlugins");
//SetSettingForLvItemCheck(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_UNDECORATE_SYMBOLS, L"DbgHelpUndecorate");
- SetSettingForLvItemCheckRestartRequired(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
+ SetSettingForLvItemCheck(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_SUPPORT, L"EnableThemeSupport");
+ SetSettingForLvItemCheck(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_WINDOWS_THEME, L"EnableThemeUseWindowsTheme");
//SetSettingForLvItemCheck(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_START_ASADMIN, L"EnableStartAsAdmin");
SetSettingForLvItemCheckRestartRequired(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_LASTTAB_SUPPORT, L"MainWindowPageRestoreEnabled");
SetSettingForLvItemCheckRestartRequired(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_LEGACY_TABS, L"EnableLegacyPropertiesDialog");
SetSettingForLvItemCheckRestartRequired(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_THEME_BORDER, L"EnableTreeListBorder");
+ SetSettingForLvItemCheck(Context->ListViewHandle, PHP_OPTIONS_INDEX_ENABLE_STREAM_MODE, L"EnableStreamerMode");
+
+ BOOLEAN oldTheme = PhEnableThemeSupport;
+ BOOLEAN oldAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport;
+ BOOLEAN oldStreamerMode = PhEnableStreamerMode;
PvUpdateCachedSettings();
PvSaveSettings();
+ if (PhEnableThemeSupport != oldTheme || PhEnableThemeAcrylicWindowSupport != oldAcrylicWindowSupport)
+ {
+ PhReInitializeTheme(PhEnableThemeSupport);
+ }
+
+ if (PhEnableStreamerMode != oldStreamerMode)
+ {
+ PhReInitializeStreamerMode(PhEnableStreamerMode);
+ }
+
if (RestartRequired)
{
if (PhShowMessage2(
@@ -261,7 +283,7 @@ INT_PTR CALLBACK PvOptionsWndProc(
PvLoadGeneralPage(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/pdbprp.c b/tools/peview/pdbprp.c
index 210e62223333..9087d7efaa33 100644
--- a/tools/peview/pdbprp.c
+++ b/tools/peview/pdbprp.c
@@ -890,7 +890,7 @@ INT_PTR CALLBACK PvpSymbolsDlgProc(
0
);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/pechpeprp.c b/tools/peview/pechpeprp.c
index 6682498eca18..d7a7ac1754e9 100644
--- a/tools/peview/pechpeprp.c
+++ b/tools/peview/pechpeprp.c
@@ -469,7 +469,7 @@ INT_PTR CALLBACK PvpPeCHPEDlgProc(
}
}
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/pedirprp.c b/tools/peview/pedirprp.c
index dba750186c26..189d59010c1e 100644
--- a/tools/peview/pedirprp.c
+++ b/tools/peview/pedirprp.c
@@ -437,7 +437,7 @@ INT_PTR CALLBACK PvPeDirectoryDlgProc(
PhCreateThread2(PvpPeDirectoryEnumerateThread, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/pedynrelocprp.c b/tools/peview/pedynrelocprp.c
index 97e8ef8030e9..189e35d0caa6 100644
--- a/tools/peview/pedynrelocprp.c
+++ b/tools/peview/pedynrelocprp.c
@@ -280,7 +280,7 @@ INT_PTR CALLBACK PvpPeDynamicRelocationDlgProc(
PvEnumerateDynamicRelocationEntries(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_SHOWWINDOW:
diff --git a/tools/peview/peexceptprp.c b/tools/peview/peexceptprp.c
index 6a110e262c00..bfe32f3154f7 100644
--- a/tools/peview/peexceptprp.c
+++ b/tools/peview/peexceptprp.c
@@ -410,7 +410,7 @@ INT_PTR CALLBACK PvpPeExceptionDlgProc(
PvEnumerateExceptionEntries(hwndDlg, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/peheaderprp.c b/tools/peview/peheaderprp.c
index ccb347a629cb..1fe2563b405c 100644
--- a/tools/peview/peheaderprp.c
+++ b/tools/peview/peheaderprp.c
@@ -793,7 +793,7 @@ INT_PTR CALLBACK PvPeHeadersDlgProc(
PvPeUpdateImageHeaderProperties(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/pemuiprp.c b/tools/peview/pemuiprp.c
index be09ac1b8388..82754c74eb0c 100644
--- a/tools/peview/pemuiprp.c
+++ b/tools/peview/pemuiprp.c
@@ -270,7 +270,7 @@ INT_PTR CALLBACK PvpPeMuiResourceDlgProc(
PvPeGetMuiInfo(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/pepogoprp.c b/tools/peview/pepogoprp.c
index 36cdb1b99dfa..7f001c988c8d 100644
--- a/tools/peview/pepogoprp.c
+++ b/tools/peview/pepogoprp.c
@@ -233,7 +233,7 @@ INT_PTR CALLBACK PvpPeDebugPogoDlgProc(
PvEnumerateImagePogoSections(hwndDlg, context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -498,7 +498,7 @@ INT_PTR CALLBACK PvpPeDebugCrtDlgProc(
PvEnumerateCrtInitializers(hwndDlg, context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/peprp.c b/tools/peview/peprp.c
index 98adf2c3703c..45a27bee21d8 100644
--- a/tools/peview/peprp.c
+++ b/tools/peview/peprp.c
@@ -2089,7 +2089,7 @@ INT_PTR CALLBACK PvPeGeneralDlgProc(
ExtendedListView_SetColumnWidth(context->ListViewHandle, 1, ELVSCW_AUTOSIZE_REMAININGSPACE);
if (PhEnableThemeSupport)
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
PhSetTimer(hwndDlg, PH_WINDOW_TIMER_DEFAULT, 1000, NULL);
}
@@ -2259,6 +2259,12 @@ INT_PTR CALLBACK PvPeGeneralDlgProc(
return (INT_PTR)PhGetStockBrush(DC_BRUSH);
}
break;
+ case WM_SETTINGCHANGE:
+ if (HANDLE_COLORSCHEMECHANGE_MESSAGE(wParam, lParam, L"EnableThemeSupport", L"EnableThemeUseWindowsTheme"))
+ {
+ PhCreateThread2(PvReInitializeThemeThread, NULL);
+ }
+ break;
}
return FALSE;
diff --git a/tools/peview/peprpwnd.c b/tools/peview/peprpwnd.c
index 794ae29224bd..04860fee0b00 100644
--- a/tools/peview/peprpwnd.c
+++ b/tools/peview/peprpwnd.c
@@ -778,8 +778,7 @@ INT_PTR CALLBACK PvTabWindowDialogProc(
PhAddLayoutItem(&PvTabWindowLayoutManager, GetDlgItem(hwndDlg, IDC_SECURITY), NULL, PH_ANCHOR_LEFT | PH_ANCHOR_BOTTOM);
PhAddLayoutItem(&PvTabWindowLayoutManager, GetDlgItem(hwndDlg, IDOK), NULL, PH_ANCHOR_RIGHT | PH_ANCHOR_BOTTOM);
- if (PhEnableThemeSupport)
- PhInitializeWindowTheme(hwndDlg, TRUE);
+ PhInitializeWindowTheme(hwndDlg);
{
HICON smallIcon;
@@ -983,11 +982,40 @@ INT_PTR CALLBACK PvTabWindowDialogProc(
}
}
break;
+ case WM_SETTINGCHANGE:
+ if (HANDLE_COLORSCHEMECHANGE_MESSAGE(wParam, lParam, L"EnableThemeSupport", L"EnableThemeUseWindowsTheme"))
+ {
+ PhCreateThread2(PvReInitializeThemeThread, NULL);
+ }
+ break;
}
return FALSE;
}
+NTSTATUS NTAPI PvReInitializeThemeThread(
+ _In_ PVOID Context
+ )
+{
+ BOOLEAN currentTheme;
+
+ //currentTheme = PhShouldAppsUseDarkMode();
+ currentTheme = PhGetAppsUseLightTheme();
+
+ dprintf("PvReInitializeThemeThread: currentTheme = %d, PhEnableThemeSupport = %d\r\n", currentTheme, PhEnableThemeSupport);
+
+ if (PhEnableThemeSupport != currentTheme)
+ {
+ PhEnableThemeSupport = currentTheme;
+
+ PhEnableThemeAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport && PhEnableThemeSupport && PhIsThemeTransparencyEnabled();
+
+ PhReInitializeTheme(PhEnableThemeSupport);
+ };
+
+ return STATUS_SUCCESS;
+}
+
VOID PvTabWindowOnSize(
VOID
)
@@ -1196,5 +1224,5 @@ VOID PvCreateTabSectionDialog(
Section->Parameter
);
- PhInitializeWindowTheme(Section->DialogHandle, PhEnableThemeSupport);
+ PhInitializeWindowTheme(Section->DialogHandle);
}
diff --git a/tools/peview/perelocprp.c b/tools/peview/perelocprp.c
index 02bbb7c7b1f3..514dfc68f80d 100644
--- a/tools/peview/perelocprp.c
+++ b/tools/peview/perelocprp.c
@@ -209,7 +209,7 @@ INT_PTR CALLBACK PvpPeRelocationDlgProc(
PvEnumerateRelocationEntries(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_SHOWWINDOW:
diff --git a/tools/peview/pesectionprp.c b/tools/peview/pesectionprp.c
index a4379ab46369..c486ca9af690 100644
--- a/tools/peview/pesectionprp.c
+++ b/tools/peview/pesectionprp.c
@@ -488,7 +488,7 @@ INT_PTR CALLBACK PvPeSectionsDlgProc(
PhCreateThread2(PvpPeSectionsEnumerateThread, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/peview.vcxproj b/tools/peview/peview.vcxproj
index 0377c4dfbd4d..974c6b466ed8 100644
--- a/tools/peview/peview.vcxproj
+++ b/tools/peview/peview.vcxproj
@@ -208,7 +208,6 @@
-
diff --git a/tools/peview/peview.vcxproj.filters b/tools/peview/peview.vcxproj.filters
index 24b170febcc0..4532c3c3f9b8 100644
--- a/tools/peview/peview.vcxproj.filters
+++ b/tools/peview/peview.vcxproj.filters
@@ -171,9 +171,6 @@
Source Files\Pages\Windows
-
- Source Files
-
Source Files\Pages
diff --git a/tools/peview/previewprp.c b/tools/peview/previewprp.c
index 7422d8904e46..5289c89ff1d3 100644
--- a/tools/peview/previewprp.c
+++ b/tools/peview/previewprp.c
@@ -109,7 +109,7 @@ INT_PTR CALLBACK PvpPePreviewDlgProc(
PvpShowFilePreview(hwndDlg);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/processes.c b/tools/peview/processes.c
index b37ac8c29c82..92b2b971b08e 100644
--- a/tools/peview/processes.c
+++ b/tools/peview/processes.c
@@ -135,7 +135,7 @@ INT_PTR CALLBACK PvpPeProcessesDlgProc(
PvpPeEnumerateProcessIds(context->ListViewHandle);
//ExtendedListView_SortItems(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/propstore.c b/tools/peview/propstore.c
index c959cd20cf4d..1902cc6e1e5c 100644
--- a/tools/peview/propstore.c
+++ b/tools/peview/propstore.c
@@ -195,7 +195,7 @@ INT_PTR CALLBACK PvpPePropStoreDlgProc(
PvpPeEnumerateFilePropStore(context->ListViewHandle);
//ExtendedListView_SortItems(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/prpsh.c b/tools/peview/prpsh.c
index a41085d26ddb..563b6ee47c9a 100644
--- a/tools/peview/prpsh.c
+++ b/tools/peview/prpsh.c
@@ -330,8 +330,7 @@ INT CALLBACK PvpPropSheetProc(
MinimumSize.left = 0;
}
- if (PhEnableThemeSupport)
- PhInitializeWindowTheme(hwndDlg, TRUE);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
}
diff --git a/tools/peview/resprp.c b/tools/peview/resprp.c
index 58ce5ac10789..b4e224aa620d 100644
--- a/tools/peview/resprp.c
+++ b/tools/peview/resprp.c
@@ -604,7 +604,7 @@ INT_PTR CALLBACK PvPeResourcesDlgProc(
PhCreateThread2(PvpPeResourcesEnumerateThread, context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/richprp.c b/tools/peview/richprp.c
index aa4194f27ea6..eb7767069166 100644
--- a/tools/peview/richprp.c
+++ b/tools/peview/richprp.c
@@ -441,7 +441,7 @@ INT_PTR CALLBACK PvpPeProdIdDlgProc(
PvpPeEnumProdEntries(hwndDlg, context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/searchbox.c b/tools/peview/searchbox.c
index 306f4eeeb846..428c28d64c4e 100644
--- a/tools/peview/searchbox.c
+++ b/tools/peview/searchbox.c
@@ -25,10 +25,14 @@ VOID PvCreateSearchControl(
WindowHandle,
BannerText,
PhInstanceHandle,
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_DARK),
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_DARK),
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_DARK),
- PhEnableThemeSupport ? MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_LIGHT) : MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_LIGHT),
+ MAKEINTRESOURCE(IDB_SEARCH_INACTIVE_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_ACTIVE_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_REGEX_MODERN_DARK),
+ MAKEINTRESOURCE(IDB_SEARCH_CASE_MODERN_DARK),
L"SearchControlRegex",
L"SearchControlCaseSensitive",
Callback,
diff --git a/tools/peview/secprp.c b/tools/peview/secprp.c
index bb792599d653..f93bfd828b00 100644
--- a/tools/peview/secprp.c
+++ b/tools/peview/secprp.c
@@ -1484,7 +1484,7 @@ INT_PTR CALLBACK PvpPeSecurityDlgProc(
PvpPeEnumerateFileCertificates(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/settings.c b/tools/peview/settings.c
index 92ecd01950e6..68a046f98bfa 100644
--- a/tools/peview/settings.c
+++ b/tools/peview/settings.c
@@ -24,11 +24,13 @@ VOID PvAddDefaultSettings(
PhpAddIntegerSetting(L"EnableLegacyPropertiesDialog", L"0");
PhpAddIntegerSetting(L"EnableSecurityAdvancedDialog", L"1");
PhpAddIntegerSetting(L"EnableStreamerMode", L"0");
- PhpAddIntegerSetting(L"EnableThemeSupport", L"0");
+ PhpAddIntegerSetting(L"EnableThemeSupport", L"1");
+ PhpAddIntegerSetting(L"EnableThemeUseWindowsTheme", L"1");
PhpAddIntegerSetting(L"EnableThemeAcrylicSupport", L"1");
PhpAddIntegerSetting(L"EnableThemeAcrylicWindowSupport", L"0");
PhpAddIntegerSetting(L"EnableThemeAnimation", L"1");
PhpAddIntegerSetting(L"EnableThemeNativeButtons", L"0");
+ PhpAddIntegerSetting(L"EnableThemeTabBorders", L"0");
PhpAddIntegerSetting(L"ThemeWindowForegroundColor", L"1c1c1c"); // RGB(28, 28, 28)
PhpAddIntegerSetting(L"ThemeWindowBackgroundColor", L"2b2b2b"); // RGB(43, 43, 43)
PhpAddIntegerSetting(L"ThemeWindowBackground2Color", L"414141"); // RGB(65, 65, 65)
@@ -121,14 +123,30 @@ VOID PvUpdateCachedSettings(
{
PhMaxSizeUnit = PhGetIntegerSetting(L"MaxSizeUnit");
PhEnableSecurityAdvancedDialog = !!PhGetIntegerSetting(L"EnableSecurityAdvancedDialog");
- PhEnableThemeSupport = !!PhGetIntegerSetting(L"EnableThemeSupport");
PhThemeWindowForegroundColor = PhGetIntegerSetting(L"ThemeWindowForegroundColor");
+ COLORREF oldPhThemeWindowBackgroundColor = PhThemeWindowBackgroundColor;
PhThemeWindowBackgroundColor = PhGetIntegerSetting(L"ThemeWindowBackgroundColor");
PhThemeWindowBackground2Color = PhGetIntegerSetting(L"ThemeWindowBackground2Color");
PhThemeWindowHighlightColor = PhGetIntegerSetting(L"ThemeWindowHighlightColor");
PhThemeWindowHighlight2Color = PhGetIntegerSetting(L"ThemeWindowHighlight2Color");
PhThemeWindowTextColor = PhGetIntegerSetting(L"ThemeWindowTextColor");
PhEnableThemeListviewBorder = !!PhGetIntegerSetting(L"TreeListBorderEnable");
+ PhEnableThemeNativeButtons = !!PhGetIntegerSetting(L"EnableThemeNativeButtons");
+ PhEnableThemeTabBorders = !!PhGetIntegerSetting(L"EnableThemeTabBorders");
+ PhEnableThemeAcrylicSupport = WindowsVersion >= WINDOWS_11 && !!PhGetIntegerSetting(L"EnableThemeAcrylicSupport");
+ PhEnableThemeAcrylicWindowSupport = WindowsVersion >= WINDOWS_11 && !!PhGetIntegerSetting(L"EnableThemeAcrylicWindowSupport");
+ PhEnableStreamerMode = !!PhGetIntegerSetting(L"EnableStreamerMode");
+
+ PH_THEME_SET_PREFFEREDAPPMODE(L"EnableThemeSupport", L"EnableThemeUseWindowsTheme");
+
+ PhEnableThemeSupport = PH_THEME_GET_GENERAL_SWITCH(L"EnableThemeSupport");
+ PhEnableThemeAcrylicWindowSupport = PhEnableThemeAcrylicWindowSupport && PhEnableThemeSupport && PhIsThemeTransparencyEnabled();
+
+ if (oldPhThemeWindowBackgroundColor != PhThemeWindowBackgroundColor && PhThemeWindowBackgroundBrush)
+ {
+ DeleteBrush(PhThemeWindowBackgroundBrush);
+ PhThemeWindowBackgroundBrush = CreateSolidBrush(PhThemeWindowBackgroundColor);
+ }
}
VOID PvInitializeSettings(
diff --git a/tools/peview/streams.c b/tools/peview/streams.c
index 3bbc01da3a09..a8274a506440 100644
--- a/tools/peview/streams.c
+++ b/tools/peview/streams.c
@@ -205,7 +205,7 @@ INT_PTR CALLBACK PvpPeStreamsDlgProc(
PvpPeEnumerateFileStreams(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/strings.c b/tools/peview/strings.c
index 2c4f871dec66..7f8e90a13cee 100644
--- a/tools/peview/strings.c
+++ b/tools/peview/strings.c
@@ -765,7 +765,7 @@ INT_PTR CALLBACK PvpStringsMinimumLengthDlgProc(
PhSetDialogItemText(hwndDlg, IDC_MINIMUMLENGTH, lengthString);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
@@ -880,7 +880,7 @@ INT_PTR CALLBACK PvStringsDlgProc(
PvpSearchStrings(context);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/tlsprp.c b/tools/peview/tlsprp.c
index acf8c2241ca5..2f3582cbe581 100644
--- a/tools/peview/tlsprp.c
+++ b/tools/peview/tlsprp.c
@@ -124,7 +124,7 @@ INT_PTR CALLBACK PvpPeTlsDlgProc(
PvpPeEnumerateTlsCallbacks(context->ListViewHandle);
//ExtendedListView_SortItems(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/versioninfoprp.c b/tools/peview/versioninfoprp.c
index 6bcb98af5085..57589b9fd27d 100644
--- a/tools/peview/versioninfoprp.c
+++ b/tools/peview/versioninfoprp.c
@@ -358,7 +358,7 @@ INT_PTR CALLBACK PvpPeVersionInfoDlgProc(
PvEnumVersionInfo(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY:
diff --git a/tools/peview/volatileprp.c b/tools/peview/volatileprp.c
index 85d3fb78a304..44163ac0241f 100644
--- a/tools/peview/volatileprp.c
+++ b/tools/peview/volatileprp.c
@@ -194,7 +194,7 @@ INT_PTR CALLBACK PvpPeVolatileDlgProc(
PhAddListViewGroup(context->ListViewHandle, 1, L"Volatile RVA Table");
PvEnumerateVolatileEntries(context->ListViewHandle);
- PhInitializeWindowTheme(hwndDlg, PhEnableThemeSupport);
+ PhInitializeWindowTheme(hwndDlg);
}
break;
case WM_DESTROY: