home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / Emulation_Include_Files / windbase.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  14.9 KB  |  401 lines

  1. /**
  2.  
  3.  Copyright (c) 1995, Microsoft Corporation
  4.  
  5.  Module: windbase.h
  6.  
  7.  Purpose: Master include file for WINCE Database APIs
  8.  
  9. **/
  10.  
  11. // @doc OBJSTORE
  12. /*
  13. @topic Windows CE Object Store |
  14.     The Windows CE object store has 3 parts - a registry API, a dile system API and a database API. 
  15.     <nl>The standard Win32 API's supported by the registry are:
  16.     <nl>RegCloseKey 
  17.     <nl>RegCreateKeyEx
  18.     <nl>RegDeleteKey
  19.     <nl>RegDeleteValue
  20.     <nl>RegEnumValue
  21.     <nl>RegEnumKeyEx
  22.     <nl>RegOpenKeyEx
  23.     <nl>RegQueryInfoKey
  24.     <nl>RegQueryValueEx
  25.     <nl>RegSetValueEx
  26.  
  27.     The standard Win32 API's supported by the filesytem are:
  28.     <nl>CreateDirectory
  29.     <nl>RemoveDirectory
  30.     <nl>MoveFile
  31.     <nl>CopyFile
  32.     <nl>DeleteFile
  33.     <nl>GetFileAttributes
  34.     <nl>FindFirstFile
  35.     <nl>CreateFileW
  36.     <nl>ReadFile
  37.     <nl>WriteFile
  38.     <nl>GetFileSize
  39.     <nl>SetFilePointer
  40.     <nl>GetFileInformationByHandle
  41.     <nl>FlushFileBuffers
  42.     <nl>GetFileTime
  43.     <nl>SetFileTime
  44.     <nl>SetEndOfFile
  45.     <nl>FindClose
  46.     <nl>FindNextFile
  47.  
  48.     In addition, the following additional filesystem call is available:
  49.     <nl>CreateContainer
  50.  
  51.     The various functions and data structures are described in this
  52.     document.
  53. */
  54.  
  55. #ifndef __WINDBASE__
  56. #define __WINDBASE__
  57.  
  58. // @CESYSGEN IF CE_MODULES_FILESYS
  59.  
  60. /*
  61. @type CEOID | Unique identifier for all WINCE objects
  62. @comm Every WINCE object can be efficiently referred to by its OID. OID's are unique
  63.     in the system and are not reused 
  64. */
  65. typedef DWORD CEOID;
  66. typedef CEOID *PCEOID;
  67.  
  68. typedef struct  _CEGUID {
  69.     DWORD Data1;
  70.     DWORD Data2;
  71.     DWORD Data3;
  72.     DWORD Data4;
  73. }    CEGUID;
  74. typedef CEGUID *PCEGUID;
  75.  
  76. #define CEDB_EXNOTIFICATION    0x00000001
  77. typedef struct _CENOTIFYREQUEST {
  78.     DWORD dwSize;    // must be set to the structure size
  79.     HWND  hwnd;        // window handle for notifications to be posted
  80.     DWORD dwFlags;    
  81.     HANDLE hHeap;    // heap from which to allocate EX-NOTIFICATIONS
  82.     DWORD  dwParam;
  83. } CENOTIFYREQUEST;
  84. typedef CENOTIFYREQUEST *PCENOTIFYREQUEST;
  85.  
  86.  
  87. typedef struct _CENOTIFICATION {
  88.     DWORD dwSize;
  89.     DWORD dwParam;
  90.     UINT  uType;
  91.     CEGUID guid;
  92.     CEOID  oid;
  93.     CEOID  oidParent;
  94. } CENOTIFICATION;
  95. typedef CENOTIFICATION *PCENOTIFICATION;
  96.  
  97. // @CESYSGEN IF FILESYS_FSMAIN
  98.  
  99. // @struct CEFILEINFO | Contains information about a file object    
  100. typedef struct _CEFILEINFO {
  101.     DWORD   dwAttributes;       //@field File attributes
  102.     CEOID     oidParent;          //@field CEOID of parent directory
  103.     WCHAR szFileName[MAX_PATH]; //@field Full path name of the file
  104.     FILETIME ftLastChanged;     //@field Time stamp of last change
  105.     DWORD   dwLength;           //@field Length of file
  106. } CEFILEINFO;
  107.  
  108. //@struct CEDIRINFO | Contains information about a directory object    
  109. typedef struct _CEDIRINFO {
  110.     DWORD   dwAttributes;       //@field Directory attributes
  111.     CEOID  oidParent;          //@field CEOID of parent directory
  112.     WCHAR   szDirName[MAX_PATH]; //@field Full path name of the directory
  113. } CEDIRINFO;
  114.  
  115. /*
  116. @msg DB_CEOID_CREATED | Msg sent on creation of new oid
  117. @comm WParam == CEOID modified
  118.       LParam == CEOID's parent CEOID
  119. @xref <f CeRegisterReplNotification>      
  120. */
  121. #define DB_CEOID_CREATED    (WM_USER + 0x1)
  122. /*
  123. @msg DB_CEOID_DATABASE_DELETED | Msg sent on deletion of database
  124. @comm WParam == CEOID modified
  125.       LParam == CEOID's parent CEOID
  126. @xref <f CeRegisterReplNotification>      
  127. */
  128. #define DB_CEOID_DATABASE_DELETED    (WM_USER + 0x2)
  129. /*
  130. @msg DB_CEOID_RECORD_DELETED | Msg sent on deletion of record
  131. @comm WParam == CEOID modified
  132.       LParam == CEOID's parent CEOID
  133. @xref <f CeRegisterReplNotification>      
  134. */
  135. #define DB_CEOID_RECORD_DELETED    (WM_USER + 0x3)
  136. /*
  137. @msg DB_CEOID_FILE_DELETED | Msg sent on deletion of file
  138. @comm WParam == CEOID modified
  139.       LParam == CEOID's parent CEOID
  140. @xref <f CeRegisterReplNotification>
  141. */
  142. #define DB_CEOID_FILE_DELETED    (WM_USER + 0x4)
  143. /*
  144. @msg DB_CEOID_DIRECTORY_DELETED | Msg sent on deletion of directory
  145. @comm WParam == CEOID modified
  146.       LParam == CEOID's parent CEOID
  147. @xref <f CeRegisterReplNotification>      
  148. */
  149. #define DB_CEOID_DIRECTORY_DELETED    (WM_USER + 0x5)
  150. /*
  151. @msg DB_CEOID_CHANGED | Msg sent on item modification
  152. @comm WParam == CEOID modified
  153.       LParam == CEOID's parent CEOID
  154. @xref <f CeRegisterReplNotification>      
  155. */
  156. #define DB_CEOID_CHANGED    (WM_USER + 0x6)
  157.  
  158. // flags for CeGetReplChangeMask
  159. #define REPL_CHANGE_WILLCLEAR    0x00000001
  160.  
  161. typedef struct STORE_INFORMATION {
  162.     DWORD dwStoreSize;
  163.     DWORD dwFreeSize;
  164. } STORE_INFORMATION, *LPSTORE_INFORMATION;
  165.  
  166. BOOL WINAPI GetStoreInformation (LPSTORE_INFORMATION lpsi);
  167.  
  168. // @CESYSGEN ENDIF
  169.  
  170.  
  171. // @CESYSGEN IF FILESYS_FSDBASE
  172.  
  173. /*
  174. @type CEPROPID | PropID's for WINCE properties
  175. @comm PropID's on the WINCE match PropID's used by Mapi1. The top 2 bytes are an ID
  176.      and the low 2 bytes are the type. For a list of supported types look at the tags
  177.      supported in <t CEVALUNION>. We reserve one bit (0x4000) in the type as the 
  178.      flag <b CEPROPVAL_NULL> as a special flag. It denotes that a property was not 
  179.      found in a Read call, or that the property should be deleted in a write call.
  180. */
  181. typedef DWORD CEPROPID;
  182. typedef CEPROPID *PCEPROPID;
  183. #define TypeFromPropID(propid) LOWORD(propid)
  184.  
  185. //@struct CERECORDINFO | Contains information about a record object    
  186. typedef struct _CERECORDINFO {
  187.     CEOID  oidParent;          //@field CEOID of parent database
  188. } CERECORDINFO;
  189.  
  190. #define CEDB_SORT_DESCENDING         0x00000001
  191. #define CEDB_SORT_CASEINSENSITIVE    0x00000002
  192. #define CEDB_SORT_UNKNOWNFIRST       0x00000004
  193. #define CEDB_SORT_GENERICORDER       0x00000008  // internally used for generic ordering
  194. //@struct SORTORDERSPEC | Specifies details about a sort order in a database
  195. //@comm Note that we only support simple sorts on a primary key. Records with the same key value
  196. //      will be sorted in arbitrary order.
  197. typedef struct _SORTORDERSPEC {
  198.     CEPROPID  propid;     //@field PropID to be sorted on. Sorts on binary properties are not allowed.
  199.     DWORD   dwFlags;    //@field Any combination of the following
  200.                         //@flag SORT_DESCENDING | Sort in descending order. Default is ascending
  201.                         //@flag SORT_CASEINSENSITIVE | Only valid for strings
  202.                         //@flag SORT_UNKNOWNFIRST | Puts records which do not contain this property
  203.                         // before all the other records. Default is to put them last.
  204. } SORTORDERSPEC;
  205.  
  206. #define CEDB_MAXDBASENAMELEN 32
  207. #define CEDB_MAXSORTORDER   4
  208.  
  209. // values for validity mask flags
  210. #define CEDB_VALIDNAME     0x0001
  211. #define CEDB_VALIDTYPE     0x0002
  212. #define CEDB_VALIDSORTSPEC 0x0004
  213. #define CEDB_VALIDMODTIME    0x0008
  214. #define CEDB_VALIDDBFLAGS    0x0010
  215. #define CEDB_VALIDCREATE (CEDB_VALIDNAME|CEDB_VALIDTYPE|CEDB_VALIDSORTSPEC|CEDB_VALIDDBFLAGS)
  216.  
  217. // values for dbflags
  218. #define CEDB_NOCOMPRESS        0x00010000
  219.  
  220.  
  221. // @struct CEDBASEINFO | Contains information about a database object    
  222. typedef struct _CEDBASEINFO {
  223.     DWORD   dwFlags;            //@field Indicates which fields are valid. Possible values are:
  224.                                 //@flag CEDB_VALIDNAME | The name field is valid and should be used
  225.                                 //@flag CEDB_VALIDTYPE | The type field is valid and should be used
  226.                                 //@flag CEDB_VALIDSORTSPEC | The sortspecs are valid and should be used
  227.     WCHAR   szDbaseName[CEDB_MAXDBASENAMELEN]; //@field Name of Database. Max 32 characters
  228.     DWORD   dwDbaseType;        //@field A type ID for this database
  229.     WORD    wNumRecords;        //@field Number of records in the database
  230.     WORD    wNumSortOrder;      //@field Number of sort orders active in the database - maximum is 4.
  231.     DWORD    dwSize;                //@field Size in bytes that this database is using
  232.     FILETIME ftLastModified;        //@field Last time this database was modified
  233.     SORTORDERSPEC rgSortSpecs[CEDB_MAXSORTORDER];  //@field Actual sort order descriptions. 
  234.                                 // Only first wNumSortOrder of this array are valid.
  235. } CEDBASEINFO;
  236.  
  237.  
  238. // flags for open database - use low word
  239. #define CEDB_AUTOINCREMENT     0x00000001
  240.  
  241. #define CEDB_SEEK_CEOID       0x00000001
  242. #define CEDB_SEEK_BEGINNING    0x00000002
  243. #define CEDB_SEEK_END          0x00000004
  244. #define CEDB_SEEK_CURRENT      0x00000008
  245. #define CEDB_SEEK_VALUESMALLER     0x00000010
  246. #define CEDB_SEEK_VALUEFIRSTEQUAL  0x00000020
  247. #define CEDB_SEEK_VALUEGREATER     0x00000040
  248. #define CEDB_SEEK_VALUENEXTEQUAL   0x00000080
  249.  
  250.  
  251. typedef struct _CEBLOB {
  252.     DWORD           dwCount;
  253.     LPBYTE          lpb;
  254. } CEBLOB;
  255.  
  256.  
  257. #define CEVT_I2       2
  258. #define CEVT_UI2      18
  259. #define CEVT_I4       3
  260. #define CEVT_UI4      19
  261. #define CEVT_FILETIME 64
  262. #define CEVT_LPWSTR   31
  263. #define CEVT_BLOB     65
  264. #define CEVT_BOOL      11
  265. #define    CEVT_R8       5
  266.  
  267. // @union CEVALUNION | value types for a property
  268. typedef union _CEVALUNION {
  269.     short           iVal;   //@field CEVT_I2
  270.     USHORT          uiVal;  //@field CEVT_UI2
  271.     long            lVal;   //@field CEVT_I4
  272.     ULONG           ulVal;  //@field CEVT_UI4
  273.     FILETIME        filetime; //@field CEVT_FILETIME 
  274.     LPWSTR          lpwstr; //@field CEVT_LPWSTR - Ptr to null terminated string
  275.     CEBLOB          blob;   //@field CEVT_BLOB - DWORD count, and Ptr to bytes
  276.     BOOL            boolVal; //@field CEVT_BOOL
  277.     double            dblVal;  //@field CEVT_R8
  278. } CEVALUNION;
  279.  
  280. // @struct CEPROPVAL | Contains a property value
  281. // dont define flags in low byte
  282. #define CEDB_PROPNOTFOUND 0x0100
  283. #define CEDB_PROPDELETE   0x0200
  284. typedef struct _CEPROPVAL {
  285.     CEPROPID   propid; //@field PropID of the value.
  286.     WORD        wLenData; //@field Private field - can be garbage on entry
  287.     WORD        wFlags; // @field Special flags for this property. Possible flags
  288.                          // @flag CE_PROPNOTFOUND | Set by <f CeReadRecordProps> if property not found
  289.                          // @flag CE_PROPDELETE | If passed to <f CeWriteRecordProps> it causes 
  290.                          // this property to be deleted
  291.     CEVALUNION val;    //@field Actual value for simple types, ptr for strings/blobs                        
  292. } CEPROPVAL;
  293. typedef CEPROPVAL *PCEPROPVAL;
  294.  
  295. // Max record length defines
  296. // zero is a valid length so we cant have full 4196
  297. #define CEDB_MAXDATABLOCKSIZE 4092
  298. #define CEDB_MAXPROPDATASIZE  ((CEDB_MAXDATABLOCKSIZE*16)-1)
  299. // max record size is bound only by the max logging space we want to consume
  300. // this is not explicitly checked for - if you read too much data and cause the log
  301. // page to overflow the call will fail.
  302. #define CEDB_MAXRECORDSIZE  (128*1024)
  303.  
  304. // flags for ReadRecord
  305. #define CEDB_ALLOWREALLOC  0x00000001
  306.  
  307. #define CREATE_SYSTEMGUID(pguid) (memset((pguid), 0, sizeof(CEGUID)))
  308. #define CREATE_INVALIDGUID(pguid) (memset((pguid), -1, sizeof(CEGUID)))
  309.  
  310. #define CHECK_SYSTEMGUID(pguid) !((pguid)->Data1|(pguid)->Data2|(pguid)->Data3|(pguid)->Data4)
  311. #define CHECK_INVALIDGUID(pguid) !~((pguid)->Data1&(pguid)->Data2&(pguid)->Data3&(pguid)->Data4)
  312.  
  313. // Obsolete versions for backward compatibility
  314. HANDLE WINAPI CeFindFirstDatabase (DWORD dwClassID);
  315. CEOID  WINAPI CeFindNextDatabase (HANDLE hEnum);
  316. CEOID  WINAPI CeCreateDatabase (LPWSTR lpszname, DWORD dwClassID, WORD wNumSortOrder, SORTORDERSPEC *rgSortSpecs);
  317. BOOL   WINAPI CeSetDatabaseInfo (CEOID oidDbase, CEDBASEINFO *pNewInfo);
  318. HANDLE WINAPI CeOpenDatabase (PCEOID poid, LPWSTR lpszName, CEPROPID propid, DWORD dwFlags, HWND hwndNotify);
  319. BOOL   WINAPI CeDeleteDatabase (CEOID oid);
  320. CEOID  WINAPI CeReadRecordProps (HANDLE hDbase, DWORD dwFlags, LPWORD lpcPropID, CEPROPID *rgPropID, LPBYTE *lplpBuffer, LPDWORD lpcbBuffer);
  321.  
  322. HANDLE WINAPI CeFindFirstDatabaseEx (PCEGUID pguid, DWORD dwClassID);
  323. CEOID  WINAPI CeFindNextDatabaseEx (HANDLE hEnum, PCEGUID pguid);
  324. CEOID  WINAPI CeCreateDatabaseEx (PCEGUID pguid, CEDBASEINFO *pInfo);
  325. BOOL   WINAPI CeSetDatabaseInfoEx (PCEGUID pguid, CEOID oidDbase, CEDBASEINFO *pNewInfo);
  326. HANDLE WINAPI CeOpenDatabaseEx (PCEGUID pguid, PCEOID poid, LPWSTR lpszName, CEPROPID propid, DWORD dwFlags, CENOTIFYREQUEST *pReq);
  327. BOOL   WINAPI CeDeleteDatabaseEx (PCEGUID pguid, CEOID oid);
  328. CEOID  WINAPI CeSeekDatabase (HANDLE hDatabase, DWORD dwSeekType, DWORD dwValue, LPDWORD lpdwIndex);
  329. BOOL   WINAPI CeDeleteRecord (HANDLE hDatabase, CEOID oidRecord);
  330. CEOID  WINAPI CeReadRecordPropsEx (HANDLE hDbase, DWORD dwFlags, LPWORD lpcPropID, CEPROPID *rgPropID, LPBYTE *lplpBuffer,
  331.     LPDWORD lpcbBuffer, HANDLE hHeap);
  332. CEOID  WINAPI CeWriteRecordProps (HANDLE hDbase, CEOID oidRecord, WORD cPropID, CEPROPVAL *rgPropVal);
  333.  
  334. BOOL   WINAPI CeMountDBVol(PCEGUID pguid, LPWSTR lpszVol, DWORD dwFlags);
  335. BOOL   WINAPI CeUnmountDBVol(PCEGUID pguid);
  336. BOOL   WINAPI CeFlushDBVol(PCEGUID pguid);
  337. BOOL   WINAPI CeEnumDBVolumes(PCEGUID pguid, LPWSTR lpBuf, DWORD dwSize);
  338. BOOL   WINAPI CeFreeNotification(PCENOTIFYREQUEST pRequest, PCENOTIFICATION pNotify);
  339.  
  340. // @CESYSGEN ENDIF
  341.  
  342.  
  343. // @CESYSGEN IF FILESYS_FSMAIN
  344.  
  345. /*
  346. @struct CEOIDINFO | Contains information about a WINCE object
  347. @field WORD | wObjType | Type of object
  348.    @flag   OBJTYPE_INVALID   | There was no valid object with this CEOID
  349.    @flag   OBJTYPE_FILE      | The object is a file
  350.    @flag   OBJTYPE_DIRECTORY | The object is a directory
  351.    @flag   OBJTYPE_DATABASE  | The object is a database
  352.    @flag   OBJTYPE_RECORD    | The object is a record inside a database
  353. @field <lt>SeeBelow<gt> | <lt>CEOIDINFOUNIONref<gt> | Note: The remaining members form a union
  354. @field CEFILEINFO   | infFile      | Valid for file objects
  355. @field CEDIRINFO    | infDirectory | Valid for directory objects
  356. @field CEDBASEINFO  | infDatabase  | Valid for database objects
  357. @field CERECORDINFO | infRecord    | Valid for record objects
  358. @xref   <t CEFILEINFO>  <t CEDIRINFO> <t CEDBASEINFO>  <t CERECORDINFO>
  359. */
  360. #define OBJTYPE_INVALID     0
  361. #define OBJTYPE_FILE        1
  362. #define OBJTYPE_DIRECTORY   2
  363. #define OBJTYPE_DATABASE    3
  364. #define OBJTYPE_RECORD      4
  365.  
  366. typedef struct _CEOIDINFO {
  367.     WORD  wObjType;             //Type of object
  368.             //        OBJTYPE_INVALID   | There was no valid object with this CEOID
  369.             //        OBJTYPE_FILE      | The object is a file
  370.             //        OBJTYPE_DIRECTORY | The object is a directory
  371.             //        OBJTYPE_DATABASE  | The object is a database
  372.             //        OBJTYPE_RECORD    | The object is a record inside a database
  373.     WORD   wPad;    // dword alignment
  374.     union {     //This is a union
  375.         CEFILEINFO  infFile;           //Valid for file objects
  376.         CEDIRINFO   infDirectory;      //Valid for directory objects
  377. // @CESYSGEN IF FILESYS_FSDBASE
  378.         CEDBASEINFO infDatabase;       //Valid for database objects
  379.         CERECORDINFO infRecord;        //Valid for record objects
  380. // @CESYSGEN ENDIF
  381.     };
  382. } CEOIDINFO;
  383.  
  384. // Functions
  385. BOOL WINAPI CeOidGetInfoEx (PCEGUID pguid, CEOID oid, CEOIDINFO *oidInfo);
  386. BOOL WINAPI CeOidGetInfo (CEOID oid, CEOIDINFO *oidInfo);
  387.  
  388. // @CESYSGEN ENDIF
  389.  
  390. #ifdef WINCEOEM
  391. #include <pwindbas.h>    // internal defines
  392. #ifdef WINCEMACRO
  393. #include <mwindbas.h>
  394. #endif
  395. #endif
  396.  
  397. // @CESYSGEN ENDIF
  398.  
  399. #endif
  400.  
  401.