Hex Artifact Content

Not logged in

Artifact f5377fbd24e425cd47a6092c8d6c657c9c2d9212:


0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  /***************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0a 2a 20 20 20 20 20  ********\.*     
0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0060: 20 20 20 20 20 20 20 20 20 20 20 20 72 61 70 69              rapi
0070: 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20  .d              
0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0090: 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20    *.*           
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20              *.* 
00e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
00f0: 20 20 20 20 20 20 57 69 6e 64 6f 77 73 20 41 50        Windows AP
0100: 49 20 68 65 61 64 65 72 20 6d 6f 64 75 6c 65 20  I header module 
0110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0120: 20 20 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20        *.*       
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0170: 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20  *.*             
0180: 20 20 20 20 54 72 61 6e 73 6c 61 74 65 64 20 66      Translated f
0190: 72 6f 6d 20 4d 69 6e 47 57 20 57 69 6e 64 6f 77  rom MinGW Window
01a0: 73 20 68 65 61 64 65 72 73 20 20 20 20 20 20 20  s headers       
01b0: 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 20 20            *.*   
01c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
01d0: 20 20 20 20 20 20 20 20 62 79 20 53 74 65 77 61          by Stewa
01e0: 72 74 20 47 6f 72 64 6f 6e 20 20 20 20 20 20 20  rt Gordon       
01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0200: 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20      *.*         
0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a                *.
0250: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  *               
0260: 20 20 20 20 20 20 20 20 50 6c 61 63 65 64 20 69          Placed i
0270: 6e 74 6f 20 70 75 62 6c 69 63 20 64 6f 6d 61 69  nto public domai
0280: 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  n               
0290: 20 20 20 20 20 20 20 20 2a 0a 5c 2a 2a 2a 2a 2a          *.\*****
02a0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a  ****************
02e0: 2a 2a 2f 0a 6d 6f 64 75 6c 65 20 77 69 6e 33 32  **/.module win32
02f0: 2e 72 61 70 69 3b 0a 0a 2f 2a 20 43 6f 6d 6d 65  .rapi;../* Comme
0300: 6e 74 20 66 72 6f 6d 20 4d 69 6e 47 57 0a 09 4e  nt from MinGW..N
0310: 4f 54 45 3a 20 54 68 69 73 20 73 74 72 69 63 74  OTE: This strict
0320: 6c 79 20 64 6f 65 73 20 6e 6f 74 20 62 65 6c 6f  ly does not belo
0330: 6e 67 20 69 6e 20 74 68 65 20 57 69 6e 33 32 20  ng in the Win32 
0340: 41 50 49 20 73 69 6e 63 65 20 69 74 27 73 0a 09  API since it's..
0350: 72 65 61 6c 6c 79 20 70 61 72 74 20 6f 66 20 50  really part of P
0360: 6c 61 74 66 6f 72 6d 20 53 44 4b 2e 0a 20 2a 2f  latform SDK.. */
0370: 0a 0a 70 72 69 76 61 74 65 20 69 6d 70 6f 72 74  ..private import
0380: 20 77 69 6e 33 32 2e 77 69 6e 62 61 73 65 2c 20   win32.winbase, 
0390: 77 69 6e 33 32 2e 77 69 6e 64 65 66 3b 0a 0a 73  win32.windef;..s
03a0: 74 72 75 63 74 20 49 52 41 50 49 53 74 72 65 61  truct IRAPIStrea
03b0: 6d 20 7b 0a 09 49 52 41 50 49 53 74 72 65 61 6d  m {..IRAPIStream
03c0: 56 74 62 6c 2a 20 6c 70 56 74 62 6c 3b 0a 7d 0a  Vtbl* lpVtbl;.}.
03d0: 0a 65 6e 75 6d 20 52 41 50 49 53 54 52 45 41 4d  .enum RAPISTREAM
03e0: 46 4c 41 47 20 7b 0a 09 53 54 52 45 41 4d 5f 54  FLAG {..STREAM_T
03f0: 49 4d 45 4f 55 54 5f 52 45 41 44 0a 7d 0a 0a 65  IMEOUT_READ.}..e
0400: 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 73 29 20  xtern (Windows) 
0410: 7b 0a 09 61 6c 69 61 73 20 48 52 45 53 55 4c 54  {..alias HRESULT
0420: 20 66 75 6e 63 74 69 6f 6e 28 49 52 41 50 49 53   function(IRAPIS
0430: 74 72 65 61 6d 2a 2c 20 52 41 50 49 53 54 52 45  tream*, RAPISTRE
0440: 41 4d 46 4c 41 47 2c 20 44 57 4f 52 44 29 20 20  AMFLAG, DWORD)  
0450: 5f 53 65 74 52 61 70 69 53 74 61 74 3b 0a 09 61  _SetRapiStat;..a
0460: 6c 69 61 73 20 48 52 45 53 55 4c 54 20 66 75 6e  lias HRESULT fun
0470: 63 74 69 6f 6e 28 49 52 41 50 49 53 74 72 65 61  ction(IRAPIStrea
0480: 6d 2a 2c 20 52 41 50 49 53 54 52 45 41 4d 46 4c  m*, RAPISTREAMFL
0490: 41 47 2c 20 44 57 4f 52 44 2a 29 20 5f 47 65 74  AG, DWORD*) _Get
04a0: 52 61 70 69 53 74 61 74 3b 0a 7d 0a 0a 73 74 72  RapiStat;.}..str
04b0: 75 63 74 20 49 52 41 50 49 53 74 72 65 61 6d 56  uct IRAPIStreamV
04c0: 74 62 6c 20 7b 0a 09 5f 53 65 74 52 61 70 69 53  tbl {.._SetRapiS
04d0: 74 61 74 20 53 65 74 52 61 70 69 53 74 61 74 3b  tat SetRapiStat;
04e0: 0a 09 5f 47 65 74 52 61 70 69 53 74 61 74 20 47  .._GetRapiStat G
04f0: 65 74 52 61 70 69 53 74 61 74 3b 0a 7d 0a 0a 2f  etRapiStat;.}../
0500: 2f 20 46 49 58 4d 45 3a 20 77 68 61 74 27 73 20  / FIXME: what's 
0510: 74 68 69 73 3f 0a 2f 2f 74 79 70 65 64 65 66 20  this?.//typedef 
0520: 48 52 45 53 55 4c 54 28 53 54 44 41 50 49 43 41  HRESULT(STDAPICA
0530: 4c 4c 54 59 50 45 20 52 41 50 49 45 58 54 29 28  LLTYPE RAPIEXT)(
0540: 44 57 4f 52 44 2c 20 42 59 54 45 2c 20 44 57 4f  DWORD, BYTE, DWO
0550: 52 44 2c 20 42 59 54 45 2c 20 49 52 41 50 49 53  RD, BYTE, IRAPIS
0560: 74 72 65 61 6d 2a 29 3b 0a 0a 73 74 72 75 63 74  tream*);..struct
0570: 20 52 41 50 49 49 4e 49 54 20 7b 0a 09 44 57 4f   RAPIINIT {..DWO
0580: 52 44 20 20 20 63 62 53 69 7a 65 20 3d 20 74 68  RD   cbSize = th
0590: 69 73 2e 73 69 7a 65 6f 66 3b 0a 09 48 41 4e 44  is.sizeof;..HAND
05a0: 4c 45 20 20 68 65 52 61 70 69 49 6e 69 74 3b 0a  LE  heRapiInit;.
05b0: 09 48 52 45 53 55 4c 54 20 68 72 52 61 70 69 49  .HRESULT hrRapiI
05c0: 6e 69 74 3b 0a 7d 0a 0a 65 78 74 65 72 6e 20 28  nit;.}..extern (
05d0: 57 69 6e 64 6f 77 73 29 20 7b 0a 09 48 52 45 53  Windows) {..HRES
05e0: 55 4c 54 20 43 65 52 61 70 69 49 6e 69 74 28 29  ULT CeRapiInit()
05f0: 3b 0a 09 48 52 45 53 55 4c 54 20 43 65 52 61 70  ;..HRESULT CeRap
0600: 69 49 6e 69 74 45 78 28 52 41 50 49 49 4e 49 54  iInitEx(RAPIINIT
0610: 2a 29 3b 0a 09 42 4f 4f 4c 20 43 65 43 72 65 61  *);..BOOL CeCrea
0620: 74 65 50 72 6f 63 65 73 73 28 4c 50 43 57 53 54  teProcess(LPCWST
0630: 52 2c 20 4c 50 43 57 53 54 52 2c 20 4c 50 53 45  R, LPCWSTR, LPSE
0640: 43 55 52 49 54 59 5f 41 54 54 52 49 42 55 54 45  CURITY_ATTRIBUTE
0650: 53 2c 0a 09 20 20 4c 50 53 45 43 55 52 49 54 59  S,..  LPSECURITY
0660: 5f 41 54 54 52 49 42 55 54 45 53 2c 20 42 4f 4f  _ATTRIBUTES, BOO
0670: 4c 2c 20 44 57 4f 52 44 2c 20 4c 50 56 4f 49 44  L, DWORD, LPVOID
0680: 2c 20 4c 50 57 53 54 52 2c 20 4c 50 53 54 41 52  , LPWSTR, LPSTAR
0690: 54 55 50 49 4e 46 4f 2c 0a 09 20 20 4c 50 50 52  TUPINFO,..  LPPR
06a0: 4f 43 45 53 53 5f 49 4e 46 4f 52 4d 41 54 49 4f  OCESS_INFORMATIO
06b0: 4e 29 3b 0a 09 48 52 45 53 55 4c 54 20 43 65 52  N);..HRESULT CeR
06c0: 61 70 69 55 6e 69 6e 69 74 28 29 3b 0a 09 42 4f  apiUninit();..BO
06d0: 4f 4c 20 43 65 57 72 69 74 65 46 69 6c 65 28 48  OL CeWriteFile(H
06e0: 41 4e 44 4c 45 2c 20 4c 50 43 56 4f 49 44 2c 20  ANDLE, LPCVOID, 
06f0: 44 57 4f 52 44 2c 20 4c 50 44 57 4f 52 44 2c 20  DWORD, LPDWORD, 
0700: 4c 50 4f 56 45 52 4c 41 50 50 45 44 29 3b 0a 09  LPOVERLAPPED);..
0710: 48 41 4e 44 4c 45 20 43 65 43 72 65 61 74 65 46  HANDLE CeCreateF
0720: 69 6c 65 28 4c 50 43 57 53 54 52 2c 20 44 57 4f  ile(LPCWSTR, DWO
0730: 52 44 2c 20 44 57 4f 52 44 2c 20 4c 50 53 45 43  RD, DWORD, LPSEC
0740: 55 52 49 54 59 5f 41 54 54 52 49 42 55 54 45 53  URITY_ATTRIBUTES
0750: 2c 20 44 57 4f 52 44 2c 0a 09 20 20 44 57 4f 52  , DWORD,..  DWOR
0760: 44 2c 20 48 41 4e 44 4c 45 29 3b 0a 09 42 4f 4f  D, HANDLE);..BOO
0770: 4c 20 43 65 43 72 65 61 74 65 44 69 72 65 63 74  L CeCreateDirect
0780: 6f 72 79 28 4c 50 43 57 53 54 52 2c 20 4c 50 53  ory(LPCWSTR, LPS
0790: 45 43 55 52 49 54 59 5f 41 54 54 52 49 42 55 54  ECURITY_ATTRIBUT
07a0: 45 53 29 3b 0a 09 44 57 4f 52 44 20 43 65 47 65  ES);..DWORD CeGe
07b0: 74 4c 61 73 74 45 72 72 6f 72 28 29 3b 0a 09 42  tLastError();..B
07c0: 4f 4f 4c 20 43 65 47 65 74 46 69 6c 65 54 69 6d  OOL CeGetFileTim
07d0: 65 28 48 41 4e 44 4c 45 2c 20 4c 50 46 49 4c 45  e(HANDLE, LPFILE
07e0: 54 49 4d 45 2c 20 4c 50 46 49 4c 45 54 49 4d 45  TIME, LPFILETIME
07f0: 2c 20 4c 50 46 49 4c 45 54 49 4d 45 29 3b 0a 09  , LPFILETIME);..
0800: 42 4f 4f 4c 20 43 65 43 6c 6f 73 65 48 61 6e 64  BOOL CeCloseHand
0810: 6c 65 28 48 41 4e 44 4c 45 29 3b 0a 7d 0a        le(HANDLE);.}.