syscall.h 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936
  1. /*++
  2. Copyright (c) 2013 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. syscall.h
  5. Abstract:
  6. This header contains definitions for the kernel interface to user-mode.
  7. Author:
  8. Evan Green 6-Feb-2013
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // --------------------------------------------------------------------- Macros
  15. //
  16. //
  17. // This macro determines whether or not a system call is eligible for being
  18. // restarted.
  19. //
  20. #define IS_SYSTEM_CALL_RESTARTABLE(_SystemCallNumber, _SystemCallResult) \
  21. (((_SystemCallResult) == STATUS_RESTART_SYSTEM_CALL) && \
  22. ((_SystemCallNumber) != SystemCallRestoreContext) && \
  23. ((_SystemCallNumber) != SystemCallExecuteImage))
  24. //
  25. // ---------------------------------------------------------------- Definitions
  26. //
  27. //
  28. // Define the attributes applied to all system call structures (namely
  29. // alignment for fast copies).
  30. //
  31. #define SYSCALL_STRUCT ALIGNED64
  32. #define SYS_WAIT_TIME_INDEFINITE MAX_ULONG
  33. #define SYS_WAIT_TIME_MAX (MAX_ULONG - 1)
  34. //
  35. // Define open flags.
  36. //
  37. #define SYS_OPEN_FLAG_CREATE 0x00000001
  38. #define SYS_OPEN_FLAG_TRUNCATE 0x00000002
  39. #define SYS_OPEN_FLAG_FAIL_IF_EXISTS 0x00000004
  40. #define SYS_OPEN_FLAG_APPEND 0x00000008
  41. #define SYS_OPEN_FLAG_DIRECTORY 0x00000010
  42. #define SYS_OPEN_FLAG_NON_BLOCKING 0x00000020
  43. #define SYS_OPEN_FLAG_SHARED_MEMORY 0x00000040
  44. #define SYS_OPEN_FLAG_NO_SYMBOLIC_LINK 0x00000080
  45. #define SYS_OPEN_FLAG_SYNCHRONIZED 0x00000100
  46. #define SYS_OPEN_FLAG_NO_CONTROLLING_TERMINAL 0x00000200
  47. #define SYS_OPEN_FLAG_NO_ACCESS_TIME 0x00000400
  48. #define SYS_OPEN_FLAG_ASYNCHRONOUS 0x00000800
  49. #define SYS_OPEN_ACCESS_SHIFT 29
  50. #define SYS_OPEN_FLAG_READ (IO_ACCESS_READ << SYS_OPEN_ACCESS_SHIFT)
  51. #define SYS_OPEN_FLAG_WRITE (IO_ACCESS_WRITE << SYS_OPEN_ACCESS_SHIFT)
  52. #define SYS_OPEN_FLAG_EXECUTE (IO_ACCESS_EXECUTE << SYS_OPEN_ACCESS_SHIFT)
  53. #define SYS_OPEN_FLAG_CLOSE_ON_EXECUTE 0x10000000
  54. //
  55. // Define the mask of system call open flags that get translated directly to
  56. // kernel open flags.
  57. //
  58. #define SYS_OPEN_FLAG_MASK \
  59. (SYS_OPEN_FLAG_CREATE | \
  60. SYS_OPEN_FLAG_TRUNCATE | \
  61. SYS_OPEN_FLAG_FAIL_IF_EXISTS | \
  62. SYS_OPEN_FLAG_APPEND | \
  63. SYS_OPEN_FLAG_DIRECTORY | \
  64. SYS_OPEN_FLAG_NON_BLOCKING | \
  65. SYS_OPEN_FLAG_SHARED_MEMORY | \
  66. SYS_OPEN_FLAG_NO_SYMBOLIC_LINK | \
  67. SYS_OPEN_FLAG_SYNCHRONIZED | \
  68. SYS_OPEN_FLAG_NO_CONTROLLING_TERMINAL | \
  69. SYS_OPEN_FLAG_NO_ACCESS_TIME | \
  70. SYS_OPEN_FLAG_ASYNCHRONOUS)
  71. #define SYS_FILE_CONTROL_EDITABLE_STATUS_FLAGS \
  72. (SYS_OPEN_FLAG_APPEND | \
  73. SYS_OPEN_FLAG_NON_BLOCKING | \
  74. SYS_OPEN_FLAG_SYNCHRONIZED | \
  75. SYS_OPEN_FLAG_NO_ACCESS_TIME | \
  76. SYS_OPEN_FLAG_ASYNCHRONOUS)
  77. //
  78. // Define delete flags.
  79. //
  80. #define SYS_DELETE_FLAG_SHARED_MEMORY 0x00000001
  81. #define SYS_DELETE_FLAG_DIRECTORY 0x00000002
  82. //
  83. // Define mount flags.
  84. //
  85. #define SYS_MOUNT_FLAG_UNMOUNT 0x00000001
  86. #define SYS_MOUNT_FLAG_BIND 0x00000002
  87. #define SYS_MOUNT_FLAG_RECURSIVE 0x00000004
  88. #define SYS_MOUNT_FLAG_READ 0x00000008
  89. #define SYS_MOUNT_FLAG_WRITE 0x00000010
  90. #define SYS_MOUNT_FLAG_TARGET_UNLINKED 0x00000020
  91. #define SYS_MOUNT_FLAG_DETACH 0x00000040
  92. //
  93. // Define file I/O flags.
  94. //
  95. #define SYS_IO_FLAG_WRITE 0x00000001
  96. #define SYS_IO_FLAG_MASK 0x00000001
  97. //
  98. // Define flush flags.
  99. //
  100. #define SYS_FLUSH_FLAG_ALL 0x00000001
  101. #define SYS_FLUSH_FLAG_READ 0x00000002
  102. #define SYS_FLUSH_FLAG_WRITE 0x00000004
  103. #define SYS_FLUSH_FLAG_DISCARD 0x00000008
  104. //
  105. // Define memory mapping flags.
  106. //
  107. #define SYS_MAP_FLAG_READ 0x00000001
  108. #define SYS_MAP_FLAG_WRITE 0x00000002
  109. #define SYS_MAP_FLAG_EXECUTE 0x00000004
  110. #define SYS_MAP_FLAG_SHARED 0x00000008
  111. #define SYS_MAP_FLAG_FIXED 0x00000010
  112. #define SYS_MAP_FLAG_ANONYMOUS 0x00000020
  113. //
  114. // Define memory mapping flush flags.
  115. //
  116. #define SYS_MAP_FLUSH_FLAG_ASYNC 0x00000001
  117. //
  118. // Define wait system call flags.
  119. //
  120. //
  121. // Set this flag to return immediately if no signals are pending.
  122. //
  123. #define SYSTEM_CALL_WAIT_FLAG_RETURN_IMMEDIATELY 0x00000001
  124. //
  125. // Set this flag to wait specifically for children that have stopped, and
  126. // discard the signal when found.
  127. //
  128. #define SYSTEM_CALL_WAIT_FLAG_STOPPED_CHILDREN 0x00000002
  129. //
  130. // Set this flag to wait specifially for continued children, and discard the
  131. // signal when found.
  132. //
  133. #define SYSTEM_CALL_WAIT_FLAG_CONTINUED_CHILDREN 0x00000004
  134. //
  135. // This bitmask waits for any child action (exited, stopped, or continued).
  136. //
  137. #define SYSTEM_CALL_WAIT_FLAG_CHILD_MASK \
  138. (SYSTEM_CALL_WAIT_FLAG_EXITED_CHILDREN | \
  139. SYSTEM_CALL_WAIT_FLAG_STOPPED_CHILDREN | \
  140. SYSTEM_CALL_WAIT_FLAG_CONTINUED_CHILDREN)
  141. //
  142. // Set this flag to wait specifically for children that have exited, and
  143. // discard the signal when found.
  144. //
  145. #define SYSTEM_CALL_WAIT_FLAG_EXITED_CHILDREN 0x00000008
  146. //
  147. // Set this flag to not discard a pending child signal.
  148. //
  149. #define SYSTEM_CALL_WAIT_FLAG_DONT_DISCARD_CHILD 0x00000010
  150. //
  151. // Define the polling events.
  152. //
  153. #define POLL_EVENT_IN 0x00000001
  154. #define POLL_EVENT_IN_HIGH_PRIORITY 0x00000002
  155. #define POLL_EVENT_OUT 0x00000004
  156. #define POLL_EVENT_OUT_HIGH_PRIORITY 0x00000008
  157. #define POLL_EVENT_ERROR 0x00000010
  158. #define POLL_EVENT_DISCONNECTED 0x00000020
  159. #define POLL_EVENT_INVALID_HANDLE 0x00000040
  160. //
  161. // Define the mask of error events.
  162. //
  163. #define POLL_ERROR_EVENTS \
  164. (POLL_EVENT_ERROR | POLL_EVENT_DISCONNECTED | POLL_EVENT_INVALID_HANDLE)
  165. //
  166. // Define the mask of events that is always returned.
  167. //
  168. #define POLL_NONMASKABLE_EVENTS \
  169. (POLL_EVENT_ERROR | POLL_EVENT_DISCONNECTED | POLL_EVENT_INVALID_HANDLE)
  170. //
  171. // Define the mask of events that are always returned for files.
  172. //
  173. #define POLL_NONMASKABLE_FILE_EVENTS \
  174. (POLL_EVENT_IN | POLL_EVENT_IN_HIGH_PRIORITY | POLL_EVENT_OUT | \
  175. POLL_EVENT_OUT_HIGH_PRIORITY)
  176. //
  177. // Define the effective access permission flags.
  178. //
  179. #define EFFECTIVE_ACCESS_EXECUTE 0x00000001
  180. #define EFFECTIVE_ACCESS_WRITE 0x00000002
  181. #define EFFECTIVE_ACCESS_READ 0x00000004
  182. //
  183. // Define the timer control flags.
  184. //
  185. #define TIMER_CONTROL_FLAG_USE_TIMER_NUMBER 0x00000001
  186. #define TIMER_CONTROL_FLAG_SIGNAL_THREAD 0x00000002
  187. //
  188. // ------------------------------------------------------ Data Type Definitions
  189. //
  190. typedef enum _SYSTEM_CALL_NUMBER {
  191. SystemCallInvalid,
  192. SystemCallRestoreContext,
  193. SystemCallExitThread,
  194. SystemCallOpen,
  195. SystemCallClose,
  196. SystemCallPerformIo,
  197. SystemCallCreatePipe,
  198. SystemCallCreateThread,
  199. SystemCallForkProcess,
  200. SystemCallExecuteImage,
  201. SystemCallChangeDirectory,
  202. SystemCallSetSignalHandler,
  203. SystemCallSendSignal,
  204. SystemCallGetSetProcessId,
  205. SystemCallSetSignalBehavior,
  206. SystemCallWaitForChildProcess,
  207. SystemCallSuspendExecution,
  208. SystemCallExitProcess,
  209. SystemCallPoll,
  210. SystemCallSocketCreate,
  211. SystemCallSocketBind,
  212. SystemCallSocketListen,
  213. SystemCallSocketAccept,
  214. SystemCallSocketConnect,
  215. SystemCallSocketPerformIo,
  216. SystemCallFileControl,
  217. SystemCallGetSetFileInformation,
  218. SystemCallDebug,
  219. SystemCallSeek,
  220. SystemCallCreateSymbolicLink,
  221. SystemCallReadSymbolicLink,
  222. SystemCallDelete,
  223. SystemCallRename,
  224. SystemCallTimeZoneControl,
  225. SystemCallMountOrUnmount,
  226. SystemCallQueryTimeCounter,
  227. SystemCallTimerControl,
  228. SystemCallGetEffectiveAccess,
  229. SystemCallDelayExecution,
  230. SystemCallUserControl,
  231. SystemCallFlush,
  232. SystemCallGetResourceUsage,
  233. SystemCallLoadDriver,
  234. SystemCallFlushCache,
  235. SystemCallGetCurrentDirectory,
  236. SystemCallSocketGetSetInformation,
  237. SystemCallSocketShutdown,
  238. SystemCallCreateHardLink,
  239. SystemCallMapOrUnmapMemory,
  240. SystemCallFlushMemory,
  241. SystemCallLocateDeviceInformation,
  242. SystemCallGetSetDeviceInformation,
  243. SystemCallOpenDevice,
  244. SystemCallGetSetSystemInformation,
  245. SystemCallResetSystem,
  246. SystemCallSetSystemTime,
  247. SystemCallSetMemoryProtection,
  248. SystemCallSetThreadIdentity,
  249. SystemCallSetThreadPermissions,
  250. SystemCallSetSupplementaryGroups,
  251. SystemCallSocketCreatePair,
  252. SystemCallCreateTerminal,
  253. SystemCallSocketPerformVectoredIo,
  254. SystemCallSetThreadPointer,
  255. SystemCallUserLock,
  256. SystemCallSetThreadIdPointer,
  257. SystemCallSetUmask,
  258. SystemCallDuplicateHandle,
  259. SystemCallPerformVectoredIo,
  260. SystemCallSetITimer,
  261. SystemCallSetResourceLimit,
  262. SystemCallSetBreak,
  263. SystemCallCount
  264. } SYSTEM_CALL_NUMBER, *PSYSTEM_CALL_NUMBER;
  265. typedef enum _SIGNAL_MASK_OPERATION {
  266. SignalMaskOperationNone,
  267. SignalMaskOperationOverwrite,
  268. SignalMaskOperationSet,
  269. SignalMaskOperationClear,
  270. } SIGNAL_MASK_OPERATION, *PSIGNAL_MASK_OPERATION;
  271. typedef enum _SIGNAL_MASK_TYPE {
  272. SignalMaskTypeInvalid,
  273. SignalMaskBlocked,
  274. SignalMaskIgnored,
  275. SignalMaskHandled,
  276. SignalMaskPending,
  277. } SIGNAL_MASK_TYPE, *PSIGNAL_MASK_TYPE;
  278. typedef enum _SIGNAL_TARGET_TYPE {
  279. SignalTargetTypeInvalid,
  280. SignalTargetProcess,
  281. SignalTargetThread,
  282. SignalTargetAllProcesses,
  283. SignalTargetProcessGroup,
  284. SignalTargetCurrentProcess,
  285. SignalTargetCurrentProcessGroup,
  286. } SIGNAL_TARGET_TYPE, *PSIGNAL_TARGET_TYPE;
  287. typedef enum _FILE_LOCK_TYPE {
  288. FileLockInvalid,
  289. FileLockRead,
  290. FileLockReadWrite,
  291. FileLockUnlock,
  292. FileLockTypeCount
  293. } FILE_LOCK_TYPE, *PFILE_LOCK_TYPE;
  294. typedef enum _FILE_CONTROL_COMMAND {
  295. FileControlCommandInvalid,
  296. FileControlCommandDuplicate,
  297. FileControlCommandGetFlags,
  298. FileControlCommandSetFlags,
  299. FileControlCommandGetStatusAndAccess,
  300. FileControlCommandSetStatus,
  301. FileControlCommandGetSignalOwner,
  302. FileControlCommandSetSignalOwner,
  303. FileControlCommandGetLock,
  304. FileControlCommandSetLock,
  305. FileControlCommandBlockingSetLock,
  306. FileControlCommandGetFileInformation,
  307. FileControlCommandSetFileInformation,
  308. FileControlCommandSetDirectoryFlag,
  309. FileControlCommandCloseFrom,
  310. FileControlCommandGetPath,
  311. FileControlCommandCount
  312. } FILE_CONTROL_COMMAND, *PFILE_CONTROL_COMMAND;
  313. typedef enum _TIME_ZONE_OPERATION {
  314. TimeZoneOperationInvalid,
  315. TimeZoneOperationGetCurrentZoneData,
  316. TimeZoneOperationGetZoneData,
  317. TimeZoneOperationGetAllData,
  318. TimeZoneOperationSetZone
  319. } TIME_ZONE_OPERATION, *PTIME_ZONE_OPERATION;
  320. typedef enum _TIMER_OPERATION {
  321. TimerOperationInvalid,
  322. TimerOperationCreateTimer,
  323. TimerOperationDeleteTimer,
  324. TimerOperationGetTimer,
  325. TimerOperationSetTimer
  326. } TIMER_OPERATION, *PTIMER_OPERATION;
  327. typedef enum _ITIMER_TYPE {
  328. ITimerReal,
  329. ITimerVirtual,
  330. ITimerProfile,
  331. ITimerTypeCount
  332. } ITIMER_TYPE, *PITIMER_TYPE;
  333. typedef enum _RESOURCE_USAGE_REQUEST {
  334. ResourceUsageRequestInvalid,
  335. ResourceUsageRequestProcess,
  336. ResourceUsageRequestProcessChildren,
  337. ResourceUsageRequestThread,
  338. } RESOURCE_USAGE_REQUEST, *PRESOURCE_USAGE_REQUEST;
  339. //
  340. // System call parameter structures
  341. //
  342. /*++
  343. Structure Description:
  344. This structure defines the system call parameters for restoring thread
  345. context after handling a signal.
  346. Members:
  347. Context - Supplies a pointer to the context to restore. This context is
  348. architecture specific.
  349. --*/
  350. typedef struct _SYSTEM_CALL_RESTORE_CONTEXT {
  351. PSIGNAL_CONTEXT Context;
  352. } SYSCALL_STRUCT SYSTEM_CALL_RESTORE_CONTEXT, *PSYSTEM_CALL_RESTORE_CONTEXT;
  353. /*++
  354. Structure Description:
  355. This structure defines the system call parameters for exiting the current
  356. thread.
  357. Members:
  358. UnmapAddress - Supplies an optional pointer to a region to unmap (usually
  359. the thread stack if it was allocated in user mode).
  360. UnmapSize - Supplies the size of the region to unmap. This must be aligned
  361. to a page boundary.
  362. --*/
  363. typedef struct _SYSTEM_CALL_EXIT_THREAD {
  364. PVOID UnmapAddress;
  365. UINTN UnmapSize;
  366. } SYSCALL_STRUCT SYSTEM_CALL_EXIT_THREAD, *PSYSTEM_CALL_EXIT_THREAD;
  367. /*++
  368. Structure Description:
  369. This structure defines the system call parameters for the open call.
  370. Members:
  371. Directory - Stores an optional handle to the directory to start path
  372. traversal from if the specified path is relative. Supply INVALID_HANDLE
  373. here to use the current directory for relative paths.
  374. Path - Stores a pointer to a string containing the path of the object to
  375. open.
  376. PathBufferLength - Stores the length of the path buffer, in bytes,
  377. including the null terminator.
  378. Flags - Stores a bitfield of flags. See SYS_OPEN_FLAG_* definitions.
  379. CreatePermissions - Stores the permissions to apply to a created file.
  380. Status - Stores a status code which will represent the return value of the
  381. open file operation.
  382. Handle - Stores a handle where the file handle will be returned on success.
  383. --*/
  384. typedef struct _SYSTEM_CALL_OPEN {
  385. HANDLE Directory;
  386. PSTR Path;
  387. ULONG PathBufferLength;
  388. ULONG Flags;
  389. FILE_PERMISSIONS CreatePermissions;
  390. KSTATUS Status;
  391. HANDLE Handle;
  392. } SYSCALL_STRUCT SYSTEM_CALL_OPEN, *PSYSTEM_CALL_OPEN;
  393. /*++
  394. Structure Description:
  395. This structure defines the system call parameters for the close I/O
  396. handle call.
  397. Members:
  398. Handle - Stores the handle to close.
  399. Status - Stores the resulting status code from the kernel.
  400. --*/
  401. typedef struct _SYSTEM_CALL_CLOSE {
  402. HANDLE Handle;
  403. KSTATUS Status;
  404. } SYSCALL_STRUCT SYSTEM_CALL_CLOSE, *PSYSTEM_CALL_CLOSE;
  405. /*++
  406. Structure Description:
  407. This structure defines the system call parameters for the call to do I/O.
  408. Members:
  409. Handle - Stores the handle to do file I/O to.
  410. Buffer - Stores the buffer (in user mode) to read from or write to.
  411. Flags - Stores flags related to the I/O operation. See SYS_IO_FLAG_*
  412. definitions.
  413. TimeoutInMilliseconds - Stores the number of milliseconds that the I/O
  414. operation should be waited on before timing out. Use
  415. SYS_WAIT_TIME_INDEFINITE to wait forever on the I/O.
  416. Offset - Stores the offset the I/O should occur at. Supply -1ULL to use the
  417. current file pointer offset.
  418. Size - Stores the number of bytes of I/O to complete on input. On output
  419. returns the number of bytes successfully completed.
  420. BytesCompleted - Stores the number of bytes of I/O that were actually
  421. completed.
  422. Status - Stores the result of the I/O operation.
  423. --*/
  424. typedef struct _SYSTEM_CALL_PERFORM_IO {
  425. HANDLE Handle;
  426. PVOID Buffer;
  427. ULONG Flags;
  428. ULONG TimeoutInMilliseconds;
  429. IO_OFFSET Offset;
  430. UINTN Size;
  431. KSTATUS Status;
  432. } SYSCALL_STRUCT SYSTEM_CALL_PERFORM_IO, *PSYSTEM_CALL_PERFORM_IO;
  433. /*++
  434. Structure Description:
  435. This structure defines the system call parameters for the call to do I/O.
  436. Members:
  437. Handle - Stores the handle to do file I/O to.
  438. Buffer - Stores the buffer (in user mode) to read from or write to.
  439. Flags - Stores flags related to the I/O operation. See SYS_IO_FLAG_*
  440. definitions.
  441. TimeoutInMilliseconds - Stores the number of milliseconds that the I/O
  442. operation should be waited on before timing out. Use
  443. SYS_WAIT_TIME_INDEFINITE to wait forever on the I/O.
  444. Offset - Stores the offset the I/O should occur at. Supply -1ULL to use the
  445. current file pointer offset.
  446. Size - Stores the number of bytes of I/O to complete on input. On output
  447. returns the number of bytes successfully completed.
  448. VectoryArray - Stores a pointer to an array of I/O vector structures which
  449. specify the buffers to read or write.
  450. VectorCount - Stores the number of elements in the vector array.
  451. Status - Stores the result of the I/O operation.
  452. --*/
  453. typedef struct _SYSTEM_CALL_PERFORM_VECTORED_IO {
  454. HANDLE Handle;
  455. PVOID Buffer;
  456. ULONG Flags;
  457. ULONG TimeoutInMilliseconds;
  458. IO_OFFSET Offset;
  459. UINTN Size;
  460. PIO_VECTOR VectorArray;
  461. UINTN VectorCount;
  462. KSTATUS Status;
  463. } SYSCALL_STRUCT SYSTEM_CALL_PERFORM_VECTORED_IO,
  464. *PSYSTEM_CALL_PERFORM_VECTORED_IO;
  465. /*++
  466. Structure Description:
  467. This structure defines the system call parameters for the create pipe call.
  468. Members:
  469. Directory - Stores an optional handle to the directory to start path
  470. traversal from if the specified path is relative. Supply INVALID_HANDLE
  471. here to use the current directory for relative paths.
  472. Path - Stores an optional pointer to a names path for the pipe.
  473. PathLength - Stores the length of the path buffer in bytes, including the
  474. null terminator.
  475. OpenFlags - Stores the set of open flags associated with the handle. Only
  476. SYS_OPEN_FLAG_CLOSE_ON_EXECUTE and SYS_OPEN_FLAG_NON_BLOCKING are
  477. accepted.
  478. Permissions - Stores the permissions to apply to the new pipe.
  479. ReadHandle - Stores the returned handle to the read side of the pipe.
  480. WriteHandle - Stores the returned handle to the write side of the pipe.
  481. Status - Stores the completion status of the system call.
  482. --*/
  483. typedef struct _SYSTEM_CALL_CREATE_PIPE {
  484. HANDLE Directory;
  485. PSTR Path;
  486. ULONG PathLength;
  487. ULONG OpenFlags;
  488. FILE_PERMISSIONS Permissions;
  489. HANDLE ReadHandle;
  490. HANDLE WriteHandle;
  491. KSTATUS Status;
  492. } SYSCALL_STRUCT SYSTEM_CALL_CREATE_PIPE, *PSYSTEM_CALL_CREATE_PIPE;
  493. /*++
  494. Structure Description:
  495. This structure defines the system call parameters for the create thread
  496. call.
  497. Members:
  498. Name - Stores a pointer to an optional string containing the name of the
  499. new thread.
  500. NameBufferLength - Stores the length of the name buffer. Supply 0 if no
  501. name was given.
  502. ThreadRoutine - Stores a pointer to the function that should be executed
  503. on the new thread.
  504. Parameter - Stores a pointer parameter that will be passed directly to the
  505. thread routine.
  506. StackBase - Stores an optional pointer on input where the thread stack
  507. should be located. Supply NULL to have the stack placed anywhere. On
  508. output, contains the base address of the stack.
  509. StackSize - Stores the requested size of the stack for this thread. Supply
  510. 0 to use the system default value. On output, contains the actual size
  511. of the stack.
  512. ThreadPointer - Stores the thread pointer to set for the new thread.
  513. ThreadId - Stores an optional pointer where the thread ID is returned. This
  514. address is also set as the thread's thread ID address. If the thread
  515. terminates, zero is written to this value and a UserLockWake operation
  516. is called on that address to wake up one thread.
  517. Status - Stores the result of the thread creation.
  518. --*/
  519. typedef struct _SYSTEM_CALL_CREATE_THREAD {
  520. PSTR Name;
  521. ULONG NameBufferLength;
  522. PTHREAD_ENTRY_ROUTINE ThreadRoutine;
  523. PVOID Parameter;
  524. PVOID StackBase;
  525. ULONG StackSize;
  526. PVOID ThreadPointer;
  527. PTHREAD_ID ThreadId;
  528. KSTATUS Status;
  529. } SYSCALL_STRUCT SYSTEM_CALL_CREATE_THREAD, *PSYSTEM_CALL_CREATE_THREAD;
  530. /*++
  531. Structure Description:
  532. This structure defines the system call parameters for the fork system call.
  533. Members:
  534. Status - Stores the status result of the operation.
  535. ProcessId - Stores the process ID of the created process if this is the
  536. parent process, or 0 if this is the child process. This value must be
  537. ignored if the status code indicates failure.
  538. --*/
  539. typedef struct _SYSTEM_CALL_FORK_PROCESS {
  540. KSTATUS Status;
  541. PROCESS_ID ProcessId;
  542. } SYSCALL_STRUCT SYSTEM_CALL_FORK_PROCESS, *PSYSTEM_CALL_FORK_PROCESS;
  543. /*++
  544. Structure Description:
  545. This structure defines the system call parameters for the execute image
  546. system call.
  547. Members:
  548. Environment - Supplies the image name, arguments, and environment.
  549. --*/
  550. typedef struct _SYSTEM_CALL_EXECUTE_IMAGE {
  551. PROCESS_ENVIRONMENT Environment;
  552. } SYSCALL_STRUCT SYSTEM_CALL_EXECUTE_IMAGE, *PSYSTEM_CALL_EXECUTE_IMAGE;
  553. /*++
  554. Structure Description:
  555. This structure defines the system call parameters for changing the current
  556. directory or the root directory.
  557. Members:
  558. Root - Stores a boolean indicating whether to change the current working
  559. directory (FALSE) or the current root directory (TRUE).
  560. Buffer - Stores a pointer to the buffer containing the directory to change
  561. to. Either this parameter or the handle must be valid.
  562. BufferLength - Stores the length of the aforementioned buffer, in bytes,
  563. including the null terminator.
  564. Handle - Stores the open handle to the directory to change to. If this is
  565. not INVALID_HANDLE, then this will be used. Otherwise, the path
  566. pointed to by the buffer will be used.
  567. Status - Stores the result of the operation.
  568. --*/
  569. typedef struct _SYSTEM_CALL_CHANGE_DIRECTORY {
  570. BOOL Root;
  571. PSTR Buffer;
  572. ULONG BufferLength;
  573. HANDLE Handle;
  574. KSTATUS Status;
  575. } SYSCALL_STRUCT SYSTEM_CALL_CHANGE_DIRECTORY, *PSYSTEM_CALL_CHANGE_DIRECTORY;
  576. /*++
  577. Structure Description:
  578. This structure defines the system call parameters for setting a new signal
  579. handler routine.
  580. Members:
  581. SignalHandler - Stores a pointer to the user mode routine that will be
  582. called to handle signals. The parameters to the function are the
  583. signal number and optional parameter, both of which will be passed in
  584. registers. On output, this pointer will contain the original signal
  585. handler pointer, or NULL if no signal handler was previouly registered.
  586. --*/
  587. typedef struct _SYSTEM_CALL_SET_SIGNAL_HANDLER {
  588. PVOID SignalHandler;
  589. } SYSCALL_STRUCT SYSTEM_CALL_SET_SIGNAL_HANDLER,
  590. *PSYSTEM_CALL_SET_SIGNAL_HANDLER;
  591. /*++
  592. Structure Description:
  593. This structure defines the system call parameters for sending a signal to
  594. a process, process group, or thread.
  595. Members:
  596. TargetType - Supplies the target to which the signal is being sent. It can
  597. be either a process, process group, or thread.
  598. TargetId - Supplies the ID for the signal's target process, process group,
  599. or thread.
  600. SignalNumber - Stores the signal number to send.
  601. SignalCode - Stores the code to send. For user generated signals this must
  602. be less than or equal to 0, otherwise it will be set to 0. See
  603. SIGNAL_CODE_* definitions.
  604. SignalParameter - Stores the parameter to send with the signal for real time
  605. signals.
  606. Status - Stores the result returned by the kernel from the operation.
  607. --*/
  608. typedef struct _SYSTEM_CALL_SEND_SIGNAL {
  609. SIGNAL_TARGET_TYPE TargetType;
  610. ULONG TargetId;
  611. ULONG SignalNumber;
  612. SHORT SignalCode;
  613. UINTN SignalParameter;
  614. KSTATUS Status;
  615. } SYSCALL_STRUCT SYSTEM_CALL_SEND_SIGNAL, *PSYSTEM_CALL_SEND_SIGNAL;
  616. /*++
  617. Structure Description:
  618. This structure defines the system call parameters for getting and setting
  619. various process IDs, including the process ID, thread ID, process group
  620. ID, session ID, and parent process ID.
  621. Members:
  622. ProcessIdType - Stores the type of identifier to get or set. Not all types
  623. can be set.
  624. ProcessId - Stores the process ID parameter on input if applicable, and
  625. returns the result on success.
  626. NewValue - Stores the new value to set for types that can be set (like
  627. process group ID).
  628. Set - Stores a boolean indicating whether to get the process ID of the
  629. given type or set it.
  630. Status - Stores the resulting status code from the kernel.
  631. --*/
  632. typedef struct _SYSTEM_CALL_GET_SET_PROCESS_ID {
  633. PROCESS_ID_TYPE ProcessIdType;
  634. PROCESS_ID ProcessId;
  635. PROCESS_ID NewValue;
  636. BOOL Set;
  637. KSTATUS Status;
  638. } SYSCALL_STRUCT SYSTEM_CALL_GET_SET_PROCESS_ID,
  639. *PSYSTEM_CALL_GET_SET_PROCESS_ID;
  640. /*++
  641. Structure Description:
  642. This structure defines the system call parameters for setting the current
  643. thread signal behavior.
  644. Members:
  645. Operation - Stores the operation to perform: set, clear, or overwrite.
  646. MaskType - Stores the signal mask to operate on.
  647. SignalSet - Stores the new signal set on input. On output, contains the
  648. original signal set of the specified type.
  649. --*/
  650. typedef struct _SYSTEM_CALL_SET_SIGNAL_BEHAVIOR {
  651. SIGNAL_MASK_OPERATION Operation;
  652. SIGNAL_MASK_TYPE MaskType;
  653. SIGNAL_SET SignalSet;
  654. } SYSCALL_STRUCT SYSTEM_CALL_SET_SIGNAL_BEHAVIOR,
  655. *PSYSTEM_CALL_SET_SIGNAL_BEHAVIOR;
  656. /*++
  657. Structure Description:
  658. This structure defines the system call parameters for suspending execution
  659. until a signal comes in. This may be any old signal, or it may wait for
  660. and dequeue a child signal.
  661. Members:
  662. Flags - Stores a bitfield of flags governing behavior of the wait. See
  663. SYSTEM_CALL_WAIT_FLAG_* definititions.
  664. ChildPid - Stores the PID parameter to wait for on input. The value can be
  665. positive to wait on a specific pid, 0 to wait any child process whose
  666. process group is equal to that of the calling process, -1 to wait on
  667. any process, or another negative number to wait on a process whose
  668. process group ID is equal to the absolute value of the PID parameter.
  669. On output, contains the child PID causing the signal, returned by the
  670. kernel. If the parameter indicating that the wait is for a child is
  671. FALSE, this parameter should be ignored by user mode.
  672. ChildExitValue - Stores the exit status code returned by the child process
  673. if the reason was that the child exited. Otherwise, this contains the
  674. signal number that caused the child to terminate, dump, or stop.
  675. Reason - Stores the reason for the child event. See CHILD_SIGNAL_REASON_*
  676. definitions.
  677. ResourceUsage - Stores an optional pointer where the kernel will fill in
  678. resource usage of the child on success.
  679. Status - Stores the status returned by the kernel.
  680. --*/
  681. typedef struct _SYSTEM_CALL_WAIT_FOR_CHILD {
  682. ULONG Flags;
  683. PROCESS_ID ChildPid;
  684. UINTN ChildExitValue;
  685. ULONG Reason;
  686. PRESOURCE_USAGE ResourceUsage;
  687. KSTATUS Status;
  688. } SYSCALL_STRUCT SYSTEM_CALL_WAIT_FOR_CHILD, *PSYSTEM_CALL_WAIT_FOR_CHILD;
  689. /*++
  690. Structure Description:
  691. This structure defines the system call parameters for suspending execution
  692. until a signal comes in.
  693. Members:
  694. SignalOperation - Stores the operation to perform with the signal set: set,
  695. clear, overwrite, or none.
  696. SignalSet - Stores the signal set to apply for the duration of this call as
  697. dictated by the signal operation.
  698. TimeoutInMilliseconds - Stores the timeout in milliseconds the caller
  699. should wait. Set to SYS_WAIT_TIME_INDEFINITE to wait forever.
  700. Status - Stores the status returned by the kernel.
  701. SignalParameters - Stores an optional pointer where the signal information
  702. for the signal that occurred will be returned.
  703. --*/
  704. typedef struct _SYSTEM_CALL_SUSPEND_EXECUTION {
  705. SIGNAL_MASK_OPERATION SignalOperation;
  706. SIGNAL_SET SignalSet;
  707. ULONG TimeoutInMilliseconds;
  708. KSTATUS Status;
  709. PSIGNAL_PARAMETERS SignalParameters;
  710. } SYSCALL_STRUCT SYSTEM_CALL_SUSPEND_EXECUTION, *PSYSTEM_CALL_SUSPEND_EXECUTION;
  711. /*++
  712. Structure Description:
  713. This structure defines the system call parameters for exiting a process.
  714. Members:
  715. Status - Stores the exit status, returned to the parent in the wait calls.
  716. Conventionally 0 indicates success, and non-zero indicates failure.
  717. The C library only recieves the first eight bits of the return status,
  718. portable applications should not set bits beyond that.
  719. --*/
  720. typedef struct _SYSTEM_CALL_EXIT_PROCESS {
  721. UINTN Status;
  722. } SYSCALL_STRUCT SYSTEM_CALL_EXIT_PROCESS, *PSYSTEM_CALL_EXIT_PROCESS;
  723. /*++
  724. Structure Description:
  725. This structure defines an element in the array of file descriptors to be
  726. polled.
  727. Members:
  728. Handle - Stores the I/O handle to wait for.
  729. Events - Stores the bitmask of events to wait for.
  730. ReturnedEvents - Stores the bitmask of events that occurred for this file
  731. descriptor.
  732. --*/
  733. typedef struct _POLL_DESCRIPTOR {
  734. HANDLE Handle;
  735. USHORT Events;
  736. USHORT ReturnedEvents;
  737. } POLL_DESCRIPTOR, *PPOLL_DESCRIPTOR;
  738. /*++
  739. Structure Description:
  740. This structure defines the system call parameters for polling several I/O
  741. handles.
  742. Members:
  743. SignalMask - Stores an optional pointer to a signal mask to set for the
  744. duration of the poll.
  745. Descriptors - Stores a pointer to a buffer containing an array of poll
  746. descriptors.
  747. DescriptorCount - Stores the number of elements in the descriptors array.
  748. TimeoutInMilliseconds - Stores the number of milliseconds to wait for one
  749. of the descriptors to become ready before giving up.
  750. Status - Stores the return status of the call.
  751. DescriptorsSelected - Stores the number of descriptors that had activity,
  752. returned by the kernel.
  753. --*/
  754. typedef struct _SYSTEM_CALL_POLL {
  755. PSIGNAL_SET SignalMask;
  756. PPOLL_DESCRIPTOR Descriptors;
  757. ULONG DescriptorCount;
  758. ULONG TimeoutInMilliseconds;
  759. KSTATUS Status;
  760. ULONG DescriptorsSelected;
  761. } SYSCALL_STRUCT SYSTEM_CALL_POLL, *PSYSTEM_CALL_POLL;
  762. /*++
  763. Structure Description:
  764. This structure defines the system call parameters for creating a new
  765. socket.
  766. Members:
  767. Domain - Stores the network domain to use on the socket.
  768. Type - Stores the socket connection type.
  769. Protocol - Stores the raw network protocol to use on the socket.
  770. These are network specific. For example, for IPv4 and IPv6, the values
  771. are taken from the Internet Assigned Numbers Authority (IANA).
  772. OpenFlags - Stores an optional bitfield of open flags for the new socket.
  773. Only SYS_OPEN_FLAG_NON_BLOCKING and SYS_OPEN_FLAG_CLOSE_ON_EXECUTE
  774. are accepted.
  775. Socket - Stores the returned socket file descriptor on success.
  776. Status - Stores a status code which will represent the return value of the
  777. create socket operation.
  778. --*/
  779. typedef struct _SYSTEM_CALL_SOCKET_CREATE {
  780. NET_DOMAIN_TYPE Domain;
  781. NET_SOCKET_TYPE Type;
  782. ULONG Protocol;
  783. ULONG OpenFlags;
  784. HANDLE Socket;
  785. KSTATUS Status;
  786. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_CREATE, *PSYSTEM_CALL_SOCKET_CREATE;
  787. /*++
  788. Structure Description:
  789. This structure defines the system call parameters for binding a socket to
  790. an address.
  791. Members:
  792. Socket - Stores the socket to bind to.
  793. Address - Stores the local address to bind the socket to.
  794. Path - Stores a pointer to the path, in the case that this is a Unix socket.
  795. PathSize - Stores the size of the path, in bytes, including the null
  796. terminator.
  797. Status - Stores the resulting status of the attempted bind operation.
  798. --*/
  799. typedef struct _SYSTEM_CALL_SOCKET_BIND {
  800. HANDLE Socket;
  801. NETWORK_ADDRESS Address;
  802. PSTR Path;
  803. UINTN PathSize;
  804. KSTATUS Status;
  805. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_BIND, *PSYSTEM_CALL_SOCKET_BIND;
  806. /*++
  807. Structure Description:
  808. This structure defines the system call parameters for making a socket
  809. eligible to accept incoming connections.
  810. Members:
  811. Socket - Stores the socket to activate.
  812. BacklogCount - Stores a suggested number of pending (un-accepted) incoming
  813. connections the kernel should queue before rejecting additional
  814. incoming connections.
  815. Status - Stores the resulting status of the attempted listen operation.
  816. --*/
  817. typedef struct _SYSTEM_CALL_SOCKET_LISTEN {
  818. HANDLE Socket;
  819. ULONG BacklogCount;
  820. KSTATUS Status;
  821. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_LISTEN, *PSYSTEM_CALL_SOCKET_LISTEN;
  822. /*++
  823. Structure Description:
  824. This structure defines the system call parameters for accepting a new
  825. incoming connection on a listening socket.
  826. Members:
  827. Socket - Stores the socket to accept a new connection from.
  828. NewSocket - Stores the new socket file descriptor on success, which
  829. represents the new connection.
  830. Address - Stores the network address of the party that just created this
  831. new incoming connection.
  832. RemotePath - Stores a pointer where the remote path of the client socket
  833. will be copied on success. This only applies to local sockets.
  834. RemotePathSize - Stores on input the size of the remote path buffer. On
  835. output, contains the true size of the remote path, even if it was
  836. bigger than the input.
  837. OpenFlags - Stores an optional bitfield of open flags for the new socket.
  838. Only SYS_OPEN_FLAG_NON_BLOCKING and SYS_OPEN_FLAG_CLOSE_ON_EXECUTE
  839. are accepted.
  840. Status - Stores the resulting status of the attempted accept operation.
  841. --*/
  842. typedef struct _SYSTEM_CALL_SOCKET_ACCEPT {
  843. HANDLE Socket;
  844. HANDLE NewSocket;
  845. NETWORK_ADDRESS Address;
  846. PSTR RemotePath;
  847. UINTN RemotePathSize;
  848. ULONG OpenFlags;
  849. KSTATUS Status;
  850. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_ACCEPT, *PSYSTEM_CALL_SOCKET_ACCEPT;
  851. /*++
  852. Structure Description:
  853. This structure defines the system call parameters for connecting to another
  854. socket.
  855. Members:
  856. Socket - Stores the socket to use to initiate the connection.
  857. Address - Stores the network address to connect to.
  858. RemotePath - Stores a pointer to the remote path if this is a local socket.
  859. RemotePathSize - Stores the size of the remote path buffer in bytes,
  860. including the null terminator.
  861. Status - Stores the resulting status of the attempted accept operation.
  862. --*/
  863. typedef struct _SYSTEM_CALL_SOCKET_CONNECT {
  864. HANDLE Socket;
  865. NETWORK_ADDRESS Address;
  866. PSTR RemotePath;
  867. UINTN RemotePathSize;
  868. KSTATUS Status;
  869. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_CONNECT, *PSYSTEM_CALL_SOCKET_CONNECT;
  870. /*++
  871. Structure Description:
  872. This structure defines the system call parameters for sending or receiving
  873. socket data to or from a specified host. Sockets may also use the generic
  874. perform I/O system call if the caller does not with to specify or learn the
  875. remote host address.
  876. Members:
  877. Socket - Stores the socket to use.
  878. Parameters - Stores a required pointer to the socket I/O parameters.
  879. Buffer - Stores the buffer to read from or write to.
  880. Status - Stores the result of the I/O operation.
  881. --*/
  882. typedef struct _SYSTEM_CALL_SOCKET_PERFORM_IO {
  883. HANDLE Socket;
  884. PSOCKET_IO_PARAMETERS Parameters;
  885. PVOID Buffer;
  886. KSTATUS Status;
  887. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_PERFORM_IO, *PSYSTEM_CALL_SOCKET_PERFORM_IO;
  888. /*++
  889. Structure Description:
  890. This structure defines the system call parameters for performing socket
  891. I/O using an I/O vector.
  892. Members:
  893. Socket - Stores the socket to use.
  894. Parameters - Stores a required pointer to the socket I/O parameters.
  895. VectorArray - Stores a pointer to an array of I/O vectors.
  896. VectorCount - Stores the number of elements in the vector array.
  897. Status - Stores the result of the I/O operation.
  898. --*/
  899. typedef struct _SYSTEM_CALL_SOCKET_PERFORM_VECTORED_IO {
  900. HANDLE Socket;
  901. PSOCKET_IO_PARAMETERS Parameters;
  902. PIO_VECTOR VectorArray;
  903. UINTN VectorCount;
  904. KSTATUS Status;
  905. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_PERFORM_VECTORED_IO,
  906. *PSYSTEM_CALL_SOCKET_PERFORM_VECTORED_IO;
  907. /*++
  908. Structure Description:
  909. This structure defines the parameters of a file lock.
  910. Members:
  911. Type - Stores the file lock type.
  912. Offset - Stores the starting offset of the file lock.
  913. Size - Stores the size of the file lock. If zero, then the lock runs to the
  914. end of the file.
  915. ProcessId - Stores the process ID of the process that owns the lock. This
  916. is returned when getting the lock, and is ignored when setting the
  917. lock.
  918. --*/
  919. typedef struct _FILE_LOCK {
  920. FILE_LOCK_TYPE Type;
  921. ULONGLONG Offset;
  922. ULONGLONG Size;
  923. PROCESS_ID ProcessId;
  924. } FILE_LOCK, *PFILE_LOCK;
  925. /*++
  926. Structure Description:
  927. This structure defines a file path.
  928. Members:
  929. Path - Stores a pointer to the path.
  930. PathSize - Stores the size of the path.
  931. --*/
  932. typedef struct _FILE_PATH {
  933. PSTR Path;
  934. UINTN PathSize;
  935. } FILE_PATH, *PFILE_PATH;
  936. /*++
  937. Structure Description:
  938. This structure defines union of various parameters used by the file control
  939. call.
  940. Members:
  941. DuplicateDescriptor - Stores the requested minimum file descriptor of the
  942. duplicate on input for duplicate operations. On output, returns the
  943. new open file descriptor.
  944. SetFileInformation - Stores the request to get or set file information.
  945. FileLock - Stores the file lock information.
  946. Flags - Stores the file descriptor flags.
  947. FilePath - Stores the path of the file.
  948. Owner - Stores the ID of the process to receive signals on asynchronous
  949. I/O events.
  950. --*/
  951. typedef union _FILE_CONTROL_PARAMETERS_UNION {
  952. HANDLE DuplicateDescriptor;
  953. SET_FILE_INFORMATION SetFileInformation;
  954. FILE_LOCK FileLock;
  955. ULONG Flags;
  956. FILE_PATH FilePath;
  957. PROCESS_ID Owner;
  958. } FILE_CONTROL_PARAMETERS_UNION, *PFILE_CONTROL_PARAMETERS_UNION;
  959. /*++
  960. Structure Description:
  961. This structure defines the system call parameters for file control
  962. operations.
  963. Members:
  964. File - Stores the file handle to operate on.
  965. Command - Stores the file control command.
  966. Parameters - Stores a pointer to any additional command dependent
  967. parameters.
  968. Status - Stores the resulting status code of the operation.
  969. --*/
  970. typedef struct _SYSTEM_CALL_FILE_CONTROL {
  971. HANDLE File;
  972. FILE_CONTROL_COMMAND Command;
  973. PFILE_CONTROL_PARAMETERS_UNION Parameters;
  974. KSTATUS Status;
  975. } SYSCALL_STRUCT SYSTEM_CALL_FILE_CONTROL, *PSYSTEM_CALL_FILE_CONTROL;
  976. /*++
  977. Structure Description:
  978. This structure defines the system call parameters for the get/set file
  979. information system call.
  980. Members:
  981. Directory - Stores an optional handle to the directory to start path
  982. traversal from if the specified path is relative. Supply INVALID_HANDLE
  983. here to use the current directory for relative paths.
  984. FilePath - Stores a pointer to the file path string to get file information
  985. for.
  986. FilePathSize - Stores the size of the file path buffer in bytes including
  987. the null terminator.
  988. FollowLink - Stores a boolean indicating what to do if the file path points
  989. to a symbolic link. If set to TRUE, the file information set or
  990. returned will be for the file the link points to. If FALSE, the call
  991. will set or get information for the link itself.
  992. Request - Stores the file information request. For "get file information"
  993. requests, the file properties will be returned here. For "set file
  994. information" requests, this contains the fields to set.
  995. Status - Stores the resulting status code of the operation.
  996. --*/
  997. typedef struct _SYSTEM_CALL_GET_SET_FILE_INFORMATION {
  998. HANDLE Directory;
  999. PSTR FilePath;
  1000. ULONG FilePathSize;
  1001. BOOL FollowLink;
  1002. SET_FILE_INFORMATION Request;
  1003. KSTATUS Status;
  1004. } SYSCALL_STRUCT SYSTEM_CALL_GET_SET_FILE_INFORMATION,
  1005. *PSYSTEM_CALL_GET_SET_FILE_INFORMATION;
  1006. /*++
  1007. Structure Description:
  1008. This structure defines the system call parameters for debug interface.
  1009. Members:
  1010. Process - Stores the ID of the process the command is operating on.
  1011. Command - Supplies the command information.
  1012. --*/
  1013. typedef struct _SYSTEM_CALL_DEBUG {
  1014. PROCESS_ID Process;
  1015. PROCESS_DEBUG_COMMAND Command;
  1016. } SYSCALL_STRUCT SYSTEM_CALL_DEBUG, *PSYSTEM_CALL_DEBUG;
  1017. /*++
  1018. Structure Description:
  1019. This structure defines the system call parameters for a file seek operation.
  1020. Members:
  1021. Handle - Stores the handle to seek on.
  1022. Command - Stores the seek command.
  1023. Offset - Stores the offset to apply from the seek command. On return from
  1024. the system call this contains the offset (after any seek has been
  1025. applied).
  1026. Status - Stores the returned status of the operation from the kernel.
  1027. --*/
  1028. typedef struct _SYSTEM_CALL_SEEK {
  1029. HANDLE Handle;
  1030. SEEK_COMMAND Command;
  1031. IO_OFFSET Offset;
  1032. KSTATUS Status;
  1033. } SYSCALL_STRUCT SYSTEM_CALL_SEEK, *PSYSTEM_CALL_SEEK;
  1034. /*++
  1035. Structure Description:
  1036. This structure defines the system call parameters for creating a symbolic
  1037. link.
  1038. Members:
  1039. Directory - Stores an optional handle to the directory to start path
  1040. traversal from if the specified path is relative. Supply INVALID_HANDLE
  1041. here to use the current directory for relative paths.
  1042. Path - Stores a pointer to the symbolic link path.
  1043. PathSize - Stores the size of the symbolic link pointer in bytes including
  1044. the null terminator.
  1045. LinkDestinationBuffer - Stores a pointer containing the target path of the
  1046. link.
  1047. LinkDestinationBufferSize - Stores the size of the link destination
  1048. buffer in bytes including the null terminator.
  1049. Status - Stores the resulting status code from the kernel.
  1050. --*/
  1051. typedef struct _SYSTEM_CALL_CREATE_SYMBOLIC_LINK {
  1052. HANDLE Directory;
  1053. PSTR Path;
  1054. ULONG PathSize;
  1055. PSTR LinkDestinationBuffer;
  1056. ULONG LinkDestinationBufferSize;
  1057. KSTATUS Status;
  1058. } SYSCALL_STRUCT SYSTEM_CALL_CREATE_SYMBOLIC_LINK,
  1059. *PSYSTEM_CALL_CREATE_SYMBOLIC_LINK;
  1060. /*++
  1061. Structure Description:
  1062. This structure defines the system call parameters for getting the value of
  1063. a symbolic link.
  1064. Members:
  1065. Directory - Stores an optional handle to the directory to start path
  1066. traversal from if the specified path is relative. Supply INVALID_HANDLE
  1067. here to use the current directory for relative paths.
  1068. Path - Stores a pointer to the symbolic link path.
  1069. PathSize - Stores the size of the symbolic link pointer in bytes including
  1070. the null terminator.
  1071. LinkDestinationBuffer - Stores a pointer to a buffer where the destination
  1072. of the link will be returned. A null terminator is not written.
  1073. LinkDestinationBufferSize - Stores the size of the link destination
  1074. buffer in bytes.
  1075. LinkDestinationSize - Stores a pointer where the actual size of the link
  1076. destination will be returned on either success or a
  1077. STATUS_BUFFER_TOO_SMALL case. On failure, 0 will be returned here. This
  1078. size does not include a null terminator.
  1079. Status - Stores the resulting status code from the kernel.
  1080. --*/
  1081. typedef struct _SYSTEM_CALL_READ_SYMBOLIC_LINK {
  1082. HANDLE Directory;
  1083. PSTR Path;
  1084. ULONG PathSize;
  1085. PSTR LinkDestinationBuffer;
  1086. ULONG LinkDestinationBufferSize;
  1087. ULONG LinkDestinationSize;
  1088. KSTATUS Status;
  1089. } SYSCALL_STRUCT SYSTEM_CALL_READ_SYMBOLIC_LINK,
  1090. *PSYSTEM_CALL_READ_SYMBOLIC_LINK;
  1091. /*++
  1092. Structure Description:
  1093. This structure defines the system call parameters for deleting an entry
  1094. from a directory.
  1095. Members:
  1096. Directory - Stores an optional handle to the directory to start path
  1097. traversal from if the specified path is relative. Supply INVALID_HANDLE
  1098. here to use the current directory for relative paths.
  1099. Path - Stores a pointer to the entry to delete.
  1100. PathSize - Stores the size of the path in bytes including the null
  1101. terminator.
  1102. Flags - Stores a bitfield of flags. See SYS_DELETE_FLAG_* definitions.
  1103. Status - Stores the resulting status code from the kernel.
  1104. --*/
  1105. typedef struct _SYSTEM_CALL_DELETE {
  1106. HANDLE Directory;
  1107. PSTR Path;
  1108. ULONG PathSize;
  1109. ULONG Flags;
  1110. KSTATUS Status;
  1111. } SYSCALL_STRUCT SYSTEM_CALL_DELETE, *PSYSTEM_CALL_DELETE;
  1112. /*++
  1113. Structure Description:
  1114. This structure defines the system call parameters for renaming a file or
  1115. directory.
  1116. Members:
  1117. SourceDirectory - Stores an optional handle to the directory to start
  1118. relative source path searches from. If set to INVALID_HANDLE, relative
  1119. source paths will start from the current working directory.
  1120. SourcePath - Stores a pointer to the string containing the file or directory
  1121. to rename.
  1122. SourcePathSize - Stores the size of the source path string in bytes
  1123. including the null terminator.
  1124. DestinationDirectory - Stores an optional handle to the directory to start
  1125. relative destination path searches from. If set to INVALID_HANDLE,
  1126. relative destination paths will start from the current working
  1127. directory.
  1128. DestinationPath - Stores a pointer to the string containing the path to
  1129. rename the file or directory to.
  1130. DestinationPathSize - Stores the size of the destination path string in
  1131. bytes including the null terminator.
  1132. Status - Stores the resulting status code from the kernel.
  1133. --*/
  1134. typedef struct _SYSTEM_CALL_RENAME {
  1135. HANDLE SourceDirectory;
  1136. PSTR SourcePath;
  1137. ULONG SourcePathSize;
  1138. HANDLE DestinationDirectory;
  1139. PSTR DestinationPath;
  1140. ULONG DestinationPathSize;
  1141. KSTATUS Status;
  1142. } SYSCALL_STRUCT SYSTEM_CALL_RENAME, *PSYSTEM_CALL_RENAME;
  1143. /*++
  1144. Structure Description:
  1145. This structure defines the system call parameters for time zone control
  1146. operations.
  1147. Members:
  1148. Operation - Stores the time zone operation to perform.
  1149. DataBuffer - Stores a pointer to the data buffer where the requested data
  1150. will be returned.
  1151. DataBufferSize - Stores the size of the supplied buffer on success. Returns
  1152. the needed size for the given data, even if no data buffer is supplied.
  1153. ZoneName - Stores a pointer to the string containing the zone name to
  1154. switch to.
  1155. ZoneNameSize - Stores the size of the zone name buffer in bytes.
  1156. OriginalZoneName - Stores an optional pointer to a buffer where the
  1157. original time zone name will be returned.
  1158. OriginalZoneNameSize - Stores the size of the original zone name buffer.
  1159. Status - Stores the resulting status code from the kernel.
  1160. --*/
  1161. typedef struct _SYSTEM_CALL_TIME_ZONE_CONTROL {
  1162. TIME_ZONE_OPERATION Operation;
  1163. PVOID DataBuffer;
  1164. ULONG DataBufferSize;
  1165. PSTR ZoneName;
  1166. ULONG ZoneNameSize;
  1167. PSTR OriginalZoneName;
  1168. ULONG OriginalZoneNameSize;
  1169. KSTATUS Status;
  1170. } SYSCALL_STRUCT SYSTEM_CALL_TIME_ZONE_CONTROL, *PSYSTEM_CALL_TIME_ZONE_CONTROL;
  1171. /*++
  1172. Structure Description:
  1173. This structure defines the system call parameters for mounting or
  1174. unmounting a file, directory, volume, pipe, socket or device.
  1175. Members:
  1176. MountPointPath - Stores a pointer to the string containing the path to the
  1177. mount point where the target is to be mounted, or from which it
  1178. should be unmounted.
  1179. MountPointPathSize - Stores the size of the mount point path string in
  1180. bytes, including the null terminator.
  1181. TargetPath - Stores a pointer to the string containing the path to the
  1182. target file, directory, volume, pipe, socket, or device that is to be
  1183. mounted.
  1184. TargetPathSize - Stores the size of the target path string in bytes,
  1185. including the null terminator.
  1186. Flags - Stores a bitfield of flags. See SYS_MOUNT_FLAG_* definitions.
  1187. Status - Stores the resulting status code from the kernel.
  1188. --*/
  1189. typedef struct _SYSTEM_CALL_MOUNT_UNMOUNT {
  1190. PSTR MountPointPath;
  1191. ULONG MountPointPathSize;
  1192. PSTR TargetPath;
  1193. ULONG TargetPathSize;
  1194. ULONG Flags;
  1195. KSTATUS Status;
  1196. } SYSCALL_STRUCT SYSTEM_CALL_MOUNT_UNMOUNT, *PSYSTEM_CALL_MOUNT_UNMOUNT;
  1197. /*++
  1198. Structure Description:
  1199. This structure defines the system call parameters for retrieving the
  1200. current time counter value.
  1201. Members:
  1202. Value - Stores the time counter value returned by the kernel.
  1203. --*/
  1204. typedef struct _SYSTEM_CALL_QUERY_TIME_COUNTER {
  1205. ULONGLONG Value;
  1206. } SYSCALL_STRUCT SYSTEM_CALL_QUERY_TIME_COUNTER,
  1207. *PSYSTEM_CALL_QUERY_TIME_COUNTER;
  1208. /*++
  1209. Structure Description:
  1210. This structure stores information about a timer.
  1211. Members:
  1212. DueTime - Stores the next absolute due time of the timer, in time
  1213. counter ticks.
  1214. Period - Stores the period of the timer, in time counter ticks. A value of
  1215. 0 indicates a one-shot timer.
  1216. OverflowCount - Stores the number of additional timer overflows that have
  1217. occurred since the timer originally expired.
  1218. --*/
  1219. typedef struct _TIMER_INFORMATION {
  1220. ULONGLONG DueTime;
  1221. ULONGLONG Period;
  1222. ULONG OverflowCount;
  1223. } TIMER_INFORMATION, *PTIMER_INFORMATION;
  1224. /*++
  1225. Structure Description:
  1226. This structure defines the system call parameters for the timer control
  1227. operations.
  1228. Members:
  1229. Operation - Stores the operation to perform.
  1230. Flags - Stores a bitmask of time control flags. See TIMER_CONTROL_FLAG_*
  1231. for definitions.
  1232. TimerNumber - Stores either the timer number to operate on, or returns
  1233. the new timer number for create operations.
  1234. SignalNumber - Stores the number of the signal to raise when this timer
  1235. expires. This is only used for create timer requests.
  1236. SignalValue - Stores the signal value to send along with the raised signal
  1237. when the timer expires. This is only used for create timer requests.
  1238. ThreadId - Stores an optional ID of the thread to signal when the timer
  1239. expires. This is only used for create timer requests.
  1240. TimerInformation - Stores the timer information, either presented to the
  1241. kernel or returned by the kernel.
  1242. Status - Stores the result of the operation as returned by the kernel.
  1243. --*/
  1244. typedef struct _SYSTEM_CALL_TIMER_CONTROL {
  1245. TIMER_OPERATION Operation;
  1246. ULONG Flags;
  1247. LONG TimerNumber;
  1248. ULONG SignalNumber;
  1249. UINTN SignalValue;
  1250. THREAD_ID ThreadId;
  1251. TIMER_INFORMATION TimerInformation;
  1252. KSTATUS Status;
  1253. } SYSCALL_STRUCT SYSTEM_CALL_TIMER_CONTROL, *PSYSTEM_CALL_TIMER_CONTROL;
  1254. /*++
  1255. Structure Description:
  1256. This structure defines the system call parameters for getting the
  1257. effective access permissions on a file.
  1258. Members:
  1259. Directory - Stores an optional handle to the directory to start path
  1260. traversal from if the specified path is relative. Supply INVALID_HANDLE
  1261. here to use the current directory for relative paths.
  1262. FilePath - Stores a pointer to the string containing the file path.
  1263. FilePathSize - Stores the size of the file path buffer in bytes including
  1264. the null terminator.
  1265. UseRealIds - Stores a boolean indicating that the real user and group IDs
  1266. should be used for the access check instead of the effective user and
  1267. group IDs.
  1268. DesiredFlags - Stores the bitfield of flags the caller would like the
  1269. kernel to check on.
  1270. EffectiveAccess - Stores the set of flags returned by the kernel describing
  1271. the access the user has to the file. Only the desired flags will be
  1272. checked, all others will be zero.
  1273. Status - Stores the result of the operation as returned by the kernel.
  1274. --*/
  1275. typedef struct _SYSTEM_CALL_GET_EFFECTIVE_ACCESS {
  1276. HANDLE Directory;
  1277. PSTR FilePath;
  1278. ULONG FilePathSize;
  1279. BOOL UseRealIds;
  1280. ULONG DesiredFlags;
  1281. ULONG EffectiveAccess;
  1282. KSTATUS Status;
  1283. } SYSCALL_STRUCT SYSTEM_CALL_GET_EFFECTIVE_ACCESS,
  1284. *PSYSTEM_CALL_GET_EFFECTIVE_ACCESS;
  1285. /*++
  1286. Structure Description:
  1287. This structure defines the system call parameters for delaying execution
  1288. for a specified amount of time.
  1289. Members:
  1290. TimeTicks - Stores a boolean indicating if the interval parameter is
  1291. represented in time counter ticks (TRUE) or microseconds (FALSE).
  1292. Interval - Stores the interval to wait. If the time ticks parameter is
  1293. TRUE, this parameter represents an absolute time in time counter ticks.
  1294. If the time ticks parameter is FALSE, this parameter represents a
  1295. relative time from now in microseconds.
  1296. Status - Stores the result of the wait returned by the kernel.
  1297. --*/
  1298. typedef struct _SYSTEM_CALL_DELAY_EXECUTION {
  1299. BOOL TimeTicks;
  1300. ULONGLONG Interval;
  1301. KSTATUS Status;
  1302. } SYSCALL_STRUCT SYSTEM_CALL_DELAY_EXECUTION, *PSYSTEM_CALL_DELAY_EXECUTION;
  1303. /*++
  1304. Structure Description:
  1305. This structure defines the system call parameters for a user I/O control
  1306. operation.
  1307. Members:
  1308. Handle - Stores the open file handle to perform the request on.
  1309. RequestCode - Stores the request code to send to the object. For devices,
  1310. this is the IRP minor code.
  1311. Context - Stores an optional context pointer.
  1312. ContextSize - Stores the size of the supplied context buffer in bytes. Set
  1313. this to zero if the context is not supplied or not a pointer.
  1314. Status - Stores the result of the operation returned by the kernel.
  1315. --*/
  1316. typedef struct _SYSTEM_CALL_USER_CONTROL {
  1317. HANDLE Handle;
  1318. ULONG RequestCode;
  1319. PVOID Context;
  1320. UINTN ContextSize;
  1321. KSTATUS Status;
  1322. } SYSCALL_STRUCT SYSTEM_CALL_USER_CONTROL, *PSYSTEM_CALL_USER_CONTROL;
  1323. /*++
  1324. Structure Description:
  1325. This structure defines the system call parameters for a flush operation.
  1326. Members:
  1327. Handle - Stores the open file handle to perform the flush request on.
  1328. Flags - Stores flags related to the flush operation. See SYS_FLUSH_FLAG_*
  1329. for definitions.
  1330. Status - Stores the result of the operation returned by the kernel.
  1331. --*/
  1332. typedef struct _SYSTEM_CALL_FLUSH {
  1333. HANDLE Handle;
  1334. ULONG Flags;
  1335. KSTATUS Status;
  1336. } SYSCALL_STRUCT SYSTEM_CALL_FLUSH, *PSYSTEM_CALL_FLUSH;
  1337. /*++
  1338. Structure Description:
  1339. This structure defines the system call parameters for getting resource
  1340. usage for a process or thread.
  1341. Members:
  1342. Request - Stores the request type.
  1343. Id - Stores the process or thread ID to get. Supply -1 to use the current
  1344. process or thread.
  1345. Status - Stores the resulting status code from the kernel.
  1346. Usage - Stores the returned resource usage from the kernel.
  1347. Frequency - Stores the frequency of the processor(s).
  1348. --*/
  1349. typedef struct _SYSTEM_CALL_GET_RESOURCE_USAGE {
  1350. RESOURCE_USAGE_REQUEST Request;
  1351. PROCESS_ID Id;
  1352. KSTATUS Status;
  1353. RESOURCE_USAGE Usage;
  1354. ULONGLONG Frequency;
  1355. } SYSCALL_STRUCT SYSTEM_CALL_GET_RESOURCE_USAGE,
  1356. *PSYSTEM_CALL_GET_RESOURCE_USAGE;
  1357. /*++
  1358. Structure Description:
  1359. This structure defines the system call parameters for loading a kernel
  1360. driver.
  1361. Members:
  1362. DriverName - Stores a pointer to a null terminated string containing the
  1363. name of the driver to load.
  1364. DriverNameSize - Stores the name of the driver buffer in bytes including the
  1365. null terminator.
  1366. Status - Stores the resulting status code from the kernel.
  1367. --*/
  1368. typedef struct _SYSTEM_CALL_LOAD_DRIVER {
  1369. PSTR DriverName;
  1370. ULONG DriverNameSize;
  1371. KSTATUS Status;
  1372. } SYSCALL_STRUCT SYSTEM_CALL_LOAD_DRIVER, *PSYSTEM_CALL_LOAD_DRIVER;
  1373. /*++
  1374. Structure Description:
  1375. This structure defines the system call parameters for flushing a region of
  1376. memory after its instruction contents have been modified.
  1377. Members:
  1378. Address - Stores the starting address of the region that was modified.
  1379. Size - Stores the size of the region that was modified in bytes.
  1380. Status - Stores the resulting status code from the kernel.
  1381. --*/
  1382. typedef struct _SYSTEM_CALL_FLUSH_CACHE {
  1383. PVOID Address;
  1384. UINTN Size;
  1385. KSTATUS Status;
  1386. } SYSCALL_STRUCT SYSTEM_CALL_FLUSH_CACHE, *PSYSTEM_CALL_FLUSH_CACHE;
  1387. /*++
  1388. Structure Description:
  1389. This structure defines the system call parameters for getting the current
  1390. directory.
  1391. Members:
  1392. Root - Stores a pointer indicating whether to get the path to the current
  1393. working directory (FALSE) or to get the path of the current chroot
  1394. environment (TRUE). If the caller does not have permission to escape
  1395. a changed root, or the root has not been changed, then / is returned
  1396. here.
  1397. Buffer - Stores a pointer to the buffer to hold the current directory's
  1398. path.
  1399. BufferSize - Stores the size of the buffer on input. On output, stores the
  1400. required size of the buffer.
  1401. Status - Stores the resulting status code from the kernel.
  1402. --*/
  1403. typedef struct _SYSTEM_CALL_GET_CURRENT_DIRECTORY {
  1404. BOOL Root;
  1405. PSTR Buffer;
  1406. UINTN BufferSize;
  1407. KSTATUS Status;
  1408. } SYSCALL_STRUCT SYSTEM_CALL_GET_CURRENT_DIRECTORY,
  1409. *PSYSTEM_CALL_GET_CURRENT_DIRECTORY;
  1410. /*++
  1411. Structure Description:
  1412. This structure defines the system call parameters for the get/set socket
  1413. information call.
  1414. Members:
  1415. Socket - Stores the handle to the socket to query.
  1416. InformationType - Stores the socket information type category to which the
  1417. specified option belongs.
  1418. Option - Stores the option to get or set, which is specific to the
  1419. information type. The type of this value is generally
  1420. SOCKET_<information_type>_OPTION.
  1421. Data - Stores a pointer to the data buffer where the information will
  1422. be read or written to.
  1423. DataSize - Stores a value that on input contains the size of the data
  1424. buffer in bytes. On output, returns the actual size of the data.
  1425. Set - Stores a boolean indicating whether to set socket information
  1426. (TRUE) or get device information (FALSE).
  1427. Status - Stores the resulting status code from the kernel.
  1428. --*/
  1429. typedef struct _SYSTEM_CALL_SOCKET_GET_SET_INFORMATION {
  1430. HANDLE Socket;
  1431. SOCKET_INFORMATION_TYPE InformationType;
  1432. UINTN Option;
  1433. PVOID Data;
  1434. UINTN DataSize;
  1435. BOOL Set;
  1436. KSTATUS Status;
  1437. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_GET_SET_INFORMATION,
  1438. *PSYSTEM_CALL_SOCKET_GET_SET_INFORMATION;
  1439. /*++
  1440. Structure Description:
  1441. This structure defines the system call parameters for partially shutting
  1442. down I/O on a socket.
  1443. Members:
  1444. Socket - Stores the handle to the socket to shut down.
  1445. ShutdownType - Stores the type of shutdown to perform. See
  1446. SOCKET_SHUTDOWN_* flags, which can be ORed together.
  1447. Status - Stores the resulting status code from the kernel.
  1448. --*/
  1449. typedef struct _SYSTEM_CALL_SOCKET_SHUTDOWN {
  1450. HANDLE Socket;
  1451. ULONG ShutdownType;
  1452. KSTATUS Status;
  1453. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_SHUTDOWN, *PSYSTEM_CALL_SOCKET_SHUTDOWN;
  1454. /*++
  1455. Structure Description:
  1456. This structure defines the system call parameters for creating a hard link.
  1457. Members:
  1458. ExistingFileDirectory - Stores an optional handle to the directory to
  1459. start path traversal from if the specified existing file path is
  1460. relative. Supply INVALID_HANDLE here to use the current directory for
  1461. relative paths.
  1462. ExistingFilePath - Stores a pointer to a null-terminated string
  1463. containing the path of the existing file to link to.
  1464. ExistingFilePathSize - Stores the size of the existing file path buffer
  1465. in bytes, including the null terminator.
  1466. NewLinkDirectory - Stores an optional handle to the directory to start path
  1467. traversal from if the specified new link path is relative. Supply
  1468. INVALID_HANDLE here to use the current directory for relative paths.
  1469. NewLinkPath - Stores a pointer to the null-terminated string containing
  1470. the path of the new link to create.
  1471. NewLinkPathSize - Stores the size of the new link path buffer in bytes,
  1472. including the null terminator.
  1473. FollowLinks - Stores a boolean indicating whether to follow the link in
  1474. the source (existing file path) if it is a symbolic link.
  1475. Status - Stores the resulting status code from the kernel.
  1476. --*/
  1477. typedef struct _SYSTEM_CALL_CREATE_HARD_LINK {
  1478. HANDLE ExistingFileDirectory;
  1479. PSTR ExistingFilePath;
  1480. ULONG ExistingFilePathSize;
  1481. HANDLE NewLinkDirectory;
  1482. PSTR NewLinkPath;
  1483. ULONG NewLinkPathSize;
  1484. BOOL FollowLinks;
  1485. KSTATUS Status;
  1486. } SYSCALL_STRUCT SYSTEM_CALL_CREATE_HARD_LINK, *PSYSTEM_CALL_CREATE_HARD_LINK;
  1487. /*++
  1488. Structure Description:
  1489. This structure defines the system call paramters for mapping a file object
  1490. and then unmapping the object.
  1491. Members:
  1492. Map - Stores a boolean indicating whether or not a map (TRUE) or unmap
  1493. (FALSE) operation is being requested.
  1494. Flags - Stores a bitmask of flags. See SYS_MAP_FLAG_* for definitions.
  1495. Handle - Stores a handle to the file object to be mapped.
  1496. Address - Stores the address pointer. For a map operation, this can contain
  1497. a suggested address for the mapping. On exit it contains the location
  1498. of the mapping. For unmap operations, this contains the starting
  1499. address of the region to be unmapped.
  1500. Offset - Stores the offset, in bytes, of the file object where the
  1501. requested mapping should start.
  1502. Size - Stores the size of the memory region, in bytes. For a map operation
  1503. this stores the requested number of bytes of the file to be mapped,
  1504. starting at the given offset. For an unmap operation, this stores the
  1505. size of the memory region that starts at the given address.
  1506. Status - Stores the resulting status code from the kernel.
  1507. --*/
  1508. typedef struct _SYSTEM_CALL_MAP_UNMAP_MEMORY {
  1509. BOOL Map;
  1510. ULONG Flags;
  1511. HANDLE Handle;
  1512. PVOID Address;
  1513. ULONGLONG Offset;
  1514. UINTN Size;
  1515. KSTATUS Status;
  1516. } SYSCALL_STRUCT SYSTEM_CALL_MAP_UNMAP_MEMORY, *PSYSTEM_CALL_MAP_UNMAP_MEMORY;
  1517. /*++
  1518. Structure Description:
  1519. This structure defines the system call parameters for flushing a region of
  1520. memory to the permament storage that backs it, if any.
  1521. Members:
  1522. Address - Stores the starting address of the memory region that is to be
  1523. synchronized.
  1524. Size - Supplies the size, in bytes, of the region to synchronize.
  1525. Flags - Stores a bitmask of flags. See SYS_MAP_SYNC_FLAG_* for definitions.
  1526. Status - Stores the resulting status code from the kernel.
  1527. --*/
  1528. typedef struct _SYSTEM_CALL_FLUSH_MEMORY {
  1529. PVOID Address;
  1530. ULONGLONG Size;
  1531. ULONG Flags;
  1532. KSTATUS Status;
  1533. } SYSCALL_STRUCT SYSTEM_CALL_FLUSH_MEMORY, *PSYSTEM_CALL_FLUSH_MEMORY;
  1534. /*++
  1535. Structure Description:
  1536. This structure defines the system call parameters for locating a
  1537. device information registration.
  1538. Members:
  1539. ByDeviceId - Stores a boolean indicating if the search should filter by
  1540. device ID number.
  1541. ByUuid - Stores a boolean indicating if the search should filter by
  1542. the information type identifier.
  1543. DeviceId - Stores the device ID that device information results must
  1544. match against. This is only used if the "by device ID" parameter is
  1545. TRUE.
  1546. Uuid - Stores the information type identifier that the device information
  1547. results must match against. This is only used if the "by UUID"
  1548. parameter is TRUE.
  1549. Results - Stores a pointer to a caller allocated buffer where the results
  1550. will be returned on success.
  1551. ResultCount - Stores a value that on input contains the size of the
  1552. result buffer in elements. On output, returns the number of elements
  1553. in the results, even if the supplied buffer was too small.
  1554. Status - Stores the status code returned by the kernel.
  1555. --*/
  1556. typedef struct _SYSTEM_CALL_LOCATE_DEVICE_INFORMATION {
  1557. BOOL ByDeviceId;
  1558. BOOL ByUuid;
  1559. DEVICE_ID DeviceId;
  1560. UUID Uuid;
  1561. PDEVICE_INFORMATION_RESULT Results;
  1562. ULONG ResultCount;
  1563. KSTATUS Status;
  1564. } SYSCALL_STRUCT SYSTEM_CALL_LOCATE_DEVICE_INFORMATION,
  1565. *PSYSTEM_CALL_LOCATE_DEVICE_INFORMATION;
  1566. /*++
  1567. Structure Description:
  1568. This structure defines the system call parameters for getting or setting
  1569. device information.
  1570. Members:
  1571. DeviceId - Stores the numerical identifier of the device to get or set
  1572. information for.
  1573. Uuid - Stores the device information type identifier.
  1574. Data - Stores a pointer to the data buffer where the information will
  1575. be read or written to.
  1576. DataSize - Stores a value that on input contains the size of the data
  1577. buffer in bytes. On output, returns the actual size of the data.
  1578. Set - Stores a boolean indicating whether to set device information
  1579. (TRUE) or get device information (FALSE).
  1580. Status - Stores the resulting status code from the kernel.
  1581. --*/
  1582. typedef struct _SYSTEM_CALL_GET_SET_DEVICE_INFORMATION {
  1583. DEVICE_ID DeviceId;
  1584. UUID Uuid;
  1585. PVOID Data;
  1586. UINTN DataSize;
  1587. BOOL Set;
  1588. KSTATUS Status;
  1589. } SYSCALL_STRUCT SYSTEM_CALL_GET_SET_DEVICE_INFORMATION,
  1590. *PSYSTEM_CALL_GET_SET_DEVICE_INFORMATION;
  1591. /*++
  1592. Structure Description:
  1593. This structure defines the system call parameters for the open device call.
  1594. Members:
  1595. DeviceId - Stores the numerical identifier of the device to open.
  1596. Flags - Stores a bitfield of flags. See SYS_OPEN_FLAG_* definitions.
  1597. Status - Stores a status code which will represent the return value of the
  1598. open device operation.
  1599. Handle - Stores a handle where the handle will be returned on success.
  1600. --*/
  1601. typedef struct _SYSTEM_CALL_OPEN_DEVICE {
  1602. DEVICE_ID DeviceId;
  1603. ULONG Flags;
  1604. KSTATUS Status;
  1605. HANDLE Handle;
  1606. } SYSCALL_STRUCT SYSTEM_CALL_OPEN_DEVICE, *PSYSTEM_CALL_OPEN_DEVICE;
  1607. /*++
  1608. Structure Description:
  1609. This structure defines the system call parameters for getting or setting
  1610. system information.
  1611. Members:
  1612. Subsystem - Stores the subsystem to query or set information for.
  1613. InformationType - Stores the information type, which is specific to
  1614. the subsystem. The type of this value is generally
  1615. <subsystem>_INFORMATION_TYPE (eg IO_INFORMATION_TYPE).
  1616. Data - Stores a pointer to the data buffer where the information will
  1617. be read or written to.
  1618. DataSize - Stores a value that on input contains the size of the data
  1619. buffer in bytes. On output, returns the actual size of the data.
  1620. Set - Stores a boolean indicating whether to set device information
  1621. (TRUE) or get device information (FALSE).
  1622. Status - Stores the resulting status code from the kernel.
  1623. --*/
  1624. typedef struct _SYSTEM_CALL_GET_SET_SYSTEM_INFORMATION {
  1625. SYSTEM_INFORMATION_SUBSYSTEM Subsystem;
  1626. UINTN InformationType;
  1627. PVOID Data;
  1628. UINTN DataSize;
  1629. BOOL Set;
  1630. KSTATUS Status;
  1631. } SYSCALL_STRUCT SYSTEM_CALL_GET_SET_SYSTEM_INFORMATION,
  1632. *PSYSTEM_CALL_GET_SET_SYSTEM_INFORMATION;
  1633. /*++
  1634. Structure Description:
  1635. This structure defines the system call parameters for rebooting the
  1636. machine.
  1637. Members:
  1638. ResetType - Stores the type of reset to perform.
  1639. Status - Stores the resulting status code from the kernel.
  1640. --*/
  1641. typedef struct _SYSTEM_CALL_RESET_SYSTEM {
  1642. SYSTEM_RESET_TYPE ResetType;
  1643. KSTATUS Status;
  1644. } SYSCALL_STRUCT SYSTEM_CALL_RESET_SYSTEM, *PSYSTEM_CALL_RESET_SYSTEM;
  1645. /*++
  1646. Structure Description:
  1647. This structure defines the system call parameters for setting the system
  1648. time.
  1649. Members:
  1650. SystemTime - Stores the system time to set.
  1651. TimeCounter - Stores the time counter value corresponding with the
  1652. moment the system time was meant to be set by the caller.
  1653. Status - Stores the resulting status code from the kernel.
  1654. --*/
  1655. typedef struct _SYSTEM_CALL_SET_SYSTEM_TIME {
  1656. SYSTEM_TIME SystemTime;
  1657. ULONGLONG TimeCounter;
  1658. KSTATUS Status;
  1659. } SYSCALL_STRUCT SYSTEM_CALL_SET_SYSTEM_TIME, *PSYSTEM_CALL_SET_SYSTEM_TIME;
  1660. /*++
  1661. Structure Description:
  1662. This structure defines the system call parameters for setting the system
  1663. time.
  1664. Members:
  1665. Address - Stores the starting address (inclusive) to change the memory
  1666. protection for. This must be aligned to a page boundary.
  1667. Length - Stores the length, in bytes, of the region to change attributes
  1668. for.
  1669. NewAttributes - Stores the new attributes to set. See SYS_MAP_FLAG_*
  1670. definitions.
  1671. Status - Stores the resulting status code from the kernel.
  1672. --*/
  1673. typedef struct _SYSTEM_CALL_SET_MEMORY_PROTECTION {
  1674. PVOID Address;
  1675. UINTN Size;
  1676. ULONG NewAttributes;
  1677. KSTATUS Status;
  1678. } SYSCALL_STRUCT SYSTEM_CALL_SET_MEMORY_PROTECTION,
  1679. *PSYSTEM_CALL_SET_MEMORY_PROTECTION;
  1680. /*++
  1681. Structure Description:
  1682. This structure defines the system call parameters for getting and setting
  1683. the current thread identity, including the thread's user and group IDs.
  1684. Members:
  1685. Request - Stores the request details of the get or set thread identity
  1686. operation.
  1687. Status - Stores the resulting status code from the kernel.
  1688. --*/
  1689. typedef struct _SYSTEM_CALL_SET_THREAD_IDENTITY {
  1690. SET_THREAD_IDENTITY Request;
  1691. KSTATUS Status;
  1692. } SYSCALL_STRUCT SYSTEM_CALL_SET_THREAD_IDENTITY,
  1693. *PSYSTEM_CALL_SET_THREAD_IDENTITY;
  1694. /*++
  1695. Structure Description:
  1696. This structure defines the system call parameters for getting and setting
  1697. the current thread permission masks.
  1698. Members:
  1699. Request - Stores the request details of the get or set thread permissions
  1700. operation.
  1701. Status - Stores the resulting status code from the kernel.
  1702. --*/
  1703. typedef struct _SYSTEM_CALL_SET_THREAD_PERMISSIONS {
  1704. SET_THREAD_PERMISSIONS Request;
  1705. KSTATUS Status;
  1706. } SYSCALL_STRUCT SYSTEM_CALL_SET_THREAD_PERMISSIONS,
  1707. *PSYSTEM_CALL_SET_THREAD_PERMISSIONS;
  1708. /*++
  1709. Structure Description:
  1710. This structure defines the system call parameters for getting and setting
  1711. the supplementary group membership of the calling thread.
  1712. Members:
  1713. Set - Stores a boolean indicating if the caller wants to set the
  1714. supplementary group membership or just get it.
  1715. Groups - Stores a pointer to an array where the supplementary group IDs
  1716. will be returned on read, or the buffer containing the new IDs on
  1717. writes. This buffer does not contain the primary real/effective/saved
  1718. group IDs.
  1719. Count - Stores the number of elements the buffer stores on input, on output,
  1720. returns the number of elements in the buffer (or needed if the buffer
  1721. was not large enough).
  1722. Status - Stores the resulting status code from the kernel. If
  1723. STATUS_BUFFER_TOO_SMALL is returned, then the correct number of
  1724. elements needed will be returned in the count parameter. If other
  1725. error status codes are returned, the count output may not be valid.
  1726. --*/
  1727. typedef struct _SYSTEM_CALL_SET_SUPPLEMENTARY_GROUPS {
  1728. BOOL Set;
  1729. PGROUP_ID Groups;
  1730. UINTN Count;
  1731. KSTATUS Status;
  1732. } SYSCALL_STRUCT SYSTEM_CALL_SET_SUPPLEMENTARY_GROUPS,
  1733. *PSYSTEM_CALL_SET_SUPPLEMENTARY_GROUPS;
  1734. /*++
  1735. Structure Description:
  1736. This structure defines the system call parameters for creating a pair of
  1737. connected sockets.
  1738. Members:
  1739. Domain - Stores the network domain to use on the sockets.
  1740. Type - Stores the socket connection type.
  1741. Protocol - Stores the raw network protocol to use on the socket.
  1742. These are network specific. For example, for IPv4 and IPv6, the values
  1743. are taken from the Internet Assigned Numbers Authority (IANA).
  1744. OpenFlags - Stores an optional bitfield of open flags for the new socket.
  1745. Only SYS_OPEN_FLAG_NON_BLOCKING and SYS_OPEN_FLAG_CLOSE_ON_EXECUTE
  1746. are accepted.
  1747. Socket1 - Stores one of the returned socket file descriptor on success.
  1748. Socket2 - Stores the other returned socket file descriptor on success.
  1749. Status - Stores a status code which will represent the return value of the
  1750. create socket operation.
  1751. --*/
  1752. typedef struct _SYSTEM_CALL_SOCKET_CREATE_PAIR {
  1753. NET_DOMAIN_TYPE Domain;
  1754. NET_SOCKET_TYPE Type;
  1755. ULONG Protocol;
  1756. ULONG OpenFlags;
  1757. HANDLE Socket1;
  1758. HANDLE Socket2;
  1759. KSTATUS Status;
  1760. } SYSCALL_STRUCT SYSTEM_CALL_SOCKET_CREATE_PAIR,
  1761. *PSYSTEM_CALL_SOCKET_CREATE_PAIR;
  1762. /*++
  1763. Structure Description:
  1764. This structure defines the system call parameters for creating a new
  1765. pseudo-terminal device.
  1766. Members:
  1767. MasterDirectory - Stores an optional handle to a directory for relative
  1768. paths when creating the master. Supply INVALID_HANDLE to use the
  1769. current working directory.
  1770. SlaveDirectory - Stores an optional handle to a directory for relative
  1771. paths when creating the slave. Supply INVALID_HANDLE to use the
  1772. current working directory.
  1773. MasterPath - Stores an optional pointer to the path to create for the
  1774. master.
  1775. MasterPathLength - Stores the length of the master side path buffer in
  1776. bytes, including the null terminator.
  1777. SlavePath - Stores an optional pointer to the path to create for the
  1778. master.
  1779. SlavePathLength - Stores the length of the slave side path buffer in
  1780. bytes, including the null terminator.
  1781. MasterOpenFlags - Stores the open flags to use when opening the master.
  1782. Only read, write, and "no controlling terminal" flags are honored.
  1783. MasterCreatePermissions - Stores the permissions to apply to the created
  1784. master side.
  1785. SlaveCreatePermissions - Stores the permission to apply to the created
  1786. slave side.
  1787. MasterHandle - Stores the returned handle to the master terminal side on
  1788. success.
  1789. Status - Stores the status returned by the kernel.
  1790. --*/
  1791. typedef struct _SYSTEM_CALL_CREATE_TERMINAL {
  1792. HANDLE MasterDirectory;
  1793. HANDLE SlaveDirectory;
  1794. PSTR MasterPath;
  1795. UINTN MasterPathLength;
  1796. PSTR SlavePath;
  1797. UINTN SlavePathLength;
  1798. ULONG MasterOpenFlags;
  1799. FILE_PERMISSIONS MasterCreatePermissions;
  1800. FILE_PERMISSIONS SlaveCreatePermissions;
  1801. HANDLE MasterHandle;
  1802. KSTATUS Status;
  1803. } SYSCALL_STRUCT SYSTEM_CALL_CREATE_TERMINAL, *PSYSTEM_CALL_CREATE_TERMINAL;
  1804. /*++
  1805. Structure Description:
  1806. This structure defines the system call parameters for setting the thread
  1807. pointer.
  1808. Members:
  1809. Pointer - Stores the pointer to set.
  1810. --*/
  1811. typedef struct _SYSTEM_CALL_SET_THREAD_POINTER {
  1812. PVOID Pointer;
  1813. } SYSCALL_STRUCT SYSTEM_CALL_SET_THREAD_POINTER,
  1814. *PSYSTEM_CALL_SET_THREAD_POINTER;
  1815. /*++
  1816. Structure Description:
  1817. This structure defines the system call parameters for the user lock
  1818. operation, which provides basic synchronization building blocks to user
  1819. mode.
  1820. Members:
  1821. Address - Stores a pointer to the address of the lock.
  1822. Value - Stores the value, whose meaning depends on the lock operation.
  1823. Operation - Stores the type of operation to perform on the lock. This is of
  1824. type USER_LOCK_OPERATION, but is also combined with USER_LOCK_* flags.
  1825. TimeoutInMilliseconds - Stores the timeout in milliseconds the caller
  1826. should wait. Set to SYS_WAIT_TIME_INDEFINITE to wait forever.
  1827. Status - Stores the status returned by the kernel.
  1828. --*/
  1829. typedef struct _SYSTEM_CALL_USER_LOCK {
  1830. PULONG Address;
  1831. ULONG Value;
  1832. ULONG Operation;
  1833. ULONG TimeoutInMilliseconds;
  1834. KSTATUS Status;
  1835. } SYSCALL_STRUCT SYSTEM_CALL_USER_LOCK, *PSYSTEM_CALL_USER_LOCK;
  1836. /*++
  1837. Structure Description:
  1838. This structure defines the system call parameters for setting the thread
  1839. ID pointer.
  1840. Members:
  1841. Pointer - Stores the pointer to set.
  1842. --*/
  1843. typedef struct _SYSTEM_CALL_SET_THREAD_ID_POINTER {
  1844. PTHREAD_ID Pointer;
  1845. } SYSCALL_STRUCT SYSTEM_CALL_SET_THREAD_ID_POINTER,
  1846. *PSYSTEM_CALL_SET_THREAD_ID_POINTER;
  1847. /*++
  1848. Structure Description:
  1849. This structure defines the system call parameters for the set umask system
  1850. call. The umask is the set of permission bits that cannot be set on
  1851. newly created files or directories.
  1852. Members:
  1853. Mask - Supplies the new mask to set on input. On output, contains the old
  1854. mask.
  1855. --*/
  1856. typedef struct _SYSTEM_CALL_SET_UMASK {
  1857. FILE_PERMISSIONS Mask;
  1858. } SYSCALL_STRUCT SYSTEM_CALL_SET_UMASK, *PSYSTEM_CALL_SET_UMASK;
  1859. /*++
  1860. Structure Description:
  1861. This structure defines the system call parameters for duplicating a handle.
  1862. Members:
  1863. OldHandle - Stores the handle to be duplicated.
  1864. NewHandle - Stores the destination handle value for the new handle. If this
  1865. is INVALID_HANDLE, then the duplicated handle will be the lowest
  1866. available handle value, and will be returned here. If this is not
  1867. INVALID_HANDLE, then the previous handle at that location will be
  1868. closed. If the new handle equals the existing handle, failure is
  1869. returned.
  1870. OpenFlags - Stores open flags to be set on the new handle. Only
  1871. SYS_OPEN_FLAG_CLOSE_ON_EXECUTE is permitted. If not set, the new handle
  1872. will have the close on execute flag cleared.
  1873. Status - Stores the resulting status code returned by the kernel.
  1874. --*/
  1875. typedef struct _SYSTEM_CALL_DUPLICATE_HANDLE {
  1876. HANDLE OldHandle;
  1877. HANDLE NewHandle;
  1878. ULONG OpenFlags;
  1879. KSTATUS Status;
  1880. } SYSCALL_STRUCT SYSTEM_CALL_DUPLICATE_HANDLE, *PSYSTEM_CALL_DUPLICATE_HANDLE;
  1881. /*++
  1882. Structure Description:
  1883. This structure defines the system call parameters for getting or setting an
  1884. interval timer.
  1885. Members:
  1886. Type - Stores the type of timer to get or set.
  1887. Set - Stores a boolean indicating whether to get the current timer
  1888. expiration information (FALSE) or set it (TRUE).
  1889. DueTime - Stores the relative due time to set for a set operation. For both
  1890. get and set operations, returns the previous due time. Zero means
  1891. disabled. The units here are processor counter ticks for profile and
  1892. virtual timers, or time counter ticks for real timers.
  1893. Period - Stores the periodic interval to set for a set operation. For both
  1894. get and set operations, returns the previous interval period. Zero
  1895. means non-periodic. Units here are processor counter ticks for profile
  1896. and virtual timers, or time counter ticks for real timers.
  1897. Status - Stores the resulting status code returned by the kernel.
  1898. --*/
  1899. typedef struct _SYSTEM_CALL_SET_ITIMER {
  1900. ITIMER_TYPE Type;
  1901. BOOL Set;
  1902. ULONGLONG DueTime;
  1903. ULONGLONG Period;
  1904. KSTATUS Status;
  1905. } SYSCALL_STRUCT SYSTEM_CALL_SET_ITIMER, *PSYSTEM_CALL_SET_ITIMER;
  1906. /*++
  1907. Structure Description:
  1908. This structure defines the system call parameters for getting or setting
  1909. the program break address. Increasing the program break dynamically gives
  1910. the application more memory, usually used for the heap.
  1911. Members:
  1912. Break - Stores the new break address to set. If this is greater than the
  1913. original program, then the kernel will attempt to set the given
  1914. break address, subject to memory limitations. If this is NULL or less
  1915. than the original break, the kernel will not attempt a set. Returns
  1916. the current program break.
  1917. --*/
  1918. typedef struct _SYSTEM_CALL_SET_BREAK {
  1919. PVOID Break;
  1920. } SYSCALL_STRUCT SYSTEM_CALL_SET_BREAK, *PSYSTEM_CALL_SET_BREAK;
  1921. /*++
  1922. Structure Description:
  1923. This structure defines the system call parameters for getting or setting
  1924. the current thread's resource limits.
  1925. Members:
  1926. Type - Stores the type of resource limit to get or set.
  1927. Set - Stores a boolean indicating whether to get the resource limit (FALSE)
  1928. or set it (TRUE).
  1929. Value - Stores the new value to set for set operations on input. Returns
  1930. the previous value that was set for the limit.
  1931. Status - Stores the resulting status code returned by the kernel.
  1932. --*/
  1933. typedef struct _SYSTEM_CALL_SET_RESOURCE_LIMIT {
  1934. RESOURCE_LIMIT_TYPE Type;
  1935. BOOL Set;
  1936. RESOURCE_LIMIT Value;
  1937. KSTATUS Status;
  1938. } SYSCALL_STRUCT SYSTEM_CALL_SET_RESOURCE_LIMIT,
  1939. *PSYSTEM_CALL_SET_RESOURCE_LIMIT;
  1940. /*++
  1941. Structure Description:
  1942. This structure defines a union of all possible system call parameter
  1943. structures. The size of this structure acts as an upper bound for the
  1944. required space neede to make a stack local copy of the user mode parameters.
  1945. Members:
  1946. Stores every possible system call parameter structure.
  1947. --*/
  1948. typedef union _SYSTEM_CALL_PARAMETER_UNION {
  1949. SYSTEM_CALL_RESTORE_CONTEXT RestoreContext;
  1950. SYSTEM_CALL_EXIT_THREAD ExitThread;
  1951. SYSTEM_CALL_OPEN Open;
  1952. SYSTEM_CALL_CLOSE CloseFile;
  1953. SYSTEM_CALL_PERFORM_IO PerformIo;
  1954. SYSTEM_CALL_PERFORM_VECTORED_IO PerformVectoredIo;
  1955. SYSTEM_CALL_CREATE_PIPE CreatePipe;
  1956. SYSTEM_CALL_CREATE_THREAD CreateThread;
  1957. SYSTEM_CALL_FORK_PROCESS ForkProcess;
  1958. SYSTEM_CALL_EXECUTE_IMAGE ExecuteImage;
  1959. SYSTEM_CALL_CHANGE_DIRECTORY ChangeDirectory;
  1960. SYSTEM_CALL_SET_SIGNAL_HANDLER SetSignalHandler;
  1961. SYSTEM_CALL_SEND_SIGNAL SendSignal;
  1962. SYSTEM_CALL_GET_SET_PROCESS_ID GetSetProcessId;
  1963. SYSTEM_CALL_SET_SIGNAL_BEHAVIOR SetSignalBehavior;
  1964. SYSTEM_CALL_WAIT_FOR_CHILD WaitForChild;
  1965. SYSTEM_CALL_SUSPEND_EXECUTION SuspendExecution;
  1966. SYSTEM_CALL_EXIT_PROCESS ExitProcess;
  1967. SYSTEM_CALL_POLL Poll;
  1968. SYSTEM_CALL_SOCKET_CREATE SocketCreate;
  1969. SYSTEM_CALL_SOCKET_BIND SocketBind;
  1970. SYSTEM_CALL_SOCKET_LISTEN SocketListen;
  1971. SYSTEM_CALL_SOCKET_ACCEPT SocketAccept;
  1972. SYSTEM_CALL_SOCKET_CONNECT SocketConnect;
  1973. SYSTEM_CALL_SOCKET_PERFORM_IO SocketPerformIo;
  1974. SYSTEM_CALL_FILE_CONTROL FileControl;
  1975. SYSTEM_CALL_GET_SET_FILE_INFORMATION GetSetFileInformation;
  1976. SYSTEM_CALL_DEBUG Debug;
  1977. SYSTEM_CALL_SEEK Seek;
  1978. SYSTEM_CALL_CREATE_SYMBOLIC_LINK CreateSymbolicLink;
  1979. SYSTEM_CALL_READ_SYMBOLIC_LINK ReadSymbolicLink;
  1980. SYSTEM_CALL_DELETE Delete;
  1981. SYSTEM_CALL_RENAME Rename;
  1982. SYSTEM_CALL_TIME_ZONE_CONTROL TimeZoneControl;
  1983. SYSTEM_CALL_MOUNT_UNMOUNT MountUnmount;
  1984. SYSTEM_CALL_QUERY_TIME_COUNTER QueryTimeCounter;
  1985. SYSTEM_CALL_TIMER_CONTROL TimerControl;
  1986. SYSTEM_CALL_GET_EFFECTIVE_ACCESS GetEffectiveAccess;
  1987. SYSTEM_CALL_DELAY_EXECUTION DelayExecution;
  1988. SYSTEM_CALL_USER_CONTROL UserControl;
  1989. SYSTEM_CALL_FLUSH Flush;
  1990. SYSTEM_CALL_GET_RESOURCE_USAGE GetResourceUsage;
  1991. SYSTEM_CALL_LOAD_DRIVER LoadDriver;
  1992. SYSTEM_CALL_FLUSH_CACHE FlushCache;
  1993. SYSTEM_CALL_GET_CURRENT_DIRECTORY GetCurrentDirectory;
  1994. SYSTEM_CALL_SOCKET_GET_SET_INFORMATION GetSetSocketInformation;
  1995. SYSTEM_CALL_SOCKET_SHUTDOWN SocketShutdown;
  1996. SYSTEM_CALL_CREATE_HARD_LINK CreateHardLink;
  1997. SYSTEM_CALL_MAP_UNMAP_MEMORY MapUnmapMemory;
  1998. SYSTEM_CALL_FLUSH_MEMORY FlushMemory;
  1999. SYSTEM_CALL_LOCATE_DEVICE_INFORMATION LocateDeviceInformation;
  2000. SYSTEM_CALL_GET_SET_DEVICE_INFORMATION GetSetDeviceInformation;
  2001. SYSTEM_CALL_OPEN_DEVICE OpenDevice;
  2002. SYSTEM_CALL_GET_SET_SYSTEM_INFORMATION GetSetSystemInformation;
  2003. SYSTEM_CALL_RESET_SYSTEM ResetSystem;
  2004. SYSTEM_CALL_SET_SYSTEM_TIME SetSystemTime;
  2005. SYSTEM_CALL_SET_MEMORY_PROTECTION SetMemoryProtection;
  2006. SYSTEM_CALL_SET_THREAD_IDENTITY SetThreadIdentity;
  2007. SYSTEM_CALL_SET_THREAD_PERMISSIONS SetThreadPermissions;
  2008. SYSTEM_CALL_SET_SUPPLEMENTARY_GROUPS SetSupplementaryGroups;
  2009. SYSTEM_CALL_SOCKET_CREATE_PAIR SocketCreatePair;
  2010. SYSTEM_CALL_CREATE_TERMINAL CreateTerminal;
  2011. SYSTEM_CALL_SOCKET_PERFORM_VECTORED_IO SocketPerformVectoredIo;
  2012. SYSTEM_CALL_SET_THREAD_POINTER SetThreadPointer;
  2013. SYSTEM_CALL_USER_LOCK UserLock;
  2014. SYSTEM_CALL_SET_THREAD_ID_POINTER SetThreadIdPointer;
  2015. SYSTEM_CALL_SET_UMASK SetUmask;
  2016. SYSTEM_CALL_DUPLICATE_HANDLE DuplicateHandle;
  2017. SYSTEM_CALL_SET_ITIMER SetITimer;
  2018. SYSTEM_CALL_SET_RESOURCE_LIMIT SetResourceLimit;
  2019. SYSTEM_CALL_SET_BREAK SetBreak;
  2020. } SYSCALL_STRUCT SYSTEM_CALL_PARAMETER_UNION, *PSYSTEM_CALL_PARAMETER_UNION;
  2021. typedef
  2022. INTN
  2023. (*PSYSTEM_CALL_ROUTINE) (
  2024. PVOID SystemCallParameter
  2025. );
  2026. /*++
  2027. Routine Description:
  2028. This routine implements the kernel mode functionality behind a particular
  2029. system call.
  2030. Arguments:
  2031. SystemCallParameter - Supplies a pointer to the parameters supplied with
  2032. the system call. This structure will be a stack-local copy of the
  2033. actual parameters passed from user-mode.
  2034. Return Value:
  2035. STATUS_SUCCESS or positive integer on success.
  2036. Error status code on failure.
  2037. --*/
  2038. //
  2039. // -------------------------------------------------------------------- Globals
  2040. //
  2041. //
  2042. // -------------------------------------------------------- Function Prototypes
  2043. //