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.

534 lines
20 KiB

  1. /******************************************************************************
  2. *
  3. * (C) Copyright MICROSOFT Corp., 1988-1990
  4. *
  5. * Title: SHELL header file
  6. *
  7. * Version: 2.00
  8. *
  9. * Date: 2-06-89
  10. *
  11. * Author: ARR
  12. *
  13. *******************************************************************************
  14. *
  15. * Change log:
  16. *
  17. * DATE REVISION DESCRIPTION
  18. * -------- -------- -------------------------------------------------------
  19. * 06-Feb-1989 ARR Original
  20. * 28-Feb-1992 rjc Partially converted from inc to h file.
  21. * 25-Sep-1992 rjc Change old-style ULONG/USHORT into modern DWORD/WORD
  22. *
  23. *==============================================================================
  24. */
  25. /*
  26. * All directed VM hot keys are PriorityNotify. This is the timeout for them.
  27. * If it takes longer than this many milliseconds, the key is discarded.
  28. *
  29. * 0 means no time out
  30. */
  31. #define KEYTIMEOUT 4000 /* 4 sec, long enough for floppy operations */
  32. /*
  33. * This is the structure of the PIF file hot key information.
  34. *
  35. * The bits of Val are as follows:
  36. *
  37. * bit 0 (value 1) = key is an extended key
  38. *
  39. * This tells us whether or not to look for an E0 prefix.
  40. *
  41. * bit 1 (value 2) = key requires NumLock down (new for 4.0)
  42. *
  43. * This tells us whether to treat scan code 047h as
  44. * VK_HOME or VK_NUMPAD7.
  45. */
  46. #define MAXHKYINFOSIZE 16
  47. /* H2INCSWITCHES -t */
  48. typedef struct PIFKEY { /* PIF_Ky */
  49. WORD Scan; /* Scan code in lower byte */
  50. WORD ShVal; /* Shift state */
  51. WORD ShMsk; /* Mask for shift states interested in */
  52. BYTE Val; /* Enhanced key stuff */
  53. BYTE Pad[9]; /* Pad PIF struc to MAXHKYINFOSIZE bytes */
  54. } PIFKEY;
  55. typedef UNALIGNED PIFKEY *LPPIFKEY;
  56. typedef const UNALIGNED PIFKEY *LPCPIFKEY;
  57. /* ASM
  58. .errnz SIZE PIFKEY - MAXHKYINFOSIZE
  59. */
  60. /*
  61. * PIF_Ky_Val
  62. * = 1, if extended code (key is an extended code only)
  63. * = 0FFh, if either (key is EITHER extended or not extended)
  64. * = 0 if not extended (key is not extended only)
  65. *
  66. * bit 15 - Ins depressed
  67. * bit 14 - Caps Lock depressed
  68. * bit 13 - Num Lock depressed
  69. * bit 12 - Scroll Lock depressed
  70. * bit 11 - hold state active(Ctrl-Num Lock)
  71. * bit 10 - 0
  72. * bit 9 - 0
  73. * bit 8 - 0
  74. * bit 7 - Insert state active
  75. * bit 6 - Caps Lock state active
  76. * bit 5 - Num Lock state active
  77. * bit 4 - Scroll Lock state active
  78. * bit 3 - Alt shift depressed
  79. * bit 2 - Ctrl shift depressed
  80. * bit 1 - left shift depressed
  81. * bit 0 - right shift depressed
  82. */
  83. #define fPIFSh_RShf 0x0001 /* Right shift key */
  84. #define fPIFSh_RShfBit 0
  85. #define fPIFSh_LShf 0x0002 /* Left shift key */
  86. #define fPIFSh_LShfBit 1
  87. #define fPIFSh_Ctrl 0x0004 /* Either Control shift key */
  88. #define fPIFSh_CtrlBit 2
  89. #define fPIFSh_Alt 0x0008 /* Either Alt shift key */
  90. #define fPIFSh_AltBit 3
  91. #define fPIFSh_ScLok 0x0010 /* Scroll lock active */
  92. #define fPIFSh_ScLokBit 4
  93. #define fPIFSh_NmLok 0x0020 /* Num lock active */
  94. #define fPIFSh_NmLokBit 5
  95. #define fPIFSh_CpLok 0x0040 /* Caps lock active */
  96. #define fPIFSh_CpLokBit 6
  97. #define fPIFSh_Insrt 0x0080 /* Insert active */
  98. #define fPIFSh_InsrtBit 7
  99. #define fPIFSh_Ext0 0x0400 /* Extended K/B shift */
  100. #define fPIFSh_Ext0Bit 10
  101. #define fPIFSh_Hold 0x0800 /* Ctrl-Num-Lock/Pause active */
  102. #define fPIFSh_HoldBit 11
  103. #define fPIFSh_LAlt 0x1000 /* Left Alt key is down */
  104. #define fPIFSh_LAltBit 12
  105. #define fPIFSh_RAlt 0x2000 /* Right Alt key is down */
  106. #define fPIFSh_RAltBit 13
  107. #define fPIFSh_LCtrl 0x4000 /* Left Ctrl key is down */
  108. #define fPIFSh_LCtrlBit 14
  109. #define fPIFSh_RCtrl 0x8000 /* Right Ctrl key is down */
  110. #define fPIFSh_RCtrlBit 15
  111. #define MAXVMTITLELENGTH 32 /* Size of name buffer */
  112. #define PIFNAMESIZE 30 /* Amount of buffer actually used */
  113. /*
  114. * VM descriptor structure used to create and modify VM attributes.
  115. *
  116. */
  117. /* H2INCSWITCHES -t- */
  118. struct VM_Descriptor {
  119. DWORD VD_Flags; /* Flags */
  120. DWORD VD_Flags2; /* More Flags */
  121. DWORD VD_ProgName; /* Pointer to program name */
  122. WORD VD_ProgNameSeg; /* */
  123. DWORD VD_CmdLine; /* Command line ptr */
  124. WORD VD_CmdLineSeg; /* */
  125. DWORD VD_DrivePath; /* Current drive and dir ptr */
  126. WORD VD_DrivePathSeg;/* */
  127. WORD VD_MaxMem; /* Maximum VM memory in Kb */
  128. WORD VD_MinMem; /* Minimum VM memory in Kb */
  129. WORD VD_FPriority; /* Priority of process when FOCUS */
  130. WORD VD_BPriority; /* Priority of process when Not FOCUS */
  131. WORD VD_MaxEMSMem; /* Maximum EMS memory in Kb */
  132. WORD VD_MinEMSMem; /* Minimum EMS memory in Kb */
  133. WORD VD_MaxXMSMem; /* Maximum XMS (extended) memory in Kb */
  134. WORD VD_MinXMSMem; /* Minimum XMS (extended) memory in Kb */
  135. WORD VD_WindHand; /* Window handle of VMDOSAPP instance */
  136. WORD VD_InstHand; /* Instance handle of VMDOSAPP instance */
  137. BYTE VD_Title[MAXVMTITLELENGTH]; /* Title of app */
  138. PIFKEY VD_HotKeyBuf; /* Buffer for Hot key spec */
  139. };
  140. /* ASM
  141. ;
  142. ; Access the MaxMem and MinMem fields as a single DWORD.
  143. ;
  144. VD_VMSize equ DWORD PTR VD_MaxMem
  145. */
  146. /* ASM
  147. ifndef MASM6
  148. IF2
  149. IFDEF VMStat_Exclusive_Bit
  150. .erre VD_F_ExclusiveBit EQ VMStat_Exclusive_Bit
  151. .erre VD_F_BackgroundBit EQ VMStat_Background_Bit
  152. ENDIF
  153. ENDIF
  154. else ; MASM6
  155. IFDEF VMStat_Exclusive_Bit
  156. .erre VD_F_ExclusiveBit EQ VMStat_Exclusive_Bit
  157. .erre VD_F_BackgroundBit EQ VMStat_Background_Bit
  158. ENDIF
  159. endif ; MASM6
  160. */
  161. /*
  162. * Masks and bit numbers for VD_Flags
  163. *
  164. */
  165. #define VD_F_ExclusiveBit 0 /* This bit indicates that when the VM
  166. * has the focus it has Exclusive use
  167. * of the CPU.
  168. */
  169. #define VD_F_Exclusive (1L << VD_F_ExclusiveBit)
  170. #define VD_F_BackgroundBit 1 /* This bit indicates that when the VM
  171. * does not have the focus it continues
  172. * to get CPU time. If this bit is
  173. * clear the VM is effectively
  174. * suspended unless it has the
  175. * input focus.
  176. */
  177. #define VD_F_Background (1L << VD_F_BackgroundBit)
  178. #define VD_F_WindowBit 2 /* This bit indicates that the VM
  179. * runs in a window.
  180. * If the bit is clear the VM is a
  181. * full screen VM.
  182. */
  183. #define VD_F_Window (1L << VD_F_WindowBit)
  184. /* VD_F_Window2 is set if the VDD thinks that the VM is ;Internal
  185. * running in a window. This bit is only if... ;Internal
  186. * 1. The VM is running in a window. ;Internal
  187. * 2. The VM is not minimized. ;Internal
  188. * 3. The VM's client area is visible. ;Internal
  189. * This is different from VD_F_Window, which is set iff the ;Internal
  190. * VM is running in a window, possible minimized or obscured. ;Internal
  191. * We lie to the VDD so that it won't try to track the VM's ;Internal
  192. * display when there is no reason to do so. ;Internal
  193. */ /* ;Internal */
  194. #define VD_F_Window2Bit 3 /* ;Internal */
  195. #define VD_F_Window2 (1L << VD_F_Window2Bit) /* ;Internal */
  196. /* ;Internal */
  197. #define VD_F_SuspendedBit 4 /* Set if app suspended by VMDOSAPP */
  198. #define VD_F_Suspended (1L << VD_F_SuspendedBit)
  199. #define VD_F_ALTTABdisBit 5 /* Set if the Standard
  200. * ALT-TAB Hot key is disabled for
  201. * this VM.
  202. */
  203. #define VD_F_ALTTABdis (1L << VD_F_ALTTABdisBit)
  204. #define VD_F_ALTESCdisBit 6 /* Set if the Standard
  205. * ALT-ESC Hot key is disabled for
  206. * this VM.
  207. */
  208. #define VD_F_ALTESCdis (1L << VD_F_ALTESCdisBit)
  209. #define VD_F_ALTSPACEdisBit 7 /* Set if the Standard
  210. * ALT-SPACE Hot key is disabled for
  211. * this VM.
  212. */
  213. #define VD_F_ALTSPACEdis (1L << VD_F_ALTSPACEdisBit)
  214. #define VD_F_ALTENTERdisBit 8 /* Set if the Standard
  215. * ALT-ENTER Hot key is disabled for
  216. * this VM.
  217. */
  218. #define VD_F_ALTENTERdis (1L << VD_F_ALTENTERdisBit)
  219. #define VD_F_ALTPRTSCdisBit 9 /* Set if the Standard
  220. * ALT-PRTSC Hot key is disabled for
  221. * this VM.
  222. */
  223. #define VD_F_ALTPRTSCdis (1L << VD_F_ALTPRTSCdisBit)
  224. #define VD_F_PRTSCdisBit 10 /* Set if the Standard
  225. * PRTSC Hot key is disabled for
  226. * this VM.
  227. */
  228. #define VD_F_PRTSCdis (1L << VD_F_PRTSCdisBit)
  229. #define VD_F_CTRLESCdisBit 11 /* Set if the Standard
  230. * CTRL-ESC Hot key is disabled for
  231. * this VM.
  232. */
  233. #define VD_F_CTRLESCdis (1L << VD_F_CTRLESCdisBit)
  234. #define VD_F_PollingDetectBit 12 /* Set if the polling
  235. * detection is allowed for this VM
  236. */
  237. #define VD_F_PollingDetect (1L << VD_F_PollingDetectBit)
  238. #define VD_F_NoHMABit 13 /* Set if access to
  239. * the XMS HMA is disallowed in
  240. * this VM.
  241. */
  242. #define VD_F_NoHMA (1L << VD_F_NoHMABit)
  243. #define VD_F_HasHotKeyBit 14 /* Set if this app
  244. * has specified a hot key in
  245. * this VM.
  246. */
  247. #define VD_F_HasHotKey (1L << VD_F_HasHotKeyBit)
  248. #define VD_F_EMS_Is_LockBit 15 /* Set if XMS memory
  249. * should be locked in this VM.
  250. */
  251. #define VD_F_EMS_Is_Lock (1L << VD_F_EMS_Is_LockBit)
  252. #define VD_F_XMS_Is_LockBit 16 /* Set if EMS memory
  253. * should be locked in this VM.
  254. */
  255. #define VD_F_XMS_Is_Lock (1L << VD_F_XMS_Is_LockBit)
  256. #define VD_F_INT16PasteBit 17 /* Paste via INT 16 is OK */
  257. #define VD_F_INT16Paste (1L << VD_F_INT16PasteBit)
  258. #define VD_F_VMLockedBit 18 /* VM is to be Always LOCKED. */
  259. #define VD_F_VMLocked (1L << VD_F_VMLockedBit)
  260. #define VD_F_IsBatchBit 19 /* VM is a .BAT file run */
  261. #define VD_F_IsBatch (1L << VD_F_IsBatchBit)
  262. /* ;Internal */
  263. #define VD_F_VolumeLockBit 27 /* Owns a level 3 volume lock *//* ;Internal */
  264. #define VD_F_VolumeLock (1L << VD_F_VolumeLockBit) /* ;Internal */
  265. /* ;Internal */
  266. #define VD_F_IsTextBit 28 /* Am in a text mode */ /* ;Internal */
  267. #define VD_F_IsText (1L << VD_F_IsTextBit) /* ;Internal */
  268. /* ;Internal */
  269. #define VD_F_DynaWindowBit 29 /* Auto switch when in graphics mode */
  270. #define VD_F_DynaWindow (1L << VD_F_DynaWindowBit)
  271. #define VD_F_ExitCloseBit 30 /* VM is to be closed on exit */
  272. #define VD_F_ExitClose (1L << VD_F_ExitCloseBit)
  273. #define VD_F_PastingBit 31 /* VM is pasting also used for hot key
  274. * flag
  275. */
  276. #define VD_F_Pasting (1L << VD_F_PastingBit)
  277. /*
  278. * Following bits are bits for the VDD to interpret in VD_Flags2
  279. */
  280. #define VD_F2_VDDPrivMask 0x0000FFFF
  281. #define VD_F2_VDDPrivMinBit 0
  282. #define VD_F2_VDDPrivMaxBit 15
  283. /* Validate the above three defines */
  284. #if ((1 << (1+VD_F2_VDDPrivMaxBit))-1) - ((1 << VD_F2_VDDPrivMinBit)-1) != VD_F2_VDDPrivMask
  285. /* XLATOFF */
  286. #error VD_F2_VDDPrivMask conflicts with MaxBit and MinBit.
  287. /* XLATON */
  288. /* ASM
  289. %OUT VD_F2_VDDPrivMask conflicts with MaxBit and MinBit.
  290. .err
  291. */
  292. #endif
  293. #define VD_F2_DynaWindowingBit 16 /* Internal semaphore */
  294. #define VD_F2_DynaWindowIng (1L << VD_F2_DynaWindowingBit)
  295. #define VD_F2_DynaWaitingBit 17 /* Internal semaphore */
  296. #define VD_F2_DynaWaiting (1L << VD_F2_DynaWaitingBit)
  297. /*
  298. * These are the bits of VD_Flags which are "exported" to the outside world
  299. * via the SHELL_GetVMInfo service
  300. */
  301. /* XLATOFF */
  302. #define VD_Flags_Exported (VD_F_Window+VD_F_ALTTABdis+VD_F_ALTESCdis+\
  303. VD_F_ALTSPACEdis+VD_F_ALTENTERdis+VD_F_ALTPRTSCdis+\
  304. VD_F_PRTSCdis+VD_F_CTRLESCdis+VD_F_PollingDetect+\
  305. VD_F_NoHMA+VD_F_HasHotKey+VD_F_EMS_Is_Lock+\
  306. VD_F_XMS_Is_Lock+VD_F_INT16Paste+VD_F_VMLocked+\
  307. VD_F_ExitClose)
  308. /* XLATON */
  309. /* ASM
  310. VD_Flags_Exported equ (VD_F_Window+VD_F_ALTTABdis+VD_F_ALTESCdis+\
  311. VD_F_ALTSPACEdis+VD_F_ALTENTERdis+VD_F_ALTPRTSCdis+\
  312. VD_F_PRTSCdis+VD_F_CTRLESCdis+VD_F_PollingDetect+\
  313. VD_F_NoHMA+VD_F_HasHotKey+VD_F_EMS_Is_Lock+\
  314. VD_F_XMS_Is_Lock+VD_F_INT16Paste+VD_F_VMLocked+\
  315. VD_F_ExitClose)
  316. */
  317. #ifdef DOS7 /* ;Internal */
  318. #define VD_Flags2_Exported VD_F2_CreateVisible /* ;Internal */
  319. #else /* ;Internal */
  320. #define VD_Flags2_Exported 0
  321. #endif /* ;Internal */
  322. /*
  323. * Special exit codes
  324. *
  325. * VMDA_EXIT_ExecFail can trigger for the following reasons:
  326. *
  327. * An ugly TSR is present in the system.
  328. * You are in clean-boot mode.
  329. * Administration restrictions forbid DOS boxes.
  330. * ;Internal
  331. * NOTE! If you add a new exit code, make sure to adjust the call ;Internal
  332. * to WOAAbort in ttywin.asm accordingly! ;Internal
  333. */
  334. #define VMDA_EXIT_NoFile 0x81 /* File not found */
  335. #define VMDA_EXIT_NoMem 0x82 /* Insufficient memory */
  336. #define VMDA_EXIT_Crash 0x83 /* Application terminated abnormally */
  337. #define VMDA_EXIT_BadVer 0x84 /* Mismatched system components */
  338. #define VMDA_EXIT_ExecFail 0x85 /* Could not run due to incompatible
  339. * system configuration.
  340. */
  341. /*
  342. * These are the ordinals for the Shell-exported V86-mode and protect-mode
  343. * services.
  344. *
  345. */
  346. #define SHSV_Get_Version 0x0100
  347. #define SHSV_Install_New_Task_Manager 0x0101
  348. #define SHSV_ShellExecute 0x0102
  349. #define SHSV_WinExecWait 0x0103
  350. #define SHSV_Enumerate_Properties 0x0104
  351. #define SHSV_Update_Properties 0x0105
  352. #define SHSV_Set_ScreenSaver_Info 0x0106
  353. #define SHSV_Get_VxD_Version 0x0107
  354. #define NUMSHELLSERVICES 8
  355. /* H2INCSWITCHES -t */
  356. typedef struct TaskManagerDescriptorBlock { /* TMDB */
  357. DWORD TaskManNameOffs;
  358. WORD TaskManNameSeg;
  359. DWORD ProgNameOffs;
  360. WORD ProgNameSeg;
  361. DWORD CmdLineOffs;
  362. WORD CmdLineSeg;
  363. DWORD DrivePathOffs;
  364. WORD DrivePathSeg;
  365. } TMDB;
  366. #define TMDBSTRINGCOUNT 4
  367. #define MAXTMDBSTRINGLENGTH 128 /* 127 chars + terminating 0 */
  368. /*
  369. * Error values for WinExecWait.
  370. */
  371. #define ERR_WEW_FIRST 0x0100
  372. #define ERR_WEW_INSMEM 0x0100 /* Insufficient memory */
  373. #define ERR_WEW_NOTASK 0x0101 /* No such task, or task is Win32 */
  374. #define ERR_WEW_TOOLHELP 0x0102 /* Could not load TOOLHELP */
  375. #define ERR_WEW_LAST 0x0102 /* ;Internal */
  376. /*
  377. * Definitions for the VM Close API.
  378. */
  379. #define VMCLFL_ENABLECLOSE 1
  380. #ifndef V86MODE
  381. #ifdef TASKMAN
  382. /*
  383. * Structure for installable task managers to notify the Shell VxD
  384. * which services they want to hook.
  385. */
  386. typedef struct TMHandlers { /* TMH */
  387. DWORD Len;
  388. PVOID Resolve_Contention_Pre;
  389. PVOID Resolve_Contention_Post;
  390. PVOID Event;
  391. PVOID Sysmodal_Message_Pre;
  392. PVOID Sysmodal_Message_Post;
  393. PVOID Message_Pre;
  394. PVOID Message_Post;
  395. PVOID Svc_Call;
  396. PVOID Clipboard;
  397. PVOID Not_Executeable;
  398. PVOID Set_Focus;
  399. PVOID HotKey;
  400. PVOID PostMessage;
  401. PVOID ShellExecute;
  402. PVOID CallDll;
  403. PVOID VmTitle;
  404. PVOID VmClose;
  405. PVOID QueryAppyTimeAvailable;
  406. PVOID CallAtAppyTime;
  407. PVOID CancelAppyTimeEvent;
  408. PVOID BroadcastSystemMessage;
  409. PVOID HookSystemBroadcast;
  410. PVOID UnhookSystemBroadcast;
  411. PVOID LocalAllocEx;
  412. PVOID LocalFree;
  413. PVOID LoadLibrary;
  414. PVOID FreeLibrary;
  415. PVOID GetProcAddress;
  416. PVOID DispatchRing0AppyEvents;
  417. } TMH;
  418. /*
  419. * This is the structure the SHELL_Install_TaskMan_Hooks returns a pointer to.
  420. *
  421. * It is an array of pointers to helper functions provided by the Shell VxD
  422. * to task managers. These helper functions are not exported as services
  423. * because they expose the sensitive innards of the Shell VxD.
  424. */
  425. typedef struct SHHandlers { /* SHH */
  426. PVOID GetVmDescriptor;
  427. PVOID RegisterVMHotKey;
  428. PVOID DisplayMessage;
  429. } SHH;
  430. #endif
  431. /*
  432. * When expanding this structure, make sure to PREPEND fields, so as to
  433. * retain backwards compatibility.
  434. */
  435. typedef struct VM_Desc2 { /* VD2 */
  436. DWORD phvmOwner; /* Back-pointer to owner */
  437. BYTE Err_Code; /* Error code for Exec failure */
  438. BYTE Exit_Code; /* Exit code */
  439. } VM_Desc2;
  440. /* ASM
  441. ;
  442. ; Potentially handy abbreviation so you can say
  443. ;
  444. ; call [SHELL_GetVmDescriptor]
  445. ; mov eax, [eax.MVM_Desc2.VD2_HotKeyHandle]
  446. ;
  447. MVM_Desc2 = - SIZE VM_Desc2
  448. */
  449. #endif /* ifndef V86MODE */
  450. #define MAX_DLL_NAME 80
  451. #ifndef MAX_GROUP_NAME
  452. #define MAX_GROUP_NAME 16
  453. #else
  454. #if MAX_GROUP_NAME != 16
  455. #error Invalid definition of MAX_GROUP_NAME.
  456. #endif
  457. #endif
  458. /* H2INCSWITCHES -t- */
  459. struct PropID {
  460. DWORD ordGroup;
  461. BYTE achGroup[MAX_GROUP_NAME];
  462. BYTE achDLL[MAX_DLL_NAME];
  463. };