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.

440 lines
15 KiB

  1. // --------------------------------------------------------------------------
  2. //
  3. // Copyright (c) 1995-1997, Microsoft Corporation
  4. //
  5. // Module:
  6. //
  7. // rapi.h
  8. //
  9. // Purpose:
  10. //
  11. // Master include file for Windows CE Remote API
  12. //
  13. // --------------------------------------------------------------------------
  14. #ifndef RAPI_H
  15. #define RAPI_H
  16. #include <windows.h>
  17. //
  18. // The Windows CE WIN32_FIND_DATA structure differs from the
  19. // Windows WIN32_FIND_DATA stucture so we copy the Windows CE
  20. // definition to here so that both sides match.
  21. //
  22. typedef struct _CE_FIND_DATA {
  23. DWORD dwFileAttributes;
  24. FILETIME ftCreationTime;
  25. FILETIME ftLastAccessTime;
  26. FILETIME ftLastWriteTime;
  27. DWORD nFileSizeHigh;
  28. DWORD nFileSizeLow;
  29. DWORD dwOID;
  30. WCHAR cFileName[MAX_PATH];
  31. } CE_FIND_DATA, *LPCE_FIND_DATA;
  32. typedef CE_FIND_DATA** LPLPCE_FIND_DATA;
  33. //
  34. // These are flags for CeFindAllFiles
  35. //
  36. #define FAF_ATTRIBUTES ((DWORD) 0x01)
  37. #define FAF_CREATION_TIME ((DWORD) 0x02)
  38. #define FAF_LASTACCESS_TIME ((DWORD) 0x04)
  39. #define FAF_LASTWRITE_TIME ((DWORD) 0x08)
  40. #define FAF_SIZE_HIGH ((DWORD) 0x10)
  41. #define FAF_SIZE_LOW ((DWORD) 0x20)
  42. #define FAF_OID ((DWORD) 0x40)
  43. #define FAF_NAME ((DWORD) 0x80)
  44. #define FAF_FLAG_COUNT ((UINT) 8)
  45. #define FAF_ATTRIB_CHILDREN ((DWORD) 0x01000)
  46. #define FAF_ATTRIB_NO_HIDDEN ((DWORD) 0x02000)
  47. #define FAF_FOLDERS_ONLY ((DWORD) 0x04000)
  48. #define FAF_NO_HIDDEN_SYS_ROMMODULES ((DWORD) 0x08000)
  49. #define FAF_GETTARGET ((DWORD) 0x10000)
  50. #define FAD_OID ((WORD) 0x01)
  51. #define FAD_FLAGS ((WORD) 0x02)
  52. #define FAD_NAME ((WORD) 0x04)
  53. #define FAD_TYPE ((WORD) 0x08)
  54. #define FAD_NUM_RECORDS ((WORD) 0x10)
  55. #define FAD_NUM_SORT_ORDER ((WORD) 0x20)
  56. #define FAD_SIZE ((WORD) 0x40)
  57. #define FAD_LAST_MODIFIED ((WORD) 0x80)
  58. #define FAD_SORT_SPECS ((WORD) 0x100)
  59. #define FAD_FLAG_COUNT ((UINT) 9)
  60. #ifndef FILE_ATTRIBUTE_INROM
  61. #define FILE_ATTRIBUTE_INROM 0x00000040
  62. #endif
  63. #ifndef FILE_ATTRIBUTE_ROMSTATICREF
  64. #define FILE_ATTRIBUTE_ROMSTATICREF 0x00001000
  65. #endif
  66. #ifndef FILE_ATTRIBUTE_ROMMODULE
  67. #define FILE_ATTRIBUTE_ROMMODULE 0x00002000
  68. #endif
  69. //
  70. // The following is not a standard Windows CE File Attribute.
  71. //
  72. #ifndef FILE_ATTRIBUTE_HAS_CHILDREN
  73. #define FILE_ATTRIBUTE_HAS_CHILDREN 0x00010000
  74. #endif
  75. #ifndef FILE_ATTRIBUTE_SHORTCUT
  76. #define FILE_ATTRIBUTE_SHORTCUT 0x00020000
  77. #endif
  78. #undef INTERFACE
  79. #define INTERFACE IRAPIStream
  80. typedef enum tagRAPISTREAMFLAG
  81. {
  82. STREAM_TIMEOUT_READ
  83. } RAPISTREAMFLAG;
  84. DECLARE_INTERFACE_ (IRAPIStream, IStream)
  85. {
  86. STDMETHOD(SetRapiStat)( THIS_ RAPISTREAMFLAG Flag, DWORD dwValue) PURE;
  87. STDMETHOD(GetRapiStat)( THIS_ RAPISTREAMFLAG Flag, DWORD *pdwValue) PURE;
  88. };
  89. // RAPI extension on Windows CE (e.g., MyFunctionFOO) called via CeRapiInvoke should be declared as:
  90. // EXTERN_C RAPIEXT MyFunctionFOO;
  91. typedef HRESULT (STDAPICALLTYPE RAPIEXT)(
  92. DWORD cbInput, // [IN]
  93. BYTE *pInput, // [IN]
  94. DWORD *pcbOutput, // [OUT]
  95. BYTE **ppOutput, // [OUT]
  96. IRAPIStream *pIRAPIStream // [IN]
  97. );
  98. //
  99. // The following definitions are for the client side only,
  100. // because they are already defined on Windows CE.
  101. //
  102. #ifndef UNDER_CE
  103. #include <stddef.h>
  104. typedef struct STORE_INFORMATION {
  105. DWORD dwStoreSize;
  106. DWORD dwFreeSize;
  107. } STORE_INFORMATION, *LPSTORE_INFORMATION;
  108. typedef DWORD CEPROPID;
  109. typedef CEPROPID *PCEPROPID;
  110. #define TypeFromPropID(propid) LOWORD(propid)
  111. typedef DWORD CEOID;
  112. typedef CEOID *PCEOID;
  113. typedef struct _CEGUID {
  114. DWORD Data1;
  115. DWORD Data2;
  116. DWORD Data3;
  117. DWORD Data4;
  118. } CEGUID;
  119. typedef CEGUID *PCEGUID;
  120. typedef struct _CENOTIFICATION {
  121. DWORD dwSize;
  122. DWORD dwParam;
  123. UINT uType;
  124. CEGUID guid;
  125. CEOID oid;
  126. CEOID oidParent;
  127. } CENOTIFICATION;
  128. #define CEDB_EXNOTIFICATION 0x00000001
  129. typedef struct _CENOTIFYREQUEST {
  130. DWORD dwSize;
  131. HWND hwnd;
  132. DWORD dwFlags;
  133. HANDLE hHeap;
  134. DWORD dwParam;
  135. } CENOTIFYREQUEST;
  136. typedef CENOTIFYREQUEST *PCENOTIFYREQUEST;
  137. typedef struct _CEFILEINFO {
  138. DWORD dwAttributes;
  139. CEOID oidParent;
  140. WCHAR szFileName[MAX_PATH];
  141. FILETIME ftLastChanged;
  142. DWORD dwLength;
  143. } CEFILEINFO;
  144. typedef struct _CEDIRINFO {
  145. DWORD dwAttributes;
  146. CEOID oidParent;
  147. WCHAR szDirName[MAX_PATH];
  148. } CEDIRINFO;
  149. typedef struct _CERECORDINFO {
  150. CEOID oidParent;
  151. } CERECORDINFO;
  152. #define CEDB_SORT_DESCENDING 0x00000001
  153. #define CEDB_SORT_CASEINSENSITIVE 0x00000002
  154. #define CEDB_SORT_UNKNOWNFIRST 0x00000004
  155. #define CEDB_SORT_GENERICORDER 0x00000008
  156. typedef struct _SORTORDERSPEC {
  157. CEPROPID propid;
  158. DWORD dwFlags;
  159. } SORTORDERSPEC;
  160. #define CEDB_MAXDBASENAMELEN 32
  161. #define CEDB_MAXSORTORDER 4
  162. #define CEDB_VALIDNAME 0x0001
  163. #define CEDB_VALIDTYPE 0x0002
  164. #define CEDB_VALIDSORTSPEC 0x0004
  165. #define CEDB_VALIDMODTIME 0x0008
  166. #define CEDB_VALIDDBFLAGS 0x0010
  167. #define CEDB_VALIDCREATE (CEDB_VALIDNAME|CEDB_VALIDTYPE|CEDB_VALIDSORTSPEC|CEDB_VALIDDBFLAGS)
  168. #define CEDB_NOCOMPRESS 0x00010000
  169. typedef struct _CEDBASEINFO {
  170. DWORD dwFlags;
  171. WCHAR szDbaseName[CEDB_MAXDBASENAMELEN];
  172. DWORD dwDbaseType;
  173. WORD wNumRecords;
  174. WORD wNumSortOrder;
  175. DWORD dwSize;
  176. FILETIME ftLastModified;
  177. SORTORDERSPEC rgSortSpecs[CEDB_MAXSORTORDER];
  178. } CEDBASEINFO;
  179. typedef struct _CEDB_FIND_DATA {
  180. CEOID OidDb;
  181. CEDBASEINFO DbInfo;
  182. } CEDB_FIND_DATA, *LPCEDB_FIND_DATA;
  183. typedef CEDB_FIND_DATA ** LPLPCEDB_FIND_DATA;
  184. #define OBJTYPE_INVALID 0
  185. #define OBJTYPE_FILE 1
  186. #define OBJTYPE_DIRECTORY 2
  187. #define OBJTYPE_DATABASE 3
  188. #define OBJTYPE_RECORD 4
  189. typedef struct _CEOIDINFO {
  190. WORD wObjType;
  191. WORD wPad;
  192. union {
  193. CEFILEINFO infFile;
  194. CEDIRINFO infDirectory;
  195. CEDBASEINFO infDatabase;
  196. CERECORDINFO infRecord;
  197. };
  198. } CEOIDINFO;
  199. #define CEDB_AUTOINCREMENT 0x00000001
  200. #define CEDB_SEEK_CEOID 0x00000001
  201. #define CEDB_SEEK_BEGINNING 0x00000002
  202. #define CEDB_SEEK_END 0x00000004
  203. #define CEDB_SEEK_CURRENT 0x00000008
  204. #define CEDB_SEEK_VALUESMALLER 0x00000010
  205. #define CEDB_SEEK_VALUEFIRSTEQUAL 0x00000020
  206. #define CEDB_SEEK_VALUEGREATER 0x00000040
  207. #define CEDB_SEEK_VALUENEXTEQUAL 0x00000080
  208. typedef struct _CEBLOB {
  209. DWORD dwCount;
  210. LPBYTE lpb;
  211. } CEBLOB;
  212. #define CEVT_I2 2
  213. #define CEVT_UI2 18
  214. #define CEVT_I4 3
  215. #define CEVT_UI4 19
  216. #define CEVT_FILETIME 64
  217. #define CEVT_LPWSTR 31
  218. #define CEVT_BLOB 65
  219. #define CEVT_BOOL 11
  220. #define CEVT_R8 5
  221. typedef union _CEVALUNION {
  222. short iVal;
  223. USHORT uiVal;
  224. long lVal;
  225. ULONG ulVal;
  226. FILETIME filetime;
  227. LPWSTR lpwstr;
  228. CEBLOB blob;
  229. BOOL boolVal;
  230. double dblVal;
  231. } CEVALUNION;
  232. #define CEDB_PROPNOTFOUND 0x0100
  233. #define CEDB_PROPDELETE 0x0200
  234. typedef struct _CEPROPVAL {
  235. CEPROPID propid;
  236. WORD wLenData;
  237. WORD wFlags;
  238. CEVALUNION val;
  239. } CEPROPVAL, *PCEPROPVAL;
  240. #define CEDB_MAXDATABLOCKSIZE 4092
  241. #define CEDB_MAXPROPDATASIZE (CEDB_MAXDATABLOCKSIZE*16)
  242. #define CEDB_MAXRECORDSIZE (128*1024)
  243. #define CEDB_ALLOWREALLOC 0x00000001
  244. #define CREATE_SYSTEMGUID(pguid) (memset((pguid), 0, sizeof(CEGUID)))
  245. #define CREATE_INVALIDGUID(pguid) (memset((pguid), -1, sizeof(CEGUID)))
  246. #define CHECK_SYSTEMGUID(pguid) !((pguid)->Data1|(pguid)->Data2|(pguid)->Data3|(pguid)->Data4)
  247. #define CHECK_INVALIDGUID(pguid) !~((pguid)->Data1&(pguid)->Data2&(pguid)->Data3&(pguid)->Data4)
  248. #define SYSMEM_CHANGED 0
  249. #define SYSMEM_MUSTREBOOT 1
  250. #define SYSMEM_REBOOTPENDING 2
  251. #define SYSMEM_FAILED 3
  252. typedef struct _CEOSVERSIONINFO{
  253. DWORD dwOSVersionInfoSize;
  254. DWORD dwMajorVersion;
  255. DWORD dwMinorVersion;
  256. DWORD dwBuildNumber;
  257. DWORD dwPlatformId;
  258. WCHAR szCSDVersion[ 128 ];
  259. } CEOSVERSIONINFO, *LPCEOSVERSIONINFO;
  260. #define AC_LINE_OFFLINE 0x00
  261. #define AC_LINE_ONLINE 0x01
  262. #define AC_LINE_BACKUP_POWER 0x02
  263. #define AC_LINE_UNKNOWN 0xFF
  264. #define BATTERY_FLAG_HIGH 0x01
  265. #define BATTERY_FLAG_LOW 0x02
  266. #define BATTERY_FLAG_CRITICAL 0x04
  267. #define BATTERY_FLAG_CHARGING 0x08
  268. #define BATTERY_FLAG_NO_BATTERY 0x80
  269. #define BATTERY_FLAG_UNKNOWN 0xFF
  270. #define BATTERY_PERCENTAGE_UNKNOWN 0xFF
  271. #define BATTERY_LIFE_UNKNOWN 0xFFFFFFFF
  272. typedef struct _SYSTEM_POWER_STATUS_EX {
  273. BYTE ACLineStatus;
  274. BYTE BatteryFlag;
  275. BYTE BatteryLifePercent;
  276. BYTE Reserved1;
  277. DWORD BatteryLifeTime;
  278. DWORD BatteryFullLifeTime;
  279. BYTE Reserved2;
  280. BYTE BackupBatteryFlag;
  281. BYTE BackupBatteryLifePercent;
  282. BYTE Reserved3;
  283. DWORD BackupBatteryLifeTime;
  284. DWORD BackupBatteryFullLifeTime;
  285. } SYSTEM_POWER_STATUS_EX, *PSYSTEM_POWER_STATUS_EX, *LPSYSTEM_POWER_STATUS_EX;
  286. //
  287. // MessageId: CERAPI_E_ALREADYINITIALIZED
  288. //
  289. // CeRapiInit(Ex) has already been successfully called
  290. //
  291. #define CERAPI_E_ALREADYINITIALIZED 0x80041001
  292. typedef struct _RAPIINIT
  293. {
  294. DWORD cbSize;
  295. HANDLE heRapiInit;
  296. HRESULT hrRapiInit;
  297. } RAPIINIT;
  298. STDAPI CeRapiInitEx(RAPIINIT*);
  299. STDAPI CeRapiInit();
  300. STDAPI CeRapiUninit();
  301. STDAPI CeRapiGetError(void);
  302. STDAPI CeRapiFreeBuffer(LPVOID);
  303. STDAPI_( HRESULT ) CeRapiInvoke(LPCWSTR, LPCWSTR,DWORD,BYTE *, DWORD *,BYTE **, IRAPIStream **,DWORD);
  304. STDAPI_(CEOID) CeCreateDatabase (LPWSTR, DWORD, WORD, SORTORDERSPEC*);
  305. STDAPI_(BOOL ) CeDeleteDatabase (CEOID);
  306. STDAPI_(BOOL ) CeDeleteRecord (HANDLE, CEOID);
  307. STDAPI_(HANDLE) CeFindFirstDatabase (DWORD);
  308. STDAPI_(CEOID) CeFindNextDatabase (HANDLE);
  309. STDAPI_(BOOL ) CeOidGetInfo (CEOID, CEOIDINFO*);
  310. STDAPI_(HANDLE) CeOpenDatabase (PCEOID, LPWSTR, CEPROPID, DWORD, HWND);
  311. STDAPI_(CEOID) CeReadRecordProps (HANDLE, DWORD, LPWORD, CEPROPID*, LPBYTE*, LPDWORD);
  312. STDAPI_(CEOID) CeSeekDatabase (HANDLE, DWORD, DWORD, LPDWORD);
  313. STDAPI_(BOOL ) CeSetDatabaseInfo (CEOID, CEDBASEINFO*);
  314. STDAPI_(CEOID) CeWriteRecordProps (HANDLE, CEOID, WORD, CEPROPVAL*);
  315. STDAPI_(HANDLE) CeFindFirstFile (LPCWSTR, LPCE_FIND_DATA);
  316. STDAPI_(BOOL ) CeFindNextFile (HANDLE, LPCE_FIND_DATA);
  317. STDAPI_(BOOL ) CeFindClose (HANDLE);
  318. STDAPI_(DWORD ) CeGetFileAttributes (LPCWSTR);
  319. STDAPI_(BOOL ) CeSetFileAttributes (LPCWSTR, DWORD);
  320. STDAPI_(HANDLE) CeCreateFile (LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);
  321. STDAPI_(BOOL ) CeReadFile (HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED);
  322. STDAPI_(BOOL ) CeWriteFile (HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED);
  323. STDAPI_(BOOL ) CeCloseHandle (HANDLE);
  324. STDAPI_(BOOL ) CeFindAllFiles (LPCWSTR, DWORD, LPDWORD, LPLPCE_FIND_DATA);
  325. STDAPI_(BOOL ) CeFindAllDatabases (DWORD, WORD, LPWORD, LPLPCEDB_FIND_DATA);
  326. STDAPI_(DWORD ) CeGetLastError (void);
  327. STDAPI_(DWORD ) CeSetFilePointer (HANDLE, LONG, PLONG, DWORD);
  328. STDAPI_(BOOL ) CeSetEndOfFile (HANDLE);
  329. STDAPI_(BOOL ) CeCreateDirectory (LPCWSTR, LPSECURITY_ATTRIBUTES);
  330. STDAPI_(BOOL ) CeRemoveDirectory (LPCWSTR);
  331. STDAPI_(BOOL ) CeCreateProcess (LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, BOOL, DWORD, LPVOID, LPWSTR, LPSTARTUPINFO, LPPROCESS_INFORMATION);
  332. STDAPI_(BOOL ) CeMoveFile (LPCWSTR, LPCWSTR);
  333. STDAPI_(BOOL ) CeCopyFile (LPCWSTR, LPCWSTR, BOOL);
  334. STDAPI_(BOOL ) CeDeleteFile (LPCWSTR);
  335. STDAPI_(DWORD ) CeGetFileSize (HANDLE, LPDWORD);
  336. STDAPI_(LONG ) CeRegOpenKeyEx (HKEY, LPCWSTR, DWORD, REGSAM, PHKEY);
  337. STDAPI_(LONG ) CeRegEnumKeyEx (HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPWSTR, LPDWORD, PFILETIME);
  338. STDAPI_(LONG ) CeRegCreateKeyEx (HKEY, LPCWSTR, DWORD, LPWSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD);
  339. STDAPI_(LONG ) CeRegCloseKey (HKEY);
  340. STDAPI_(LONG ) CeRegDeleteKey (HKEY, LPCWSTR);
  341. STDAPI_(LONG ) CeRegEnumValue (HKEY, DWORD, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
  342. STDAPI_(LONG ) CeRegDeleteValue (HKEY, LPCWSTR);
  343. STDAPI_(LONG ) CeRegQueryInfoKey (HKEY, LPWSTR, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, LPDWORD, PFILETIME);
  344. STDAPI_(LONG ) CeRegQueryValueEx (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD);
  345. STDAPI_(LONG ) CeRegSetValueEx (HKEY, LPCWSTR, DWORD, DWORD, LPBYTE, DWORD);
  346. STDAPI_(BOOL ) CeGetStoreInformation(LPSTORE_INFORMATION);
  347. STDAPI_(INT ) CeGetSystemMetrics (INT);
  348. STDAPI_(INT ) CeGetDesktopDeviceCaps(INT);
  349. STDAPI_(VOID ) CeGetSystemInfo (LPSYSTEM_INFO);
  350. STDAPI_(DWORD ) CeSHCreateShortcut (LPWSTR, LPWSTR);
  351. STDAPI_(BOOL ) CeSHGetShortcutTarget(LPWSTR, LPWSTR, INT);
  352. STDAPI_(BOOL ) CeCheckPassword (LPWSTR);
  353. STDAPI_(BOOL ) CeGetFileTime (HANDLE, LPFILETIME, LPFILETIME, LPFILETIME);
  354. STDAPI_(BOOL ) CeSetFileTime (HANDLE, LPFILETIME, LPFILETIME, LPFILETIME);
  355. STDAPI_(BOOL ) CeGetVersionEx (LPCEOSVERSIONINFO);
  356. STDAPI_(HWND ) CeGetWindow (HWND, UINT);
  357. STDAPI_(LONG ) CeGetWindowLong (HWND, int);
  358. STDAPI_(int ) CeGetWindowText (HWND, LPWSTR, int);
  359. STDAPI_(int ) CeGetClassName (HWND, LPWSTR, int);
  360. STDAPI_(VOID ) CeGlobalMemoryStatus (LPMEMORYSTATUS);
  361. STDAPI_(BOOL ) CeGetSystemPowerStatusEx(PSYSTEM_POWER_STATUS_EX, BOOL);
  362. STDAPI_(DWORD ) CeGetTempPath (DWORD, LPWSTR);
  363. STDAPI_(DWORD ) CeGetSpecialFolderPath(int, DWORD, LPWSTR);
  364. STDAPI_(HANDLE) CeFindFirstDatabaseEx (PCEGUID, DWORD);
  365. STDAPI_(CEOID ) CeFindNextDatabaseEx (HANDLE, PCEGUID);
  366. STDAPI_(CEOID ) CeCreateDatabaseEx (PCEGUID, CEDBASEINFO*);
  367. STDAPI_(BOOL ) CeSetDatabaseInfoEx (PCEGUID, CEOID, CEDBASEINFO*);
  368. STDAPI_(HANDLE) CeOpenDatabaseEx (PCEGUID, PCEOID, LPWSTR, CEPROPID, DWORD, CENOTIFYREQUEST *);
  369. STDAPI_(BOOL ) CeDeleteDatabaseEx (PCEGUID, CEOID);
  370. STDAPI_(CEOID ) CeReadRecordPropsEx (HANDLE, DWORD, LPWORD, CEPROPID*, LPBYTE*, LPDWORD, HANDLE);
  371. STDAPI_(CEOID ) CeWriteRecordProps (HANDLE, CEOID, WORD, CEPROPVAL*);
  372. STDAPI_(BOOL ) CeMountDBVol (PCEGUID, LPWSTR, DWORD);
  373. STDAPI_(BOOL ) CeUnmountDBVol (PCEGUID);
  374. STDAPI_(BOOL ) CeFlushDBVol (PCEGUID);
  375. STDAPI_(BOOL ) CeEnumDBVolumes (PCEGUID, LPWSTR, DWORD);
  376. STDAPI_(BOOL ) CeOidGetInfoEx (PCEGUID, CEOID, CEOIDINFO*);
  377. #endif // #ifndef UNDER_CE
  378. #include <ceapimap.h>
  379. #ifdef CONN_INTERNAL
  380. #include <prapi.h> // internal defines
  381. #endif
  382. #endif // #ifndef RAPI_H