Leaked source code of windows server 2003
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.

165 lines
4.3 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) 1990-1998 Microsoft Corporation
  3. Module Name:
  4. vdmapi.h
  5. Abstract:
  6. This module defines the private MVDM APIs
  7. Created:
  8. 02-Apr-1992
  9. Revision History:
  10. Created 02-Apr-1992 Sudeep Bharati
  11. --*/
  12. #define MAXIMUM_VDM_COMMAND_LENGTH 128
  13. #define MAXIMUM_VDM_ENVIORNMENT 32*1024
  14. #define MAXIMUM_VDM_CURRENT_DIR 64
  15. // The following value can be used to allocate space for the largest possible
  16. // path string in ansi, including directory, drive letter and file name.
  17. // I originally coded this with 13 for the path name, but DOS seems to be
  18. // able to handle one more, thus the 14.
  19. #define MAXIMUM_VDM_PATH_STRING MAXIMUM_VDM_CURRENT_DIR+3+14
  20. // VDMState defines
  21. #define ASKING_FOR_FIRST_COMMAND 0x1 // Very First call.
  22. #define ASKING_FOR_WOW_BINARY 0x2 // Caller is WOWVDM
  23. #define ASKING_FOR_DOS_BINARY 0x4 // Caller is DOSVDM
  24. #define ASKING_FOR_SECOND_TIME 0x8 // Caller is asking second time after
  25. #define INCREMENT_REENTER_COUNT 0x10 // Increment the re-entrancy count
  26. #define DECREMENT_REENTER_COUNT 0x20 // Decrement the re-entrancy count
  27. #define NO_PARENT_TO_WAKE 0x40 // Just get the next command, dont wake up anyone
  28. // allocating bigger buffers.
  29. #define RETURN_ON_NO_COMMAND 0x80 // if there is no command return without blocking
  30. #define ASKING_FOR_PIF 0x100 // To get the exe name to find out PIF
  31. // early in the VDM initialization.
  32. #define STARTUP_INFO_RETURNED 0x200 // on return if this bit is set means
  33. // startupinfo structure was filled in.
  34. #define ASKING_FOR_ENVIRONMENT 0x400 // ask for environment only
  35. #define ASKING_FOR_SEPWOW_BINARY 0x800 // Caller is Separate WOW
  36. #define ASKING_FOR_WOWPROCLIST 0x1000 // get the list of wow processes
  37. #define ASKING_FOR_WOWTASKLIST 0x4000 // get the list of tasks in this wow process
  38. #define ASKING_TO_ADD_WOWTASK 0x8000 // add info about a wow task.
  39. typedef struct _VDMINFO {
  40. ULONG iTask;
  41. ULONG dwCreationFlags;
  42. ULONG ErrorCode;
  43. ULONG CodePage;
  44. HANDLE StdIn;
  45. HANDLE StdOut;
  46. HANDLE StdErr;
  47. LPVOID CmdLine;
  48. LPVOID AppName;
  49. LPVOID PifFile;
  50. LPVOID CurDirectory;
  51. LPVOID Enviornment;
  52. ULONG EnviornmentSize;
  53. STARTUPINFOA StartupInfo;
  54. LPVOID Desktop;
  55. ULONG DesktopLen;
  56. LPVOID Title;
  57. ULONG TitleLen;
  58. LPVOID Reserved;
  59. ULONG ReservedLen;
  60. USHORT CmdSize;
  61. USHORT AppLen;
  62. USHORT PifLen;
  63. USHORT CurDirectoryLen;
  64. USHORT VDMState;
  65. USHORT CurDrive;
  66. BOOLEAN fComingFromBat;
  67. } VDMINFO, *PVDMINFO;
  68. //
  69. // used to store shared task and ntvdm process info list
  70. //
  71. #define MAX_SHARED_OBJECTS 200
  72. typedef struct _SHAREDTASK {
  73. DWORD dwThreadId;
  74. WORD hTask16;
  75. WORD hMod16;
  76. CHAR szModName[9];
  77. CHAR szFilePath[128];
  78. } SHAREDTASK, *LPSHAREDTASK;
  79. typedef struct _SHAREDPROCESS {
  80. DWORD dwProcessId;
  81. DWORD dwAttributes; // WOW_SYSTEM for shared WOW
  82. LPTHREAD_START_ROUTINE pfnW32HungAppNotifyThread; // For VDMTerminateTask
  83. } SHAREDPROCESS, *LPSHAREDPROCESS;
  84. // for CmdBatNotification
  85. #define CMD_BAT_OPERATION_TERMINATING 0
  86. #define CMD_BAT_OPERATION_STARTING 1
  87. //
  88. // Message sent by BaseSrv to shared WOWEXEC to tell it to call
  89. // GetNextVDMCommand. No longer will a thread in WOW be blocked
  90. // in GetNextVDMCommand all the time.
  91. //
  92. #define WM_WOWEXECSTARTAPP (WM_USER) // also in mvdm\inc\wowinfo.h
  93. //
  94. // MVDM apis
  95. //
  96. VOID
  97. APIENTRY
  98. VDMOperationStarted(
  99. IN BOOL IsWowCaller
  100. );
  101. BOOL
  102. APIENTRY
  103. GetNextVDMCommand(
  104. PVDMINFO pVDMInfo
  105. );
  106. VOID
  107. APIENTRY
  108. ExitVDM(
  109. IN BOOL IsWowCaller,
  110. IN ULONG iWowTask
  111. );
  112. BOOL
  113. APIENTRY
  114. SetVDMCurrentDirectories(
  115. IN ULONG cchCurDir,
  116. IN CHAR *lpszCurDir
  117. );
  118. ULONG
  119. APIENTRY
  120. GetVDMCurrentDirectories(
  121. IN ULONG cchCurDir,
  122. IN CHAR *lpszCurDir
  123. );
  124. VOID
  125. APIENTRY
  126. CmdBatNotification(
  127. IN ULONG fBeginEnd
  128. );
  129. NTSTATUS
  130. APIENTRY
  131. RegisterWowExec(
  132. IN HANDLE hwndWowExec
  133. );