Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1241 lines
38 KiB

  1. /*
  2. * tweakui.h
  3. */
  4. /* WHEN CHANGING PRERELEASE - Rebuild expire.c, change tweakui.rcv */
  5. /* #define PRERELEASE 6 /* REMOVE THIS FOR FINAL BUILD */
  6. /* #define PUBLIC_PRERELEASE 1 /* REMOVE THIS FOR FINAL BUILD */
  7. /* Translate between NT and Win9x build environments */
  8. #if DBG
  9. #define DEBUG 1
  10. #endif
  11. /* NT RTL functions */
  12. #include <nt.h>
  13. #include <ntrtl.h>
  14. #include <ntlsa.h>
  15. #include <nturtl.h>
  16. #ifndef STRICT
  17. #define STRICT
  18. #endif
  19. #ifndef WIN32_LEAN_AND_MEAN /* build.exe will define it for us on NT */
  20. #define WIN32_LEAN_AND_MEAN
  21. #endif
  22. #undef WINVER /* build process defines this */
  23. #define WINVER 0x0400 /* Windows 95 compatible */
  24. #define _WIN32_WINDOWS 0x0400 /* Windows 95 compatible */
  25. #include <windows.h> /* Everybody's favourite */
  26. #ifndef RC_INVOKED
  27. #include <windowsx.h> /* Message crackers */
  28. typedef const BYTE FAR *LPCBYTE; /* Mysteriously missing from Win32 */
  29. #include <shellapi.h>
  30. #include <shlobj.h>
  31. #include <regstr.h> /* REGSTR_PATH_DESKTOP */
  32. #include <commdlg.h>
  33. #include <cpl.h> /* Control panel interface */
  34. #include <shlwapi.h> /* DLLVERSIONINFO */
  35. #endif /* !RC_INVOKED */
  36. #include <commctrl.h> /* For trackbar and imagelist */
  37. #include <prsht.h> /* Property sheet stuff */
  38. #ifdef WINNT
  39. #include <winuserp.h>
  40. #endif
  41. #undef IDH_OK
  42. #undef IDH_CANCEL
  43. #include "tweakhlp.h"
  44. #include "strings.h"
  45. /*
  46. * DIDC - delta in IDC
  47. *
  48. * didcEdit - the edit control in charge
  49. * didcUd - the updown control that is associated with it
  50. */
  51. #define didcEdit 0
  52. #define didcUd 1
  53. /*
  54. * Dialog boxes and controls.
  55. */
  56. #define IDD_GENERAL 1
  57. #define IDD_EXPLORER 2
  58. #define IDD_DESKTOP 3
  59. #define IDD_TOOLS 4
  60. #define IDD_ADDREMOVE 5
  61. #define IDD_BOOT 6
  62. #define IDD_REPAIR 7
  63. #define IDD_PARANOIA 8
  64. #define IDD_MYCOMP 9
  65. #define IDD_MOUSE 10
  66. #define IDD_NETWORK 11
  67. #define IDD_IE4 12
  68. #define IDD_CONTROL 13
  69. #define IDD_CMD 14
  70. #define IDD_COMDLG32 15
  71. #define MAX_TWEAKUIPAGES 21
  72. #define IDD_PICKICON 32
  73. #define IDD_UNINSTALLEDIT 33
  74. #define IDD_SEARCHURL 34
  75. #ifdef PRERELEASE
  76. #define IDD_BETAPASSWORD 64
  77. #endif
  78. /*
  79. * Common to multiple
  80. */
  81. #define IDC_WHATSTHIS 26 /* Display context help */
  82. #define IDC_LVDELETE 27 /* Items can be deleted from LV */
  83. #define IDC_LVTOGGLE 28 /* Toggle the state of the current LV item */
  84. #define IDC_LVRENAME 29 /* Renaming the current LV item */
  85. #define IDC_LISTVIEW 30 /* The listview goes here */
  86. #define IDC_RESET 31
  87. /*
  88. * IDD_MOUSE
  89. */
  90. #define IDC_SPEEDTEXT 32
  91. #define IDC_SPEEDFAST 33
  92. #define IDC_SPEEDSLOW 34
  93. #define IDC_SPEEDTRACK 35
  94. #define IDC_SPEEDHELP 36
  95. #define IDC_SENSGROUP 37
  96. #define IDC_DBLCLKTEXT 38
  97. #define IDC_DBLCLK 39
  98. #define IDC_DBLCLKUD 40 /* IDC_DBLCLK + didcUd */
  99. #define IDC_DRAGTEXT 41
  100. #define IDC_DRAG 42
  101. #define IDC_DRAGUD 43 /* IDC_DRAG + didcUd */
  102. #define IDC_SENSHELP 44
  103. //#define IDC_BUGREPORT 45
  104. #define IDC_TESTGROUP 46
  105. #define IDC_TEST 47
  106. #define IDC_TIPS 48
  107. #define IDC_WHEELFIRST 49
  108. #define IDC_WHEELGROUP 49
  109. #define IDC_WHEELENABLE 50
  110. #define IDC_WHEELPAGE 51
  111. #define IDC_WHEELLINE 52
  112. #define IDC_WHEELLINENO 53
  113. #define IDC_WHEELLINEUD 54 /* IDC_WHEELLINENO + didcUd */
  114. #define IDC_WHEELLINESTXT 55
  115. #define IDC_WHEELLAST 55
  116. #define IDC_XMOUSEFIRST 56
  117. #define IDC_XMOUSEGROUP 56
  118. #define IDC_XMOUSE 57
  119. #define IDC_XMOUSERAISE 58
  120. #define IDC_XMOUSEDELAYTXT 59
  121. #define IDC_XMOUSEDELAY 60
  122. #define IDC_XMOUSELAST 60
  123. /*
  124. * IDD_GENERAL
  125. */
  126. #define IDC_EFFECTGROUP 38
  127. #define IDC_ANIMATE 39
  128. #define IDC_SMOOTHSCROLL 40
  129. #define IDC_BEEP 41
  130. #define IDC_IE3FIRST 42
  131. #define IDC_IE3GROUP 42
  132. #define IDC_IE3TXT 43
  133. #define IDC_IE3ENGINETXT 44
  134. #define IDC_IE3ENGINE 45
  135. #define IDC_IE3LAST 45
  136. #define IDC_RUDEFIRST 46
  137. #define IDC_RUDEGROUP 46
  138. #define IDC_RUDE 47
  139. #define IDC_RUDEFLASHFIRST 48
  140. #define IDC_RUDEFLASHINFINITE 48
  141. #define IDC_RUDEFLASHFINITE 49
  142. #define IDC_RUDEFLASHCOUNT 50
  143. #define IDC_RUDEFLASHUD 51
  144. #define IDC_RUDEFLASHTXT 52
  145. #define IDC_RUDEFLASHLAST 52
  146. #define IDC_RUDELAST 52
  147. /*
  148. * IDD_EXPLORER
  149. */
  150. #define IDC_LINKGROUP 32
  151. #define IDC_LINKFIRST 33
  152. #define IDC_LINKARROW 33 /* These need to be adjacent */
  153. #define IDC_LIGHTARROW 34
  154. #define IDC_NOARROW 35
  155. #define IDC_CUSTOMARROW 36
  156. #define IDC_LINKBEFORETEXT 37
  157. #define IDC_LINKBEFORE 38
  158. #define IDC_LINKAFTERTEXT 39
  159. #define IDC_LINKAFTER 40
  160. #define IDC_LINKHELP 41
  161. #define IDC_LINKLAST 41
  162. #define IDC_SETGROUP 45
  163. #define IDC_CLRGROUP 48
  164. #define IDC_COMPRESSFIRST 49
  165. #define IDC_COMPRESSTXT 49
  166. #define IDC_COMPRESSCLR 50
  167. #define IDC_COMPRESSBTN 51
  168. #define IDC_COMPRESSLAST 51
  169. #define IDC_HOTTRACKFIRST 52
  170. #define IDC_HOTTRACKTXT 52
  171. #define IDC_HOTTRACKCLR 53
  172. #define IDC_HOTTRACKBTN 54
  173. #define IDC_HOTTRACKLAST 54
  174. #define IDC_CUSTOMCHANGE 55
  175. /*
  176. * IDD_DESKTOP
  177. */
  178. #define IDC_ICONLV IDC_LISTVIEW
  179. #define IDC_ICONLVTEXT 32
  180. #define IDC_ICONLVTEXT2 33
  181. #define IDC_UNUSED34 34
  182. #define IDC_CREATENOWTEXT 35
  183. #define IDC_CREATENOW 36
  184. #define IDC_SHOWONDESKTOP 37
  185. #define IDC_ENUMFIRSTTEXT 38
  186. #define IDC_ENUMFIRST 39
  187. #if 0
  188. #define IDC_RENAMELV 38
  189. #endif
  190. /*
  191. * IDD_MYCOMP: IDD_DESKTOP plus...
  192. */
  193. #define IDC_FLDGROUP 42
  194. #define IDC_FLDNAMETXT 43
  195. #define IDC_FLDNAMELIST 44
  196. #define IDC_FLDLOCTXT 45
  197. #define IDC_FLDLOC 46
  198. #define IDC_FLDCHG 47
  199. /*
  200. * IDD_NETWORK
  201. */
  202. /*efine IDC_LOGONGROUP 32 UNUSED */
  203. #define IDC_LOGONAUTO 33
  204. #define IDC_LOGONUSERTXT 34
  205. #define IDC_LOGONUSER 35
  206. #define IDC_LOGONPASSTXT 36
  207. #define IDC_LOGONPASS 37
  208. #define IDC_LOGONPASSUNSAFE 38
  209. #define IDC_LOGONSHUTDOWN 39
  210. /*
  211. * IDD_TOOLS
  212. */
  213. #define IDC_TEMPLATE IDC_LISTVIEW
  214. #define IDC_TEMPLATETEXT 33
  215. /*
  216. * IDD_ADDREMOVE
  217. */
  218. #define IDC_UNINSTALL IDC_LISTVIEW
  219. #define IDC_UNINSTALLTEXT 32
  220. #define IDC_UNINSTALLEDIT 33
  221. #define IDC_UNINSTALLNEW 35
  222. #define IDC_UNINSTALLCHECK 36
  223. /*
  224. * IDD_BOOT
  225. */
  226. #define IDC_BOOTGROUP1 32
  227. #define IDC_BOOTKEYS 33
  228. #define IDC_BOOTDELAYTEXT 34
  229. #define IDC_BOOTDELAY 35
  230. #define IDC_BOOTDELAYUD 36
  231. #define IDC_BOOTDELAYTEXT2 37
  232. #define IDC_BOOTGUI 38
  233. #define IDC_LOGO 39
  234. #define IDC_BOOTMULTI 40
  235. #define IDC_BOOTMENUGROUP 41
  236. #define IDC_BOOTMENU 42
  237. //#define IDC_BOOTMENUDEFAULT xx
  238. #define IDC_BOOTMENUDELAYTEXT 43
  239. #define IDC_BOOTMENUDELAY 44
  240. #define IDC_BOOTMENUDELAYUD 45
  241. #define IDC_BOOTMENUDELAYTEXT2 47
  242. #define IDC_SCANDISK 48
  243. #define IDC_SCANDISKTEXT 49
  244. /*
  245. * IDD_REPAIR
  246. */
  247. #define IDC_REPAIRCOMBO 64
  248. #define IDC_REPAIRNOW 65
  249. #define IDC_REPAIRHELP 66
  250. #define IDC_REPAIRTEXT 67
  251. #define IDC_REPAIRICON 68
  252. /*
  253. * IDD_PARANOIA
  254. */
  255. #define IDC_CLEARGROUP 32
  256. #define IDC_CLEARNOW 37
  257. #define IDC_CDROMGROUP 38
  258. #define IDC_CDROMAUDIO 39
  259. #define IDC_CDROMDATA 40
  260. #define IDC_PARANOIA95ONLYMIN IDC_FAULTLOGGROUP
  261. #define IDC_FAULTLOGGROUP 41
  262. #define IDC_FAULTLOG 42
  263. #define IDC_PARANOIA95ONLYMAX 43
  264. /*
  265. * IDD_IE4
  266. */
  267. #define IDC_SETTINGSGROUP 32
  268. /*
  269. * IDD_CMD
  270. */
  271. #define IDC_COMPLETIONGROUP 32
  272. #define IDC_FILECOMPTXT 33
  273. #define IDC_DIRCOMPTXT 34
  274. #define IDC_FILECOMP 35
  275. #define IDC_DIRCOMP 36
  276. #define IDC_WORDDELIM 37
  277. /*
  278. * IDD_COMDLG32
  279. */
  280. #define IDC_SHOWBACK 32
  281. #define IDC_FILEMRU 33
  282. #define IDC_PLACESGROUP 34
  283. #define IDC_PLACESDEF 35
  284. #define IDC_PLACESHIDE 36
  285. #define IDC_PLACESCUSTOM 37
  286. #define IDC_PLACE0 38
  287. // IDC_PLACE1 39
  288. // IDC_PLACE2 40
  289. // IDC_PLACE3 41
  290. // IDC_PLACE4 42
  291. /*
  292. * IDD_PICKICON
  293. */
  294. #define IDC_PICKPATH 32
  295. #define IDC_PICKICON 33
  296. #define IDC_PICKBROWSE 34
  297. /*
  298. * IDD_UNINSTALLEDIT
  299. */
  300. #define IDC_UNINSTALLDESCTEXT 32
  301. #define IDC_UNINSTALLDESC 33
  302. #define IDC_UNINSTALLCMDTEXT 34
  303. #define IDC_UNINSTALLCMD 35
  304. /*
  305. * IDD_SEARCHURL
  306. */
  307. #define IDC_SEARCHURL 32
  308. /*
  309. * Menus
  310. */
  311. #define IDM_MAIN 1
  312. /*
  313. * Bitmaps
  314. */
  315. #define IDB_CHECK 1
  316. /*
  317. * Strings
  318. */
  319. #define IDS_NAME 1
  320. #define IDS_DESCRIPTION 2
  321. #define IDS_ALLFILES 3
  322. #define IDS_BADEXT 4
  323. #define IDS_COPYFAIL 5
  324. #define IDS_REGFAIL 6
  325. #define IDS_CONFIRMNEWTEMPLATE 7
  326. #define IDS_TOOMANY 8
  327. #define IDS_CANNOTTEMPLATE 9
  328. #define IDS_NETHOOD 10
  329. #define IDS_LOGONOFF 11
  330. #define IDS_ERRMSDOSSYS 12
  331. /*
  332. * Scandisk strings.
  333. */
  334. #define IDS_SCANDISKFIRST 13
  335. #define IDS_SCANDISKNEVER 13
  336. #define IDS_SCANDISKPROMPT 14
  337. #define IDS_SCANDISKALWAYS 15
  338. #ifdef BOOTMENUDEFAULT
  339. #define IDS_BOOTMENU xx
  340. #define IDS_BOOTMENULOGGED 14
  341. #define IDS_BOOTMENUSAFE 15
  342. #define IDS_BOOTMENUSAFENET 16
  343. #define IDS_BOOTMENUSTEP 17
  344. #define IDS_BOOTMENUCMD 18
  345. #define IDS_BOOTMENUSAFECMD 19
  346. #define IDS_BOOTMENUPREV 20
  347. #define IDS_BOOTMENULAST 20
  348. #endif
  349. #define IDS_DESKTOPRESETOK 21
  350. #define IDS_ICONFILES 22
  351. #define IDS_NOTHINGTOCLEAR 23
  352. #define IDS_BADRUN 24
  353. #define IDS_CANTINSTALL 25
  354. #define IDS_NONETHOOD 26
  355. #define IDS_ADDRMWARN 27
  356. #define IDS_FIXED 28
  357. #define IDS_TEMPLATEDELETEWARN 29
  358. #define IDS_MAYBEREBOOT 30
  359. #define IDS_ICONSREBUILT 31
  360. #define IDS_RESTRICTED 32
  361. #define IDS_ASKREPAIRADDRM 33
  362. #define IDS_WARNFOLDERCHANGE 34
  363. #define IDS_REORDERDESKTOP 35
  364. #define IDS_REPAIRLOGONOFF 36
  365. #define IDS_NONE 37
  366. //#define IDS_CWD 38
  367. #define IDS_FOLDER_PATTERN 95
  368. #define IDS_ENGINE 160 /* 160 .. 191 */
  369. #define IDS_URL 192 /* 192 .. 223 */
  370. #define IDS_PARANOIA 224 /* 224 .. 255 */
  371. #define IDS_GENERALEFFECTS 256 /* 256 .. 287 */
  372. #define IDS_CPL_BORING 288 /* 288 .. 319 */
  373. #define IDS_CPL_ADDRM 289 /* Add/Remove Programs */
  374. #define IDS_CPL_DESK 290 /* Desktop settings */
  375. #define IDS_CPL_INTL 291 /* Regional settings */
  376. #define IDS_CPL_MAIN 292 /* Mouse, Keyboard, PCMCIA, etc. */
  377. #define IDS_CPL_TIMEDATE 293 /* Time/Date */
  378. #define IDS_REPAIR 320 /* 320 .. 351 */
  379. #define IDS_REPAIRHELP 352 /* 352 .. 383 */
  380. #define IDS_COMPLETION 384 /* 384 .. 415 */
  381. #define IDS_IE4 416 /* 416 .. 479 */
  382. #define IDS_EXPLOREREFFECTS 480 /* 480 .. 511 */
  383. /* WARNING! These must match the CSIDL values! */
  384. #define IDS_FOLDER_BASE 1024
  385. #define IDS_FOLDER_DESKTOPFOLDER (IDS_FOLDER_BASE + 0x0000)
  386. #define IDS_FOLDER_PROGRAMS (IDS_FOLDER_BASE + 0x0002)
  387. #define IDS_FOLDER_PERSONAL (IDS_FOLDER_BASE + 0x0005)
  388. #define IDS_FOLDER_FAVORITES (IDS_FOLDER_BASE + 0x0006)
  389. #define IDS_FOLDER_STARTUP (IDS_FOLDER_BASE + 0x0007)
  390. #define IDS_FOLDER_RECENT (IDS_FOLDER_BASE + 0x0008)
  391. #define IDS_FOLDER_SENDTO (IDS_FOLDER_BASE + 0x0009)
  392. #define IDS_FOLDER_STARTMENU (IDS_FOLDER_BASE + 0x000B)
  393. #define IDS_FOLDER_MYMUSIC (IDS_FOLDER_BASE + 0x000D)
  394. #define IDS_FOLDER_MYVIDEO (IDS_FOLDER_BASE + 0x000E)
  395. #define IDS_FOLDER_DESKTOP (IDS_FOLDER_BASE + 0x0010)
  396. #define IDS_FOLDER_DRIVES (IDS_FOLDER_BASE + 0x0011)
  397. #define IDS_FOLDER_NETWORK (IDS_FOLDER_BASE + 0x0012)
  398. #define IDS_FOLDER_TEMPLATES (IDS_FOLDER_BASE + 0x0015)
  399. #define IDS_FOLDER_HISTORY (IDS_FOLDER_BASE + 0x0022)
  400. #define IDS_FOLDER_PROGRAMFILES (IDS_FOLDER_BASE + 0x0026)
  401. #define IDS_FOLDER_MYPICTURES (IDS_FOLDER_BASE + 0x0027)
  402. #define IDS_FOLDER_COMMONFILES (IDS_FOLDER_BASE + 0x002B)
  403. #define IDS_FOLDER_SOURCEPATH (IDS_FOLDER_BASE + 0x0018)
  404. #define IDS_DEFAULT_BASE 1280
  405. #define IDS_DEFAULT_PROGRAMS (IDS_DEFAULT_BASE + 0x0002)
  406. #define IDS_DEFAULT_PERSONAL (IDS_DEFAULT_BASE + 0x0005)
  407. #define IDS_DEFAULT_FAVORITES (IDS_DEFAULT_BASE + 0x0006)
  408. #define IDS_DEFAULT_STARTUP (IDS_DEFAULT_BASE + 0x0007)
  409. #define IDS_DEFAULT_RECENT (IDS_DEFAULT_BASE + 0x0008)
  410. #define IDS_DEFAULT_SENDTO (IDS_DEFAULT_BASE + 0x0009)
  411. #define IDS_DEFAULT_STARTMENU (IDS_DEFAULT_BASE + 0x000B)
  412. #define IDS_DEFAULT_MYMUSIC (IDS_DEFAULT_BASE + 0x000D)
  413. #define IDS_DEFAULT_MYVIDEO (IDS_DEFAULT_BASE + 0x000E)
  414. #define IDS_DEFAULT_DESKTOP (IDS_DEFAULT_BASE + 0x0010)
  415. #define IDS_DEFAULT_TEMPLATES (IDS_DEFAULT_BASE + 0x0015)
  416. #define IDS_DEFAULT_MYPICTURES (IDS_DEFAULT_BASE + 0x0027)
  417. /*
  418. * Icons
  419. */
  420. #define IDI_DEFAULT 1
  421. #define IDI_GEAR1 2
  422. #define IDI_ALTLINK 3 /* This must remain number 3 */
  423. #define IDI_BLANK 4 /* This must remain number 4 */
  424. #define IDI_GEAR2 5
  425. /*
  426. * Binary
  427. */
  428. #define IDX_SETUP 1 /* Tiny Win16 setup.exe */
  429. #define IDX_FONTFOLDER 2 /* desktop.ini for Font Folder */
  430. #define IDX_TEMPINET 3 /* desktop.ini for Temporary Internet Files */
  431. #define IDX_HISTORY 4 /* desktop.ini for History */
  432. #define IDX_RECYCLE 5 /* desktop.ini for Recycle Bin */
  433. #ifndef RC_INVOKED
  434. /*****************************************************************************
  435. *
  436. * Thinks that depend on which header files you are using.
  437. *
  438. *****************************************************************************/
  439. #ifndef SM_MOUSEWHEELPRESENT
  440. #define SM_MOUSEWHEELPRESENT 75
  441. #define SPI_GETWHEELSCROLLLINES 104
  442. #define SPI_SETWHEELSCROLLLINES 105
  443. #endif
  444. #ifndef SPI_GETMENUSHOWDELAY
  445. #define SPI_GETMENUSHOWDELAY 106
  446. #define SPI_SETMENUSHOWDELAY 107
  447. #endif
  448. #ifndef SPI_GETUSERPREFERENCE
  449. #define SPI_GETUSERPREFERENCE 108
  450. #define SPI_SETUSERPREFERENCE 109
  451. #define SPI_UP_ACTIVEWINDOWTRACKING 0
  452. #endif
  453. #ifndef SPI_GETACTIVEWINDOWTRACKING
  454. #define SPI_GETACTIVEWINDOWTRACKING 0x1000
  455. #define SPI_SETACTIVEWINDOWTRACKING 0x1001
  456. #define SPI_GETMENUANIMATION 0x1002
  457. #define SPI_SETMENUANIMATION 0x1003
  458. #define SPI_GETCOMBOBOXANIMATION 0x1004
  459. #define SPI_SETCOMBOBOXANIMATION 0x1005
  460. #define SPI_GETLISTBOXSMOOTHSCROLLING 0x1006
  461. #define SPI_SETLISTBOXSMOOTHSCROLLING 0x1007
  462. #define SPI_GETGRADIENTCAPTIONS 0x1008
  463. #define SPI_SETGRADIENTCAPTIONS 0x1009
  464. #define SPI_GETKEYBOARDCUES 0x100A
  465. #define SPI_SETKEYBOARDCUES 0x100B
  466. #define SPI_GETACTIVEWNDTRKZORDER 0x100C
  467. #define SPI_SETACTIVEWNDTRKZORDER 0x100D
  468. #define SPI_GETHOTTRACKING 0x100E
  469. #define SPI_SETHOTTRACKING 0x100F
  470. #define SPI_GETMENUFADE 0x1012
  471. #define SPI_SETMENUFADE 0x1013
  472. #define SPI_GETSELECTIONFADE 0x1014
  473. #define SPI_SETSELECTIONFADE 0x1015
  474. #define SPI_GETTOOLTIPANIMATION 0x1016
  475. #define SPI_SETTOOLTIPANIMATION 0x1017
  476. #define SPI_GETTOOLTIPFADE 0x1018
  477. #define SPI_SETTOOLTIPFADE 0x1019
  478. #define SPI_GETCURSORSHADOW 0x101A
  479. #define SPI_SETCURSORSHADOW 0x101B
  480. #define SPI_GETFOREGROUNDLOCKTIMEOUT 0x2000
  481. #define SPI_SETFOREGROUNDLOCKTIMEOUT 0x2001
  482. #define SPI_GETACTIVEWNDTRKTIMEOUT 0x2002
  483. #define SPI_SETACTIVEWNDTRKTIMEOUT 0x2003
  484. #define SPI_GETFOREGROUNDFLASHCOUNT 0x2004
  485. #define SPI_SETFOREGROUNDFLASHCOUNT 0x2005
  486. #endif
  487. #ifndef COLOR_HOTLIGHT
  488. #define COLOR_HOTLIGHT 26
  489. #endif
  490. #ifndef WHEEL_PAGESCROLL
  491. #define WHEEL_PAGESCROLL ((UINT)-1)
  492. #endif
  493. #ifndef UINT_MAX
  494. #define UINT_MAX ((UINT)-1)
  495. #endif
  496. /*****************************************************************************
  497. *
  498. * I'm getting tired of writing these out the long way.
  499. *
  500. *****************************************************************************/
  501. typedef UNALIGNED struct _ITEMIDLIST FAR *PIDL;
  502. typedef LPSHELLFOLDER PSF;
  503. typedef HIMAGELIST HIML;
  504. typedef TCHAR TCH;
  505. typedef const TCH *PCTSTR;
  506. typedef LPVOID PV, *PPV;
  507. typedef LPUNKNOWN PUNK;
  508. #define hkLM HKEY_LOCAL_MACHINE
  509. #define hkCU HKEY_CURRENT_USER
  510. #define hkCR HKEY_CLASSES_ROOT
  511. /*****************************************************************************
  512. *
  513. * Goofy macros
  514. *
  515. *****************************************************************************/
  516. #ifdef WIN32
  517. #define EXPORT
  518. #define CODESEG
  519. #define BEGIN_CONST_DATA data_seg(".text", "CODE")
  520. #define END_CONST_DATA data_seg(".data", "DATA")
  521. #else
  522. #define EXPORT _loadds _far _pascal
  523. #define CODESEG __based(__segname("_TEXT"))
  524. #define BEGIN_CONST_DATA
  525. #define END_CONST_DATA
  526. #endif
  527. #define INLINE static __inline
  528. #define ConstString(nm, v) const TCH CODESEG nm[] = TEXT(v)
  529. #define ConstString2(nm, v1, v2) const TCH CODESEG nm[] = TEXT(v1) TEXT(v2)
  530. #define ExternConstString(nm) extern const TCH CODESEG nm[]
  531. /*****************************************************************************
  532. *
  533. * Baggage I carry everywhere
  534. *
  535. *****************************************************************************/
  536. #define cbX(x) sizeof(x)
  537. #define cA(a) (sizeof(a)/sizeof(a[0]))
  538. #define cbCtch(ctch) ((ctch) * sizeof(TCH))
  539. /*
  540. * lor -- Logical or. Evaluate the first. If the first is nonzero,
  541. * return it. Otherwise, return the second.
  542. *
  543. * Unfortunately, due to the limitations of the C language, this can
  544. * be implemented only with a GNU extension. In the non-GNU case,
  545. * we return 1 if the first is nonzero.
  546. */
  547. #if defined(__GNUC__)
  548. #define fLorFF(f1, f2) ({ typeof (f1) _f = f1; if (!_f) _f = f2; _f; })
  549. #else
  550. #define fLorFF(f1, f2) ((f1) ? 1 : (f2))
  551. #endif
  552. /*
  553. * limp - logical implication. True unless the first is nonzero and
  554. * the second is zero.
  555. */
  556. #define fLimpFF(f1, f2) fLorFF(!(f1), f2)
  557. /*****************************************************************************
  558. *
  559. * Common dialog wrappers
  560. *
  561. *****************************************************************************/
  562. typedef struct COFN { /* common open file name */
  563. OPENFILENAME ofn; /* The thing COMMDLG wants */
  564. TCH tsz[MAX_PATH]; /* Where we build the name */
  565. TCH tszFilter[100]; /* File open/save filter */
  566. } COFN, *PCOFN;
  567. void PASCAL InitOpenFileName(HWND hwnd, PCOFN pcofn, UINT ids, LPCSTR pszInit);
  568. /*****************************************************************************
  569. *
  570. * Private stuff
  571. *
  572. *****************************************************************************/
  573. #define iErr (-1)
  574. int PASCAL iFromPtsz(LPTSTR ptsz);
  575. LPTSTR PASCAL ptszStrChr(PCTSTR ptsz, TCH tch);
  576. PTSTR PASCAL ptszStrRChr(PCTSTR ptsz, TCH tch);
  577. HRESULT PASCAL Ole_Init(void);
  578. void PASCAL Ole_Term(void);
  579. void PASCAL Ole_Free(LPVOID pv);
  580. #define Ole_Release(p) (p)->Release()
  581. BOOL PASCAL Ole_ClsidFromString(LPCTSTR lpsz, LPCLSID pclsid);
  582. #ifdef UNICODE
  583. int PASCAL Ole_FromUnicode(LPSTR psz, LPOLESTR lpos);
  584. #define UnicodeFromPtsz(wsz, ptsz) LPCWSTR wsz = ptsz
  585. #define AnsiFromPtsz(sz, ptsz) CHAR sz[MAX_PATH]; Ole_FromUnicode(sz, ptsz)
  586. #else /* ANSI */
  587. int PASCAL Ole_ToUnicode(LPOLESTR lpos, LPCSTR psz);
  588. #define UnicodeFromPtsz(wsz, ptsz) WCHAR wsz[MAX_PATH]; Ole_ToUnicode(wsz, ptsz)
  589. #define AnsiFromPtsz(sz, ptsz) LPCSTR sz = ptsz
  590. #endif
  591. BOOL PASCAL SetRestriction(LPCTSTR ptszKey, BOOL f);
  592. BOOL PASCAL GetRestriction(LPCTSTR ptszKey);
  593. PIDL PASCAL pidlFromPath(PSF psf, LPCSTR cqn);
  594. PIDL PASCAL pidlSimpleFromPath(LPCSTR cqn);
  595. HRESULT PASCAL SetNameOfPidl(PSF psf, PIDL pidl, LPCSTR pszName);
  596. HRESULT PASCAL ComparePidls(PIDL pidl1, PIDL pidl2);
  597. HIML PASCAL GetSystemImageList(DWORD dw);
  598. STDAPI_(void) ChangeNotifyCsidl(HWND hwnd, int csidl, LONG eventId);
  599. BOOL PASCAL WithPidl(PSF psf, LPCSTR lqn, BOOL (*pfn)(PIDL, LPVOID), LPVOID pv);
  600. BOOL PASCAL WithPsf(PSF psf, PIDL pidl, BOOL (*pfn)(PSF, LPVOID), LPVOID pv);
  601. BOOL PASCAL EmptyDirectory(LPCSTR pszDir, BOOL (*pfn)(LPCSTR, LPVOID), PV pv);
  602. BOOL PASCAL WithTempDirectory(BOOL (*pfn)(LPCSTR, LPVOID), LPVOID pv);
  603. INT_PTR EXPORT General_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  604. INT_PTR EXPORT Mouse_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  605. INT_PTR EXPORT Explorer_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  606. INT_PTR EXPORT Desktop_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  607. INT_PTR EXPORT MyComp_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  608. INT_PTR EXPORT Network_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  609. INT_PTR EXPORT Template_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  610. INT_PTR EXPORT AddRm_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  611. INT_PTR EXPORT Boot_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  612. INT_PTR EXPORT Repair_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  613. INT_PTR EXPORT Paranoia_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  614. INT_PTR EXPORT IE4_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  615. INT_PTR EXPORT Control_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  616. INT_PTR EXPORT Cmd_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  617. INT_PTR EXPORT Comdlg32_DlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  618. void PASCAL Boot_FindMsdosSys(void);
  619. BOOL PASCAL fCreateNil(LPCSTR cqn);
  620. BOOL PASCAL Link_GetShortcutTo(void);
  621. BOOL PASCAL Link_SetShortcutTo(BOOL f);
  622. void PASCAL Explorer_HackPtui(void);
  623. int PASCAL Explorer_GetIconSpecFromRegistry(LPTSTR ptszBuf);
  624. void PASCAL Paranoia_CoverTracks(void);
  625. INT_PTR PickIcon(HWND, LPSTR, UINT, int *);
  626. int PASCAL MessageBoxId(HWND hwnd, UINT id, LPCSTR pszTitle, UINT fl);
  627. PTSTR PASCAL TweakUi_TrimTrailingBs(LPTSTR ptsz);
  628. typedef BOOL (PASCAL *WITHPROC)(LPVOID pv, LPVOID pvRef);
  629. BOOL PASCAL WithSelector(DWORD_PTR lib, UINT cb, WITHPROC wp, LPVOID pvRef,
  630. BOOL fWrite);
  631. HICON PASCAL LoadIconId(UINT id);
  632. void PASCAL SafeDestroyIcon(HICON hicon);
  633. /*****************************************************************************
  634. *
  635. * Path stuff
  636. *
  637. *****************************************************************************/
  638. int PASCAL ParseIconSpec(LPTSTR ptszSrc);
  639. LPTSTR PASCAL ptszFilenameCqn(PCTSTR cqn);
  640. void Path_Append(LPTSTR ptszDir, LPCTSTR ptszFile);
  641. /*****************************************************************************
  642. *
  643. * common.c
  644. *
  645. * Common property sheet handling.
  646. *
  647. *****************************************************************************/
  648. void PASCAL Common_SetDirty(HWND hdlg);
  649. #define Common_SetClean(hdlg)
  650. void PASCAL Common_NeedLogoff(HWND hdlg);
  651. void PASCAL Common_OnHelp(LPARAM lp, const DWORD CODESEG *pdwHelp);
  652. void PASCAL Common_OnContextMenu(WPARAM wparam, const DWORD CODESEG *pdwHelp);
  653. typedef HMENU (PASCAL *CMCALLBACK)(HWND hwnd, int iItem);
  654. void PASCAL Common_LV_OnContextMenu(HWND hdlg, HWND hwnd, LPARAM lp,
  655. CMCALLBACK pfn, const DWORD CODESEG *pdwHelp);
  656. typedef struct LVCI { /* common listview command info */
  657. int id; /* command identifier */
  658. void (PASCAL *pfn)(HWND hwnd, int iItem); /* command handler */
  659. } LVCI, *PLVCI;
  660. void PASCAL Common_OnLvCommand(HWND hdlg, int idCmd, PLVCI rglvci, int clvci);
  661. void NEAR PASCAL EnableDlgItem(HWND hdlg, UINT idc, BOOL f);
  662. void NEAR PASCAL EnableDlgItems(HWND hdlg, UINT idcFirst, UINT idcLast, BOOL f);
  663. void NEAR PASCAL SetDlgItemTextLimit(HWND hdlg, UINT id, LPCTSTR ptsz, UINT ctch);
  664. #define ADI_DISABLE 0x0001
  665. #define ADI_ENABLE 0x0002
  666. #define ADI_HIDE 0x0004
  667. #define ADI_SHOW 0x0008
  668. void NEAR PASCAL AdjustDlgItems(HWND hdlg, UINT idcFirst, UINT idcLast, UINT adi);
  669. void NEAR PASCAL
  670. DestroyDlgItems(HWND hdlg, UINT idcFirst, UINT idcLast);
  671. void PASCAL GetDlgItemRect(HWND hdlg, UINT idc, LPRECT prc);
  672. void PASCAL MoveDlgItems(HWND hdlg, UINT idcTarget, UINT idcFirst, UINT idcLast);
  673. /*****************************************************************************
  674. *
  675. * GXA - Growable "X" array
  676. *
  677. *****************************************************************************/
  678. typedef struct {
  679. PVOID pv;
  680. int cx;
  681. int cxAlloc;
  682. int cbx;
  683. } GXA, *PGXA;
  684. #define Declare_Gxa(T, t) \
  685. union { \
  686. GXA gxa; \
  687. struct { P##T p##t; int c##t; \
  688. int c##t##Alloc; int cb##t; }; \
  689. } \
  690. PVOID PASCAL Misc_AllocPx(PGXA pgxa);
  691. BOOL PASCAL Misc_InitPgxa(PGXA pgxa, int cbx);
  692. void PASCAL Misc_FreePgxa(PGXA pgxa);
  693. /*****************************************************************************
  694. *
  695. * misc.c
  696. *
  697. *****************************************************************************/
  698. LPTSTR PASCAL Misc_Trim(LPTSTR ptsz);
  699. BOOL PASCAL
  700. Misc_CopyReg(HKEY hkSrcRoot, PCTSTR ptszSrc, HKEY hkDstRoot, PCTSTR ptszDst);
  701. BOOL PASCAL
  702. Misc_RenameReg(HKEY hkRoot, PCTSTR ptszKey, PCTSTR ptszSrc, PCTSTR ptszDst);
  703. void PASCAL lstrcatnBs(PTSTR ptszDst, PCTSTR ptszSrc, int ctch);
  704. #define lstrcatnBsA(a, ptsz) lstrcatnBs(a, ptsz, cA(a))
  705. UINT PASCAL Misc_GetShellIconSize(void);
  706. void PASCAL Misc_SetShellIconSize(UINT ui);
  707. void PASCAL Misc_RebuildIcoCache(void);
  708. void PASCAL Misc_EnableMenuFromHdlgId(HMENU hmenu, HWND hdlg, UINT idc);
  709. /*****************************************************************************
  710. *
  711. * misc.c
  712. *
  713. * Listview stuff
  714. *
  715. *****************************************************************************/
  716. void PASCAL Misc_LV_Init(HWND hwnd);
  717. int PASCAL Misc_LV_GetCurSel(HWND hwnd);
  718. void PASCAL Misc_LV_SetCurSel(HWND hwnd, int iIndex);
  719. void PASCAL Misc_LV_EnsureSel(HWND hwnd, int iItem);
  720. void PASCAL Misc_LV_GetItemInfo(HWND, LV_ITEM FAR *, int, UINT);
  721. LPARAM PASCAL Misc_LV_GetParam(HWND hwnd, int iItem);
  722. void PASCAL Misc_LV_HitTest(HWND hwnd, LV_HITTESTINFO FAR *phti, LPARAM lpPos);
  723. LRESULT PASCAL Misc_Combo_GetCurItemData(HWND hwnd);
  724. /*****************************************************************************
  725. *
  726. * lv.c
  727. *
  728. * Listview property sheet page manager
  729. *
  730. *****************************************************************************/
  731. typedef UINT LVVFL;
  732. #define lvvflIcons 1 /* Show icons */
  733. #define lvvflCanCheck 2 /* Show check-box */
  734. #define lvvflCanRename 4 /* Can rename by clicking */
  735. #define lvvflCanDelete 8 /* Parent dialog has IDC_LVDELETE */
  736. typedef struct LVV {
  737. void (PASCAL *OnCommand)(HWND hdlg, int id, UINT codeNotify);
  738. void (PASCAL *OnInitContextMenu)(HWND hwnd, int iItem, HMENU hmenu);
  739. void (PASCAL *Dirtify)(LPARAM lp);
  740. int (PASCAL *GetIcon)(LPARAM lp);
  741. BOOL (PASCAL *OnInitDialog)(HWND hwnd);
  742. void (PASCAL *OnApply)(HWND hdlg);
  743. void (PASCAL *OnDestroy)(HWND hdlg);
  744. void (PASCAL *OnSelChange)(HWND hwnd, int iItem);
  745. int iMenu;
  746. const DWORD CODESEG *pdwHelp;
  747. UINT idDblClk;
  748. LVVFL lvvfl;
  749. LVCI *rglvci;
  750. } LVV, *PLVV;
  751. int PASCAL
  752. LV_AddItem(HWND hwnd, int ix, LPCTSTR ptszDesc, int iImage, BOOL fState);
  753. BOOL EXPORT
  754. LV_DlgProc(PLVV plvv, HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  755. /* State icon information */
  756. #define isiNil 0 /* No state image */
  757. #define isiUnchecked 1 /* Not checked */
  758. #define isiChecked 2 /* Checked */
  759. #ifndef STATEIMAGEMASKTOINDEX
  760. #define STATEIMAGEMASKTOINDEX(i) ((i & LVIS_STATEIMAGEMASK) >> 12)
  761. #endif
  762. #define isiPlvi(plvi) STATEIMAGEMASKTOINDEX((plvi)->state)
  763. /* Checklist_OnApply assumes this returns exactly 0 or 1 */
  764. #define LV_IsChecked(plvi) (isiPlvi(plvi) == isiChecked)
  765. /*****************************************************************************
  766. *
  767. * lvchk.c
  768. *
  769. * Check-listview property sheet page manager
  770. *
  771. *****************************************************************************/
  772. /*
  773. * GetCheckValue must return exactly one of these values
  774. *
  775. * -1 not supported on this platform
  776. * 0 off
  777. * 1 on
  778. *
  779. * Yes, you must explicitly return 1 for on. The reason is that if
  780. * I let you return arbitrary nonzero values, you might accidentally
  781. * return -1 and that would be bad.
  782. */
  783. typedef BOOL (PASCAL *GETCHECKVALUE)(LPARAM lParam, LPVOID pvRef);
  784. typedef BOOL (PASCAL *SETCHECKVALUE)(BOOL fCheck, LPARAM lParam, LPVOID pvRef);
  785. typedef struct CHECKLISTITEM {
  786. GETCHECKVALUE GetCheckValue;
  787. SETCHECKVALUE SetCheckValue;
  788. LPARAM lParam;
  789. } CHECKLISTITEM, *PCHECKLISTITEM;
  790. typedef const CHECKLISTITEM *PCCHECKLISTITEM;
  791. void PASCAL
  792. Checklist_OnInitDialog(HWND hwnd, PCCHECKLISTITEM rgcli, int ccli,
  793. UINT ids, LPVOID pvRef);
  794. void PASCAL
  795. Checklist_OnApply(HWND hdlg, PCCHECKLISTITEM rgcli, LPVOID pvRef, BOOL fForce);
  796. /*****************************************************************************
  797. *
  798. * reg.c
  799. *
  800. * Registry wrappers
  801. *
  802. *****************************************************************************/
  803. typedef struct KL { /* Key location */
  804. PHKEY phkRoot; /* E.g., &hkCU, &pcdii->hlCUExplorer */
  805. PCTSTR ptszKey; /* E.g., "Software\\Microsoft" */
  806. PCTSTR ptszSubkey; /* E.g., "Show" */
  807. } KL;
  808. typedef const KL *PKL;
  809. extern KL const c_klHackPtui;
  810. extern HKEY CODESEG c_hkCR; /* HKEY_CLASSES_ROOT */
  811. extern HKEY CODESEG c_hkCU; /* HKEY_CURRENT_USER */
  812. extern HKEY CODESEG c_hkLM; /* HKEY_LOCAL_MACHINE */
  813. extern HKEY g_hkLMSMWCV; /* HKLM\Software\MS\Win\CurrentVer */
  814. extern HKEY g_hkCUSMWCV; /* HKCU\Software\MS\Win\CurrentVer */
  815. extern HKEY g_hkLMSMIE; /* HKLM\Software\MS\IE */
  816. extern HKEY g_hkCUSMIE; /* HKCU\Software\MS\IE */
  817. /*
  818. * The NT version points to HKLM\Software\MS\Win NT\CurrentVersion if we are
  819. * running on NT; else, it's the same as g_hkLMSMWCV.
  820. */
  821. extern HKEY g_hkLMSMWNTCV; /* HKLM\Software\MS\Win( NT)?\CV */
  822. #define phkCU (&c_hkCU)
  823. #define phkLM (&c_hkLM)
  824. typedef HKEY HHK;
  825. #define hhkHkey(hkey) hkey
  826. #define hkeyHhk(hhk) hhk
  827. #define hhkLM hhkHkey(HKEY_LOCAL_MACHINE)
  828. #define hhkCU hhkHkey(HKEY_CURRENT_USER)
  829. #define hhkCR hhkHkey(HKEY_CLASSES_ROOT)
  830. /*
  831. * Special wrappers that are NT-friendly.
  832. */
  833. BOOL PASCAL RegCanModifyKey(HKEY hkRoot, LPCTSTR ptszSubkey);
  834. LONG PASCAL _RegOpenKey(HKEY hk, LPCTSTR lptszSubKey, PHKEY phkResult);
  835. #undef RegOpenKey
  836. #define RegOpenKey _RegOpenKey
  837. LONG PASCAL _RegCreateKey(HKEY hk, LPCTSTR lptszSubKey, PHKEY phkResult);
  838. #undef RegCreateKey
  839. #define RegCreateKey _RegCreateKey
  840. void PASCAL RegDeleteValues(HKEY hkRoot, LPCTSTR ptszSubkey);
  841. LONG PASCAL RegDeleteTree(HKEY hkRoot, LPCTSTR ptszSubkey);
  842. BOOL PASCAL RegKeyExists(HKEY hkRoot, LPCTSTR ptszSubkey);
  843. HKEY PASCAL hkOpenClsid(PCTSTR ptszClsid);
  844. BOOL PASCAL GetRegStr(HKEY hkey, LPCSTR pszKey, LPCTSTR ptszSubkey,
  845. LPTSTR ptszBuf, int cbBuf);
  846. BOOL PASCAL GetStrPkl(LPTSTR ptszBuf, int cbBuf, PKL pkl);
  847. DWORD PASCAL GetRegDword(HHK hhk, LPCSTR pszKey, LPCSTR pszSubkey, DWORD dw);
  848. DWORD PASCAL GetDwordPkl(PKL pkl, DWORD dw);
  849. UINT PASCAL GetRegInt(HHK hhk, LPCSTR pszKey, LPCSTR pszSubkey, UINT uiDefault);
  850. UINT PASCAL GetIntPkl(UINT uiDefault, PKL pkl);
  851. BOOL PASCAL SetRegStr(HHK hhk, LPCTSTR ptszKey, LPCTSTR ptszSubkey,
  852. LPCTSTR ptszVal);
  853. BOOL PASCAL SetStrPkl(PKL pkl, LPCTSTR ptszVal);
  854. BOOL PASCAL RegSetValuePtsz(HKEY hk, LPCTSTR ptszSubkey, LPCTSTR ptszVal);
  855. BOOL PASCAL SetRegInt(HHK hhk, LPCSTR pszKey, LPCSTR pszSubkey, UINT ui);
  856. BOOL PASCAL SetIntPkl(UINT ui, PKL pkl);
  857. BOOL PASCAL SetRegDword(HHK hhk, LPCSTR pszKey, LPCSTR pszSubkey, DWORD dw);
  858. BOOL PASCAL SetDwordPkl(PKL pkl, DWORD dw);
  859. BOOL PASCAL SetRegDword2(HHK hhk, LPCSTR pszKey, LPCSTR pszSubkey, DWORD dw);
  860. BOOL PASCAL SetDwordPkl2(PKL pkl, DWORD dw);
  861. BOOL PASCAL DelPkl(PKL pkl);
  862. /*****************************************************************************
  863. *
  864. * prsht.c
  865. *
  866. * Property sheet hacks.
  867. *
  868. *****************************************************************************/
  869. int CALLBACK
  870. Prsht_PropertySheetCallback(HWND hwnd, UINT pscb, LPARAM lp);
  871. /*****************************************************************************
  872. *
  873. * Manual import tables
  874. *
  875. * Before expanding MIT_Contents, set MIT_Item either to
  876. *
  877. * #define MIT_Item(a,b) a // Emit the function type
  878. * or #define MIT_Item(a,b) b // Emit the ordinal
  879. *
  880. *****************************************************************************/
  881. #define MIT_Contents \
  882. MIT_Item(BOOL (WINAPI *SHGetNewLinkInfo)(LPCSTR, LPCSTR, LPSTR, BOOL *, UINT), 179) \
  883. MIT_Item(int (WINAPI *Shell_GetCachedImageIndex)(PV, int, UINT), 72) \
  884. MIT_Item(BOOL (WINAPI *ReadCabinetState)(LPCABINETSTATE, int), MAKELONG(651, 1)) \
  885. MIT_Item(BOOL (WINAPI *WriteCabinetState)(LPCABINETSTATE), MAKELONG(652, 1)) \
  886. MIT_Item(HRESULT (WINAPI *SHCoCreateInstance)(LPCSTR, const CLSID *, PUNK, \
  887. REFIID, PPV), 102) \
  888. MIT_Item(LPITEMIDLIST (WINAPI *SHSimpleIDListFromPath)(LPCVOID pszPath), 162) \
  889. #define MIT_Item(a, b) a; /* Emit the prototype */
  890. typedef struct MIT { /* manual import table */
  891. MIT_Contents
  892. } MIT, *PMIT;
  893. #undef MIT_Item
  894. extern MIT mit;
  895. /*****************************************************************************
  896. *
  897. * Globals
  898. *
  899. *****************************************************************************/
  900. extern char g_tszName[80]; /* Program name goes here */
  901. extern char g_tszMsdosSys[]; /* Boot file */
  902. extern char g_tszPathShell32[MAX_PATH]; /* Full path to shell32.dll */
  903. extern char g_tszPathMe[MAX_PATH]; /* Full path to myself */
  904. extern PSF psfDesktop; /* Desktop IShellFolder */
  905. extern UINT g_flWeirdStuff;
  906. #define flbsComCtl32 1 /* Buggy ComCtl32 */
  907. #define flbsSmoothScroll 2 /* ComCtl32 supports smoothscroll */
  908. #define flbsOPK2 4 /* Windows 95 OPK2 */
  909. #define flbsNT 8 /* Windows NT */
  910. #define flbsBadRun 16 /* I was run not via Control Panel */
  911. #define flbsShellSz 32 /* Shell32 supports EXPAND_SZ */
  912. #define flbsMemphis 0x0040 /* Windows 95 Memphis */
  913. #define flbsMillennium 0x0080 /* Windows 95 Millennium */
  914. #define flbsIE5 0x0100 /* IE5 is installed */
  915. #define flbsNT5 0x0200 /* NT5 is installed */
  916. #define g_fBuggyComCtl32 (g_flWeirdStuff & flbsComCtl32)
  917. #define g_fSmoothScroll (g_flWeirdStuff & flbsSmoothScroll)
  918. #define g_fOPK2 (g_flWeirdStuff & flbsOPK2)
  919. #define g_fNT (g_flWeirdStuff & flbsNT)
  920. #define g_fBadRun (g_flWeirdStuff & flbsBadRun)
  921. #define g_fShellSz (g_flWeirdStuff & flbsShellSz)
  922. #define g_fMemphis (g_flWeirdStuff & flbsMemphis)
  923. #define g_fMillennium (g_flWeirdStuff & flbsMillennium)
  924. #define g_fIE5 (g_flWeirdStuff & flbsIE5)
  925. #define g_fNT5 (g_flWeirdStuff & flbsNT5)
  926. extern HINSTANCE hinstCur;
  927. extern DWORD g_dwShellVer;
  928. #define g_fIE4 (g_dwShellVer >= MAKELONG(0, 0x0446)) /* 4.70 - IE4 + shell integration */
  929. #define g_fShell5 (g_dwShellVer >= MAKELONG(0, 0x0500)) /* 5.00 - NT 5 */
  930. #define g_fShell55 (g_dwShellVer >= MAKELONG(0, 0x0532)) /* 5.50 - Millennium or Neptune */
  931. #define ctchClsid (1+ 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12 + 1 + 1)
  932. #define ctchKeyMax (1+MAX_PATH) /* According to the SDK */
  933. /*****************************************************************************
  934. *
  935. * Instanced
  936. *
  937. * We're a cpl so have only one instance, but I declare
  938. * all the instance stuff in one place so it's easy to convert this
  939. * code to multiple-instance if ever we need to.
  940. *
  941. **************************************************************************/
  942. typedef struct CDII { /* common dialog instance info */
  943. HMENU hmenu; /* The one menu everybody uses */
  944. HKEY hkClsid; /* HKCR\CLSID */
  945. HKEY hkCUExplorer; /* HKCU\REGSTR_PATH_EXPLORER */
  946. HKEY hkLMExplorer; /* HKLM\REGSTR_PATH_EXPLORER */
  947. HIML himlState; /* Check-box state image imagelist */
  948. BOOL fRunShellInf; /* Should I run shell.inf afterwards? */
  949. PIDL pidlTemplates; /* Cached templates pidl */
  950. } CDII, *PCDII;
  951. extern CDII cdii;
  952. #define pcdii (&cdii)
  953. /**************************************************************************
  954. *
  955. * Local heap stuff
  956. *
  957. * I have to do this because LocalAlloc takes the args in the order
  958. * (fl, cb), but LocalReAlloc takes them in the order (cb, fl), and
  959. * I invariably get them messed up.
  960. *
  961. **************************************************************************/
  962. #define lAlloc(cb) (void *)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, cb)
  963. #define lReAlloc(p, cb) (void *)LocalReAlloc((HLOCAL)(p), (cb), \
  964. LMEM_MOVEABLE | LMEM_ZEROINIT)
  965. #define lFree(p) LocalFree((HLOCAL)(p))
  966. /*****************************************************************************
  967. *
  968. * Set an empty rect, centered at the requested point.
  969. *
  970. *****************************************************************************/
  971. INLINE void
  972. SetRectPoint(LPRECT lprc, POINT pt)
  973. {
  974. lprc->left = lprc->right = pt.x;
  975. lprc->top = lprc->bottom = pt.y;
  976. }
  977. /*****************************************************************************
  978. *
  979. * Who'd 'a thunk it?
  980. *
  981. *****************************************************************************/
  982. LPVOID PASCAL MapSL(DWORD lib);
  983. WINSHELLAPI BOOL PASCAL Shell_GetImageLists(HIMAGELIST FAR *, HIMAGELIST FAR *);
  984. /*****************************************************************************
  985. *
  986. * expire.c
  987. *
  988. *****************************************************************************/
  989. #if defined(PRERELEASE) || defined(PUBLIC_PRERELEASE)
  990. BOOL PASCAL IsExpired(HWND hwnd);
  991. #endif
  992. /*****************************************************************************
  993. *
  994. * secret.c
  995. *
  996. *****************************************************************************/
  997. NTSTATUS
  998. GetSecretDefaultPassword(
  999. LPWSTR PasswordBuffer, DWORD cchBuf
  1000. );
  1001. NTSTATUS
  1002. SetSecretDefaultPassword(
  1003. LPWSTR PasswordBuffer
  1004. );
  1005. /*****************************************************************************
  1006. *
  1007. * CWaitCursor
  1008. *
  1009. * A little class for creating a wait cursor.
  1010. *
  1011. *****************************************************************************/
  1012. HCURSOR SetWaitCursor(void);
  1013. class CWaitCursor {
  1014. public:
  1015. HCURSOR hcurPrev;
  1016. inline CWaitCursor() { hcurPrev = SetWaitCursor(); }
  1017. inline ~CWaitCursor() { if (hcurPrev) SetCursor(hcurPrev); }
  1018. };
  1019. #endif /* !RC_INVOKED */