zsyscall_windows.go 182 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182
  1. // Code generated by 'go generate'; DO NOT EDIT.
  2. package windows
  3. import (
  4. "syscall"
  5. "unsafe"
  6. )
  7. var _ unsafe.Pointer
  8. // Do the interface allocations only once for common
  9. // Errno values.
  10. const (
  11. errnoERROR_IO_PENDING = 997
  12. )
  13. var (
  14. errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING)
  15. errERROR_EINVAL error = syscall.EINVAL
  16. )
  17. // errnoErr returns common boxed Errno values, to prevent
  18. // allocations at runtime.
  19. func errnoErr(e syscall.Errno) error {
  20. switch e {
  21. case 0:
  22. return errERROR_EINVAL
  23. case errnoERROR_IO_PENDING:
  24. return errERROR_IO_PENDING
  25. }
  26. // TODO: add more here, after collecting data on the common
  27. // error values see on Windows. (perhaps when running
  28. // all.bat?)
  29. return e
  30. }
  31. var (
  32. modCfgMgr32 = NewLazySystemDLL("CfgMgr32.dll")
  33. modadvapi32 = NewLazySystemDLL("advapi32.dll")
  34. modcrypt32 = NewLazySystemDLL("crypt32.dll")
  35. moddnsapi = NewLazySystemDLL("dnsapi.dll")
  36. modiphlpapi = NewLazySystemDLL("iphlpapi.dll")
  37. modkernel32 = NewLazySystemDLL("kernel32.dll")
  38. modmswsock = NewLazySystemDLL("mswsock.dll")
  39. modnetapi32 = NewLazySystemDLL("netapi32.dll")
  40. modntdll = NewLazySystemDLL("ntdll.dll")
  41. modole32 = NewLazySystemDLL("ole32.dll")
  42. modpsapi = NewLazySystemDLL("psapi.dll")
  43. modsechost = NewLazySystemDLL("sechost.dll")
  44. modsecur32 = NewLazySystemDLL("secur32.dll")
  45. modsetupapi = NewLazySystemDLL("setupapi.dll")
  46. modshell32 = NewLazySystemDLL("shell32.dll")
  47. moduser32 = NewLazySystemDLL("user32.dll")
  48. moduserenv = NewLazySystemDLL("userenv.dll")
  49. modversion = NewLazySystemDLL("version.dll")
  50. modwintrust = NewLazySystemDLL("wintrust.dll")
  51. modws2_32 = NewLazySystemDLL("ws2_32.dll")
  52. modwtsapi32 = NewLazySystemDLL("wtsapi32.dll")
  53. procCM_Get_DevNode_Status = modCfgMgr32.NewProc("CM_Get_DevNode_Status")
  54. procCM_Get_Device_Interface_ListW = modCfgMgr32.NewProc("CM_Get_Device_Interface_ListW")
  55. procCM_Get_Device_Interface_List_SizeW = modCfgMgr32.NewProc("CM_Get_Device_Interface_List_SizeW")
  56. procCM_MapCrToWin32Err = modCfgMgr32.NewProc("CM_MapCrToWin32Err")
  57. procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups")
  58. procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges")
  59. procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid")
  60. procBuildSecurityDescriptorW = modadvapi32.NewProc("BuildSecurityDescriptorW")
  61. procChangeServiceConfig2W = modadvapi32.NewProc("ChangeServiceConfig2W")
  62. procChangeServiceConfigW = modadvapi32.NewProc("ChangeServiceConfigW")
  63. procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership")
  64. procCloseServiceHandle = modadvapi32.NewProc("CloseServiceHandle")
  65. procControlService = modadvapi32.NewProc("ControlService")
  66. procConvertSecurityDescriptorToStringSecurityDescriptorW = modadvapi32.NewProc("ConvertSecurityDescriptorToStringSecurityDescriptorW")
  67. procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW")
  68. procConvertStringSecurityDescriptorToSecurityDescriptorW = modadvapi32.NewProc("ConvertStringSecurityDescriptorToSecurityDescriptorW")
  69. procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW")
  70. procCopySid = modadvapi32.NewProc("CopySid")
  71. procCreateProcessAsUserW = modadvapi32.NewProc("CreateProcessAsUserW")
  72. procCreateServiceW = modadvapi32.NewProc("CreateServiceW")
  73. procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid")
  74. procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW")
  75. procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom")
  76. procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext")
  77. procDeleteService = modadvapi32.NewProc("DeleteService")
  78. procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource")
  79. procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx")
  80. procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW")
  81. procEqualSid = modadvapi32.NewProc("EqualSid")
  82. procFreeSid = modadvapi32.NewProc("FreeSid")
  83. procGetLengthSid = modadvapi32.NewProc("GetLengthSid")
  84. procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW")
  85. procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl")
  86. procGetSecurityDescriptorDacl = modadvapi32.NewProc("GetSecurityDescriptorDacl")
  87. procGetSecurityDescriptorGroup = modadvapi32.NewProc("GetSecurityDescriptorGroup")
  88. procGetSecurityDescriptorLength = modadvapi32.NewProc("GetSecurityDescriptorLength")
  89. procGetSecurityDescriptorOwner = modadvapi32.NewProc("GetSecurityDescriptorOwner")
  90. procGetSecurityDescriptorRMControl = modadvapi32.NewProc("GetSecurityDescriptorRMControl")
  91. procGetSecurityDescriptorSacl = modadvapi32.NewProc("GetSecurityDescriptorSacl")
  92. procGetSecurityInfo = modadvapi32.NewProc("GetSecurityInfo")
  93. procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority")
  94. procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority")
  95. procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount")
  96. procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation")
  97. procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf")
  98. procInitializeSecurityDescriptor = modadvapi32.NewProc("InitializeSecurityDescriptor")
  99. procInitiateSystemShutdownExW = modadvapi32.NewProc("InitiateSystemShutdownExW")
  100. procIsTokenRestricted = modadvapi32.NewProc("IsTokenRestricted")
  101. procIsValidSecurityDescriptor = modadvapi32.NewProc("IsValidSecurityDescriptor")
  102. procIsValidSid = modadvapi32.NewProc("IsValidSid")
  103. procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid")
  104. procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW")
  105. procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW")
  106. procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW")
  107. procMakeAbsoluteSD = modadvapi32.NewProc("MakeAbsoluteSD")
  108. procMakeSelfRelativeSD = modadvapi32.NewProc("MakeSelfRelativeSD")
  109. procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW")
  110. procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken")
  111. procOpenSCManagerW = modadvapi32.NewProc("OpenSCManagerW")
  112. procOpenServiceW = modadvapi32.NewProc("OpenServiceW")
  113. procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken")
  114. procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
  115. procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW")
  116. procQueryServiceDynamicInformation = modadvapi32.NewProc("QueryServiceDynamicInformation")
  117. procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW")
  118. procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus")
  119. procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
  120. procRegCloseKey = modadvapi32.NewProc("RegCloseKey")
  121. procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW")
  122. procRegNotifyChangeKeyValue = modadvapi32.NewProc("RegNotifyChangeKeyValue")
  123. procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW")
  124. procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW")
  125. procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW")
  126. procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW")
  127. procRegisterServiceCtrlHandlerExW = modadvapi32.NewProc("RegisterServiceCtrlHandlerExW")
  128. procReportEventW = modadvapi32.NewProc("ReportEventW")
  129. procRevertToSelf = modadvapi32.NewProc("RevertToSelf")
  130. procSetEntriesInAclW = modadvapi32.NewProc("SetEntriesInAclW")
  131. procSetKernelObjectSecurity = modadvapi32.NewProc("SetKernelObjectSecurity")
  132. procSetNamedSecurityInfoW = modadvapi32.NewProc("SetNamedSecurityInfoW")
  133. procSetSecurityDescriptorControl = modadvapi32.NewProc("SetSecurityDescriptorControl")
  134. procSetSecurityDescriptorDacl = modadvapi32.NewProc("SetSecurityDescriptorDacl")
  135. procSetSecurityDescriptorGroup = modadvapi32.NewProc("SetSecurityDescriptorGroup")
  136. procSetSecurityDescriptorOwner = modadvapi32.NewProc("SetSecurityDescriptorOwner")
  137. procSetSecurityDescriptorRMControl = modadvapi32.NewProc("SetSecurityDescriptorRMControl")
  138. procSetSecurityDescriptorSacl = modadvapi32.NewProc("SetSecurityDescriptorSacl")
  139. procSetSecurityInfo = modadvapi32.NewProc("SetSecurityInfo")
  140. procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus")
  141. procSetThreadToken = modadvapi32.NewProc("SetThreadToken")
  142. procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation")
  143. procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW")
  144. procStartServiceW = modadvapi32.NewProc("StartServiceW")
  145. procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore")
  146. procCertCloseStore = modcrypt32.NewProc("CertCloseStore")
  147. procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext")
  148. procCertDeleteCertificateFromStore = modcrypt32.NewProc("CertDeleteCertificateFromStore")
  149. procCertDuplicateCertificateContext = modcrypt32.NewProc("CertDuplicateCertificateContext")
  150. procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore")
  151. procCertFindCertificateInStore = modcrypt32.NewProc("CertFindCertificateInStore")
  152. procCertFindChainInStore = modcrypt32.NewProc("CertFindChainInStore")
  153. procCertFindExtension = modcrypt32.NewProc("CertFindExtension")
  154. procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain")
  155. procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext")
  156. procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain")
  157. procCertGetNameStringW = modcrypt32.NewProc("CertGetNameStringW")
  158. procCertOpenStore = modcrypt32.NewProc("CertOpenStore")
  159. procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW")
  160. procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy")
  161. procCryptAcquireCertificatePrivateKey = modcrypt32.NewProc("CryptAcquireCertificatePrivateKey")
  162. procCryptDecodeObject = modcrypt32.NewProc("CryptDecodeObject")
  163. procCryptProtectData = modcrypt32.NewProc("CryptProtectData")
  164. procCryptQueryObject = modcrypt32.NewProc("CryptQueryObject")
  165. procCryptUnprotectData = modcrypt32.NewProc("CryptUnprotectData")
  166. procPFXImportCertStore = modcrypt32.NewProc("PFXImportCertStore")
  167. procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W")
  168. procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W")
  169. procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
  170. procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses")
  171. procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo")
  172. procGetIfEntry = modiphlpapi.NewProc("GetIfEntry")
  173. procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject")
  174. procCancelIo = modkernel32.NewProc("CancelIo")
  175. procCancelIoEx = modkernel32.NewProc("CancelIoEx")
  176. procCloseHandle = modkernel32.NewProc("CloseHandle")
  177. procConnectNamedPipe = modkernel32.NewProc("ConnectNamedPipe")
  178. procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW")
  179. procCreateEventExW = modkernel32.NewProc("CreateEventExW")
  180. procCreateEventW = modkernel32.NewProc("CreateEventW")
  181. procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW")
  182. procCreateFileW = modkernel32.NewProc("CreateFileW")
  183. procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW")
  184. procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort")
  185. procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW")
  186. procCreateMutexExW = modkernel32.NewProc("CreateMutexExW")
  187. procCreateMutexW = modkernel32.NewProc("CreateMutexW")
  188. procCreateNamedPipeW = modkernel32.NewProc("CreateNamedPipeW")
  189. procCreatePipe = modkernel32.NewProc("CreatePipe")
  190. procCreateProcessW = modkernel32.NewProc("CreateProcessW")
  191. procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
  192. procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
  193. procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
  194. procDeleteFileW = modkernel32.NewProc("DeleteFileW")
  195. procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList")
  196. procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
  197. procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
  198. procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
  199. procExitProcess = modkernel32.NewProc("ExitProcess")
  200. procExpandEnvironmentStringsW = modkernel32.NewProc("ExpandEnvironmentStringsW")
  201. procFindClose = modkernel32.NewProc("FindClose")
  202. procFindCloseChangeNotification = modkernel32.NewProc("FindCloseChangeNotification")
  203. procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW")
  204. procFindFirstFileW = modkernel32.NewProc("FindFirstFileW")
  205. procFindFirstVolumeMountPointW = modkernel32.NewProc("FindFirstVolumeMountPointW")
  206. procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
  207. procFindNextChangeNotification = modkernel32.NewProc("FindNextChangeNotification")
  208. procFindNextFileW = modkernel32.NewProc("FindNextFileW")
  209. procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW")
  210. procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW")
  211. procFindResourceW = modkernel32.NewProc("FindResourceW")
  212. procFindVolumeClose = modkernel32.NewProc("FindVolumeClose")
  213. procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose")
  214. procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers")
  215. procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile")
  216. procFormatMessageW = modkernel32.NewProc("FormatMessageW")
  217. procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW")
  218. procFreeLibrary = modkernel32.NewProc("FreeLibrary")
  219. procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
  220. procGetACP = modkernel32.NewProc("GetACP")
  221. procGetCommTimeouts = modkernel32.NewProc("GetCommTimeouts")
  222. procGetCommandLineW = modkernel32.NewProc("GetCommandLineW")
  223. procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW")
  224. procGetComputerNameW = modkernel32.NewProc("GetComputerNameW")
  225. procGetConsoleMode = modkernel32.NewProc("GetConsoleMode")
  226. procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo")
  227. procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW")
  228. procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId")
  229. procGetCurrentThreadId = modkernel32.NewProc("GetCurrentThreadId")
  230. procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW")
  231. procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW")
  232. procGetEnvironmentStringsW = modkernel32.NewProc("GetEnvironmentStringsW")
  233. procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW")
  234. procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess")
  235. procGetFileAttributesExW = modkernel32.NewProc("GetFileAttributesExW")
  236. procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW")
  237. procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle")
  238. procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx")
  239. procGetFileType = modkernel32.NewProc("GetFileType")
  240. procGetFinalPathNameByHandleW = modkernel32.NewProc("GetFinalPathNameByHandleW")
  241. procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW")
  242. procGetLastError = modkernel32.NewProc("GetLastError")
  243. procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW")
  244. procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives")
  245. procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW")
  246. procGetModuleFileNameW = modkernel32.NewProc("GetModuleFileNameW")
  247. procGetModuleHandleExW = modkernel32.NewProc("GetModuleHandleExW")
  248. procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW")
  249. procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo")
  250. procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult")
  251. procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
  252. procGetProcAddress = modkernel32.NewProc("GetProcAddress")
  253. procGetProcessId = modkernel32.NewProc("GetProcessId")
  254. procGetProcessPreferredUILanguages = modkernel32.NewProc("GetProcessPreferredUILanguages")
  255. procGetProcessShutdownParameters = modkernel32.NewProc("GetProcessShutdownParameters")
  256. procGetProcessTimes = modkernel32.NewProc("GetProcessTimes")
  257. procGetProcessWorkingSetSizeEx = modkernel32.NewProc("GetProcessWorkingSetSizeEx")
  258. procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus")
  259. procGetShortPathNameW = modkernel32.NewProc("GetShortPathNameW")
  260. procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW")
  261. procGetStdHandle = modkernel32.NewProc("GetStdHandle")
  262. procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW")
  263. procGetSystemPreferredUILanguages = modkernel32.NewProc("GetSystemPreferredUILanguages")
  264. procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime")
  265. procGetSystemTimePreciseAsFileTime = modkernel32.NewProc("GetSystemTimePreciseAsFileTime")
  266. procGetSystemWindowsDirectoryW = modkernel32.NewProc("GetSystemWindowsDirectoryW")
  267. procGetTempPathW = modkernel32.NewProc("GetTempPathW")
  268. procGetThreadPreferredUILanguages = modkernel32.NewProc("GetThreadPreferredUILanguages")
  269. procGetTickCount64 = modkernel32.NewProc("GetTickCount64")
  270. procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation")
  271. procGetUserPreferredUILanguages = modkernel32.NewProc("GetUserPreferredUILanguages")
  272. procGetVersion = modkernel32.NewProc("GetVersion")
  273. procGetVolumeInformationByHandleW = modkernel32.NewProc("GetVolumeInformationByHandleW")
  274. procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW")
  275. procGetVolumeNameForVolumeMountPointW = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW")
  276. procGetVolumePathNameW = modkernel32.NewProc("GetVolumePathNameW")
  277. procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW")
  278. procGetWindowsDirectoryW = modkernel32.NewProc("GetWindowsDirectoryW")
  279. procInitializeProcThreadAttributeList = modkernel32.NewProc("InitializeProcThreadAttributeList")
  280. procIsWow64Process = modkernel32.NewProc("IsWow64Process")
  281. procIsWow64Process2 = modkernel32.NewProc("IsWow64Process2")
  282. procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
  283. procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
  284. procLoadResource = modkernel32.NewProc("LoadResource")
  285. procLocalAlloc = modkernel32.NewProc("LocalAlloc")
  286. procLocalFree = modkernel32.NewProc("LocalFree")
  287. procLockFileEx = modkernel32.NewProc("LockFileEx")
  288. procLockResource = modkernel32.NewProc("LockResource")
  289. procMapViewOfFile = modkernel32.NewProc("MapViewOfFile")
  290. procModule32FirstW = modkernel32.NewProc("Module32FirstW")
  291. procModule32NextW = modkernel32.NewProc("Module32NextW")
  292. procMoveFileExW = modkernel32.NewProc("MoveFileExW")
  293. procMoveFileW = modkernel32.NewProc("MoveFileW")
  294. procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar")
  295. procOpenEventW = modkernel32.NewProc("OpenEventW")
  296. procOpenMutexW = modkernel32.NewProc("OpenMutexW")
  297. procOpenProcess = modkernel32.NewProc("OpenProcess")
  298. procOpenThread = modkernel32.NewProc("OpenThread")
  299. procPostQueuedCompletionStatus = modkernel32.NewProc("PostQueuedCompletionStatus")
  300. procProcess32FirstW = modkernel32.NewProc("Process32FirstW")
  301. procProcess32NextW = modkernel32.NewProc("Process32NextW")
  302. procProcessIdToSessionId = modkernel32.NewProc("ProcessIdToSessionId")
  303. procPulseEvent = modkernel32.NewProc("PulseEvent")
  304. procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW")
  305. procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW")
  306. procQueryInformationJobObject = modkernel32.NewProc("QueryInformationJobObject")
  307. procReadConsoleW = modkernel32.NewProc("ReadConsoleW")
  308. procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW")
  309. procReadFile = modkernel32.NewProc("ReadFile")
  310. procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory")
  311. procReleaseMutex = modkernel32.NewProc("ReleaseMutex")
  312. procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
  313. procResetEvent = modkernel32.NewProc("ResetEvent")
  314. procResumeThread = modkernel32.NewProc("ResumeThread")
  315. procSetCommTimeouts = modkernel32.NewProc("SetCommTimeouts")
  316. procSetConsoleCursorPosition = modkernel32.NewProc("SetConsoleCursorPosition")
  317. procSetConsoleMode = modkernel32.NewProc("SetConsoleMode")
  318. procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW")
  319. procSetDefaultDllDirectories = modkernel32.NewProc("SetDefaultDllDirectories")
  320. procSetDllDirectoryW = modkernel32.NewProc("SetDllDirectoryW")
  321. procSetEndOfFile = modkernel32.NewProc("SetEndOfFile")
  322. procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW")
  323. procSetErrorMode = modkernel32.NewProc("SetErrorMode")
  324. procSetEvent = modkernel32.NewProc("SetEvent")
  325. procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW")
  326. procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes")
  327. procSetFileInformationByHandle = modkernel32.NewProc("SetFileInformationByHandle")
  328. procSetFilePointer = modkernel32.NewProc("SetFilePointer")
  329. procSetFileTime = modkernel32.NewProc("SetFileTime")
  330. procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
  331. procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
  332. procSetNamedPipeHandleState = modkernel32.NewProc("SetNamedPipeHandleState")
  333. procSetPriorityClass = modkernel32.NewProc("SetPriorityClass")
  334. procSetProcessPriorityBoost = modkernel32.NewProc("SetProcessPriorityBoost")
  335. procSetProcessShutdownParameters = modkernel32.NewProc("SetProcessShutdownParameters")
  336. procSetProcessWorkingSetSizeEx = modkernel32.NewProc("SetProcessWorkingSetSizeEx")
  337. procSetStdHandle = modkernel32.NewProc("SetStdHandle")
  338. procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW")
  339. procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW")
  340. procSizeofResource = modkernel32.NewProc("SizeofResource")
  341. procSleepEx = modkernel32.NewProc("SleepEx")
  342. procTerminateJobObject = modkernel32.NewProc("TerminateJobObject")
  343. procTerminateProcess = modkernel32.NewProc("TerminateProcess")
  344. procThread32First = modkernel32.NewProc("Thread32First")
  345. procThread32Next = modkernel32.NewProc("Thread32Next")
  346. procUnlockFileEx = modkernel32.NewProc("UnlockFileEx")
  347. procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile")
  348. procUpdateProcThreadAttribute = modkernel32.NewProc("UpdateProcThreadAttribute")
  349. procVirtualAlloc = modkernel32.NewProc("VirtualAlloc")
  350. procVirtualFree = modkernel32.NewProc("VirtualFree")
  351. procVirtualLock = modkernel32.NewProc("VirtualLock")
  352. procVirtualProtect = modkernel32.NewProc("VirtualProtect")
  353. procVirtualProtectEx = modkernel32.NewProc("VirtualProtectEx")
  354. procVirtualQuery = modkernel32.NewProc("VirtualQuery")
  355. procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx")
  356. procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
  357. procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId")
  358. procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects")
  359. procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
  360. procWriteConsoleW = modkernel32.NewProc("WriteConsoleW")
  361. procWriteFile = modkernel32.NewProc("WriteFile")
  362. procWriteProcessMemory = modkernel32.NewProc("WriteProcessMemory")
  363. procAcceptEx = modmswsock.NewProc("AcceptEx")
  364. procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs")
  365. procTransmitFile = modmswsock.NewProc("TransmitFile")
  366. procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree")
  367. procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation")
  368. procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
  369. procNtCreateFile = modntdll.NewProc("NtCreateFile")
  370. procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile")
  371. procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess")
  372. procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation")
  373. procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile")
  374. procNtSetInformationProcess = modntdll.NewProc("NtSetInformationProcess")
  375. procNtSetSystemInformation = modntdll.NewProc("NtSetSystemInformation")
  376. procRtlAddFunctionTable = modntdll.NewProc("RtlAddFunctionTable")
  377. procRtlDefaultNpAcl = modntdll.NewProc("RtlDefaultNpAcl")
  378. procRtlDeleteFunctionTable = modntdll.NewProc("RtlDeleteFunctionTable")
  379. procRtlDosPathNameToNtPathName_U_WithStatus = modntdll.NewProc("RtlDosPathNameToNtPathName_U_WithStatus")
  380. procRtlDosPathNameToRelativeNtPathName_U_WithStatus = modntdll.NewProc("RtlDosPathNameToRelativeNtPathName_U_WithStatus")
  381. procRtlGetCurrentPeb = modntdll.NewProc("RtlGetCurrentPeb")
  382. procRtlGetNtVersionNumbers = modntdll.NewProc("RtlGetNtVersionNumbers")
  383. procRtlGetVersion = modntdll.NewProc("RtlGetVersion")
  384. procRtlInitString = modntdll.NewProc("RtlInitString")
  385. procRtlInitUnicodeString = modntdll.NewProc("RtlInitUnicodeString")
  386. procRtlNtStatusToDosErrorNoTeb = modntdll.NewProc("RtlNtStatusToDosErrorNoTeb")
  387. procCLSIDFromString = modole32.NewProc("CLSIDFromString")
  388. procCoCreateGuid = modole32.NewProc("CoCreateGuid")
  389. procCoGetObject = modole32.NewProc("CoGetObject")
  390. procCoInitializeEx = modole32.NewProc("CoInitializeEx")
  391. procCoTaskMemFree = modole32.NewProc("CoTaskMemFree")
  392. procCoUninitialize = modole32.NewProc("CoUninitialize")
  393. procStringFromGUID2 = modole32.NewProc("StringFromGUID2")
  394. procEnumProcessModules = modpsapi.NewProc("EnumProcessModules")
  395. procEnumProcessModulesEx = modpsapi.NewProc("EnumProcessModulesEx")
  396. procEnumProcesses = modpsapi.NewProc("EnumProcesses")
  397. procGetModuleBaseNameW = modpsapi.NewProc("GetModuleBaseNameW")
  398. procGetModuleFileNameExW = modpsapi.NewProc("GetModuleFileNameExW")
  399. procGetModuleInformation = modpsapi.NewProc("GetModuleInformation")
  400. procSubscribeServiceChangeNotifications = modsechost.NewProc("SubscribeServiceChangeNotifications")
  401. procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications")
  402. procGetUserNameExW = modsecur32.NewProc("GetUserNameExW")
  403. procTranslateNameW = modsecur32.NewProc("TranslateNameW")
  404. procSetupDiBuildDriverInfoList = modsetupapi.NewProc("SetupDiBuildDriverInfoList")
  405. procSetupDiCallClassInstaller = modsetupapi.NewProc("SetupDiCallClassInstaller")
  406. procSetupDiCancelDriverInfoSearch = modsetupapi.NewProc("SetupDiCancelDriverInfoSearch")
  407. procSetupDiClassGuidsFromNameExW = modsetupapi.NewProc("SetupDiClassGuidsFromNameExW")
  408. procSetupDiClassNameFromGuidExW = modsetupapi.NewProc("SetupDiClassNameFromGuidExW")
  409. procSetupDiCreateDeviceInfoListExW = modsetupapi.NewProc("SetupDiCreateDeviceInfoListExW")
  410. procSetupDiCreateDeviceInfoW = modsetupapi.NewProc("SetupDiCreateDeviceInfoW")
  411. procSetupDiDestroyDeviceInfoList = modsetupapi.NewProc("SetupDiDestroyDeviceInfoList")
  412. procSetupDiDestroyDriverInfoList = modsetupapi.NewProc("SetupDiDestroyDriverInfoList")
  413. procSetupDiEnumDeviceInfo = modsetupapi.NewProc("SetupDiEnumDeviceInfo")
  414. procSetupDiEnumDriverInfoW = modsetupapi.NewProc("SetupDiEnumDriverInfoW")
  415. procSetupDiGetClassDevsExW = modsetupapi.NewProc("SetupDiGetClassDevsExW")
  416. procSetupDiGetClassInstallParamsW = modsetupapi.NewProc("SetupDiGetClassInstallParamsW")
  417. procSetupDiGetDeviceInfoListDetailW = modsetupapi.NewProc("SetupDiGetDeviceInfoListDetailW")
  418. procSetupDiGetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiGetDeviceInstallParamsW")
  419. procSetupDiGetDeviceInstanceIdW = modsetupapi.NewProc("SetupDiGetDeviceInstanceIdW")
  420. procSetupDiGetDevicePropertyW = modsetupapi.NewProc("SetupDiGetDevicePropertyW")
  421. procSetupDiGetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiGetDeviceRegistryPropertyW")
  422. procSetupDiGetDriverInfoDetailW = modsetupapi.NewProc("SetupDiGetDriverInfoDetailW")
  423. procSetupDiGetSelectedDevice = modsetupapi.NewProc("SetupDiGetSelectedDevice")
  424. procSetupDiGetSelectedDriverW = modsetupapi.NewProc("SetupDiGetSelectedDriverW")
  425. procSetupDiOpenDevRegKey = modsetupapi.NewProc("SetupDiOpenDevRegKey")
  426. procSetupDiSetClassInstallParamsW = modsetupapi.NewProc("SetupDiSetClassInstallParamsW")
  427. procSetupDiSetDeviceInstallParamsW = modsetupapi.NewProc("SetupDiSetDeviceInstallParamsW")
  428. procSetupDiSetDeviceRegistryPropertyW = modsetupapi.NewProc("SetupDiSetDeviceRegistryPropertyW")
  429. procSetupDiSetSelectedDevice = modsetupapi.NewProc("SetupDiSetSelectedDevice")
  430. procSetupDiSetSelectedDriverW = modsetupapi.NewProc("SetupDiSetSelectedDriverW")
  431. procSetupUninstallOEMInfW = modsetupapi.NewProc("SetupUninstallOEMInfW")
  432. procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW")
  433. procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath")
  434. procShellExecuteW = modshell32.NewProc("ShellExecuteW")
  435. procExitWindowsEx = moduser32.NewProc("ExitWindowsEx")
  436. procGetShellWindow = moduser32.NewProc("GetShellWindow")
  437. procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
  438. procMessageBoxW = moduser32.NewProc("MessageBoxW")
  439. procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
  440. procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
  441. procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
  442. procGetFileVersionInfoSizeW = modversion.NewProc("GetFileVersionInfoSizeW")
  443. procGetFileVersionInfoW = modversion.NewProc("GetFileVersionInfoW")
  444. procVerQueryValueW = modversion.NewProc("VerQueryValueW")
  445. procWinVerifyTrustEx = modwintrust.NewProc("WinVerifyTrustEx")
  446. procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW")
  447. procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW")
  448. procWSACleanup = modws2_32.NewProc("WSACleanup")
  449. procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW")
  450. procWSAGetOverlappedResult = modws2_32.NewProc("WSAGetOverlappedResult")
  451. procWSAIoctl = modws2_32.NewProc("WSAIoctl")
  452. procWSARecv = modws2_32.NewProc("WSARecv")
  453. procWSARecvFrom = modws2_32.NewProc("WSARecvFrom")
  454. procWSASend = modws2_32.NewProc("WSASend")
  455. procWSASendTo = modws2_32.NewProc("WSASendTo")
  456. procWSASocketW = modws2_32.NewProc("WSASocketW")
  457. procWSAStartup = modws2_32.NewProc("WSAStartup")
  458. procbind = modws2_32.NewProc("bind")
  459. procclosesocket = modws2_32.NewProc("closesocket")
  460. procconnect = modws2_32.NewProc("connect")
  461. procgethostbyname = modws2_32.NewProc("gethostbyname")
  462. procgetpeername = modws2_32.NewProc("getpeername")
  463. procgetprotobyname = modws2_32.NewProc("getprotobyname")
  464. procgetservbyname = modws2_32.NewProc("getservbyname")
  465. procgetsockname = modws2_32.NewProc("getsockname")
  466. procgetsockopt = modws2_32.NewProc("getsockopt")
  467. proclisten = modws2_32.NewProc("listen")
  468. procntohs = modws2_32.NewProc("ntohs")
  469. procrecvfrom = modws2_32.NewProc("recvfrom")
  470. procsendto = modws2_32.NewProc("sendto")
  471. procsetsockopt = modws2_32.NewProc("setsockopt")
  472. procshutdown = modws2_32.NewProc("shutdown")
  473. procsocket = modws2_32.NewProc("socket")
  474. procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW")
  475. procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory")
  476. procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken")
  477. )
  478. func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) {
  479. r0, _, _ := syscall.Syscall6(procCM_Get_DevNode_Status.Addr(), 4, uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags), 0, 0)
  480. ret = CONFIGRET(r0)
  481. return
  482. }
  483. func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) {
  484. r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_ListW.Addr(), 5, uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags), 0)
  485. ret = CONFIGRET(r0)
  486. return
  487. }
  488. func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) {
  489. r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_List_SizeW.Addr(), 4, uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags), 0, 0)
  490. ret = CONFIGRET(r0)
  491. return
  492. }
  493. func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) {
  494. r0, _, _ := syscall.Syscall(procCM_MapCrToWin32Err.Addr(), 2, uintptr(configRet), uintptr(defaultWin32Error), 0)
  495. ret = Errno(r0)
  496. return
  497. }
  498. func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) {
  499. var _p0 uint32
  500. if resetToDefault {
  501. _p0 = 1
  502. }
  503. r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
  504. if r1 == 0 {
  505. err = errnoErr(e1)
  506. }
  507. return
  508. }
  509. func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) {
  510. var _p0 uint32
  511. if disableAllPrivileges {
  512. _p0 = 1
  513. }
  514. r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
  515. if r1 == 0 {
  516. err = errnoErr(e1)
  517. }
  518. return
  519. }
  520. func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) {
  521. r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0)
  522. if r1 == 0 {
  523. err = errnoErr(e1)
  524. }
  525. return
  526. }
  527. func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) {
  528. r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor)))
  529. if r0 != 0 {
  530. ret = syscall.Errno(r0)
  531. }
  532. return
  533. }
  534. func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) {
  535. r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info)))
  536. if r1 == 0 {
  537. err = errnoErr(e1)
  538. }
  539. return
  540. }
  541. func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) {
  542. r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0)
  543. if r1 == 0 {
  544. err = errnoErr(e1)
  545. }
  546. return
  547. }
  548. func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) {
  549. r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember)))
  550. if r1 == 0 {
  551. err = errnoErr(e1)
  552. }
  553. return
  554. }
  555. func CloseServiceHandle(handle Handle) (err error) {
  556. r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0)
  557. if r1 == 0 {
  558. err = errnoErr(e1)
  559. }
  560. return
  561. }
  562. func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) {
  563. r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status)))
  564. if r1 == 0 {
  565. err = errnoErr(e1)
  566. }
  567. return
  568. }
  569. func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) {
  570. r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0)
  571. if r1 == 0 {
  572. err = errnoErr(e1)
  573. }
  574. return
  575. }
  576. func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) {
  577. r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0)
  578. if r1 == 0 {
  579. err = errnoErr(e1)
  580. }
  581. return
  582. }
  583. func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
  584. var _p0 *uint16
  585. _p0, err = syscall.UTF16PtrFromString(str)
  586. if err != nil {
  587. return
  588. }
  589. return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size)
  590. }
  591. func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) {
  592. r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0)
  593. if r1 == 0 {
  594. err = errnoErr(e1)
  595. }
  596. return
  597. }
  598. func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) {
  599. r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0)
  600. if r1 == 0 {
  601. err = errnoErr(e1)
  602. }
  603. return
  604. }
  605. func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) {
  606. r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid)))
  607. if r1 == 0 {
  608. err = errnoErr(e1)
  609. }
  610. return
  611. }
  612. func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
  613. var _p0 uint32
  614. if inheritHandles {
  615. _p0 = 1
  616. }
  617. r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0)
  618. if r1 == 0 {
  619. err = errnoErr(e1)
  620. }
  621. return
  622. }
  623. func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) {
  624. r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0)
  625. handle = Handle(r0)
  626. if handle == 0 {
  627. err = errnoErr(e1)
  628. }
  629. return
  630. }
  631. func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) {
  632. r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0)
  633. if r1 == 0 {
  634. err = errnoErr(e1)
  635. }
  636. return
  637. }
  638. func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) {
  639. r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0)
  640. if r1 == 0 {
  641. err = errnoErr(e1)
  642. }
  643. return
  644. }
  645. func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) {
  646. r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
  647. if r1 == 0 {
  648. err = errnoErr(e1)
  649. }
  650. return
  651. }
  652. func CryptReleaseContext(provhandle Handle, flags uint32) (err error) {
  653. r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0)
  654. if r1 == 0 {
  655. err = errnoErr(e1)
  656. }
  657. return
  658. }
  659. func DeleteService(service Handle) (err error) {
  660. r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0)
  661. if r1 == 0 {
  662. err = errnoErr(e1)
  663. }
  664. return
  665. }
  666. func DeregisterEventSource(handle Handle) (err error) {
  667. r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0)
  668. if r1 == 0 {
  669. err = errnoErr(e1)
  670. }
  671. return
  672. }
  673. func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) {
  674. r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken)))
  675. if r1 == 0 {
  676. err = errnoErr(e1)
  677. }
  678. return
  679. }
  680. func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) {
  681. r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0)
  682. if r1 == 0 {
  683. err = errnoErr(e1)
  684. }
  685. return
  686. }
  687. func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) {
  688. r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0)
  689. isEqual = r0 != 0
  690. return
  691. }
  692. func FreeSid(sid *SID) (err error) {
  693. r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
  694. if r1 != 0 {
  695. err = errnoErr(e1)
  696. }
  697. return
  698. }
  699. func GetLengthSid(sid *SID) (len uint32) {
  700. r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
  701. len = uint32(r0)
  702. return
  703. }
  704. func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
  705. var _p0 *uint16
  706. _p0, ret = syscall.UTF16PtrFromString(objectName)
  707. if ret != nil {
  708. return
  709. }
  710. return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd)
  711. }
  712. func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
  713. r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
  714. if r0 != 0 {
  715. ret = syscall.Errno(r0)
  716. }
  717. return
  718. }
  719. func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) {
  720. r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision)))
  721. if r1 == 0 {
  722. err = errnoErr(e1)
  723. }
  724. return
  725. }
  726. func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) {
  727. var _p0 uint32
  728. if *daclPresent {
  729. _p0 = 1
  730. }
  731. var _p1 uint32
  732. if *daclDefaulted {
  733. _p1 = 1
  734. }
  735. r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
  736. *daclPresent = _p0 != 0
  737. *daclDefaulted = _p1 != 0
  738. if r1 == 0 {
  739. err = errnoErr(e1)
  740. }
  741. return
  742. }
  743. func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) {
  744. var _p0 uint32
  745. if *groupDefaulted {
  746. _p0 = 1
  747. }
  748. r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0)))
  749. *groupDefaulted = _p0 != 0
  750. if r1 == 0 {
  751. err = errnoErr(e1)
  752. }
  753. return
  754. }
  755. func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) {
  756. r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
  757. len = uint32(r0)
  758. return
  759. }
  760. func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) {
  761. var _p0 uint32
  762. if *ownerDefaulted {
  763. _p0 = 1
  764. }
  765. r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0)))
  766. *ownerDefaulted = _p0 != 0
  767. if r1 == 0 {
  768. err = errnoErr(e1)
  769. }
  770. return
  771. }
  772. func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) {
  773. r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
  774. if r0 != 0 {
  775. ret = syscall.Errno(r0)
  776. }
  777. return
  778. }
  779. func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) {
  780. var _p0 uint32
  781. if *saclPresent {
  782. _p0 = 1
  783. }
  784. var _p1 uint32
  785. if *saclDefaulted {
  786. _p1 = 1
  787. }
  788. r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0)
  789. *saclPresent = _p0 != 0
  790. *saclDefaulted = _p1 != 0
  791. if r1 == 0 {
  792. err = errnoErr(e1)
  793. }
  794. return
  795. }
  796. func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) {
  797. r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0)
  798. if r0 != 0 {
  799. ret = syscall.Errno(r0)
  800. }
  801. return
  802. }
  803. func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) {
  804. r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
  805. authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0))
  806. return
  807. }
  808. func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) {
  809. r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0)
  810. subAuthority = (*uint32)(unsafe.Pointer(r0))
  811. return
  812. }
  813. func getSidSubAuthorityCount(sid *SID) (count *uint8) {
  814. r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
  815. count = (*uint8)(unsafe.Pointer(r0))
  816. return
  817. }
  818. func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) {
  819. r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0)
  820. if r1 == 0 {
  821. err = errnoErr(e1)
  822. }
  823. return
  824. }
  825. func ImpersonateSelf(impersonationlevel uint32) (err error) {
  826. r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
  827. if r1 == 0 {
  828. err = errnoErr(e1)
  829. }
  830. return
  831. }
  832. func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) {
  833. r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0)
  834. if r1 == 0 {
  835. err = errnoErr(e1)
  836. }
  837. return
  838. }
  839. func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) {
  840. var _p0 uint32
  841. if forceAppsClosed {
  842. _p0 = 1
  843. }
  844. var _p1 uint32
  845. if rebootAfterShutdown {
  846. _p1 = 1
  847. }
  848. r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason))
  849. if r1 == 0 {
  850. err = errnoErr(e1)
  851. }
  852. return
  853. }
  854. func isTokenRestricted(tokenHandle Token) (ret bool, err error) {
  855. r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0)
  856. ret = r0 != 0
  857. if !ret {
  858. err = errnoErr(e1)
  859. }
  860. return
  861. }
  862. func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) {
  863. r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0)
  864. isValid = r0 != 0
  865. return
  866. }
  867. func isValidSid(sid *SID) (isValid bool) {
  868. r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
  869. isValid = r0 != 0
  870. return
  871. }
  872. func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) {
  873. r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0)
  874. isWellKnown = r0 != 0
  875. return
  876. }
  877. func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
  878. r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
  879. if r1 == 0 {
  880. err = errnoErr(e1)
  881. }
  882. return
  883. }
  884. func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) {
  885. r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0)
  886. if r1 == 0 {
  887. err = errnoErr(e1)
  888. }
  889. return
  890. }
  891. func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
  892. r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
  893. if r1 == 0 {
  894. err = errnoErr(e1)
  895. }
  896. return
  897. }
  898. func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) {
  899. r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0)
  900. if r1 == 0 {
  901. err = errnoErr(e1)
  902. }
  903. return
  904. }
  905. func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) {
  906. r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize)))
  907. if r1 == 0 {
  908. err = errnoErr(e1)
  909. }
  910. return
  911. }
  912. func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) {
  913. r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier)))
  914. if r0 != 0 {
  915. ret = syscall.Errno(r0)
  916. }
  917. return
  918. }
  919. func OpenProcessToken(process Handle, access uint32, token *Token) (err error) {
  920. r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token)))
  921. if r1 == 0 {
  922. err = errnoErr(e1)
  923. }
  924. return
  925. }
  926. func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) {
  927. r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
  928. handle = Handle(r0)
  929. if handle == 0 {
  930. err = errnoErr(e1)
  931. }
  932. return
  933. }
  934. func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) {
  935. r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
  936. handle = Handle(r0)
  937. if handle == 0 {
  938. err = errnoErr(e1)
  939. }
  940. return
  941. }
  942. func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) {
  943. var _p0 uint32
  944. if openAsSelf {
  945. _p0 = 1
  946. }
  947. r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
  948. if r1 == 0 {
  949. err = errnoErr(e1)
  950. }
  951. return
  952. }
  953. func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
  954. r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
  955. if r1 == 0 {
  956. err = errnoErr(e1)
  957. }
  958. return
  959. }
  960. func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) {
  961. r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
  962. if r1 == 0 {
  963. err = errnoErr(e1)
  964. }
  965. return
  966. }
  967. func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) {
  968. err = procQueryServiceDynamicInformation.Find()
  969. if err != nil {
  970. return
  971. }
  972. r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo))
  973. if r1 == 0 {
  974. err = errnoErr(e1)
  975. }
  976. return
  977. }
  978. func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
  979. r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
  980. if r1 == 0 {
  981. err = errnoErr(e1)
  982. }
  983. return
  984. }
  985. func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) {
  986. r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0)
  987. if r1 == 0 {
  988. err = errnoErr(e1)
  989. }
  990. return
  991. }
  992. func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) {
  993. r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0)
  994. if r1 == 0 {
  995. err = errnoErr(e1)
  996. }
  997. return
  998. }
  999. func RegCloseKey(key Handle) (regerrno error) {
  1000. r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0)
  1001. if r0 != 0 {
  1002. regerrno = syscall.Errno(r0)
  1003. }
  1004. return
  1005. }
  1006. func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) {
  1007. r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0)
  1008. if r0 != 0 {
  1009. regerrno = syscall.Errno(r0)
  1010. }
  1011. return
  1012. }
  1013. func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) {
  1014. var _p0 uint32
  1015. if watchSubtree {
  1016. _p0 = 1
  1017. }
  1018. var _p1 uint32
  1019. if asynchronous {
  1020. _p1 = 1
  1021. }
  1022. r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0)
  1023. if r0 != 0 {
  1024. regerrno = syscall.Errno(r0)
  1025. }
  1026. return
  1027. }
  1028. func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
  1029. r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
  1030. if r0 != 0 {
  1031. regerrno = syscall.Errno(r0)
  1032. }
  1033. return
  1034. }
  1035. func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) {
  1036. r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime)))
  1037. if r0 != 0 {
  1038. regerrno = syscall.Errno(r0)
  1039. }
  1040. return
  1041. }
  1042. func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
  1043. r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)))
  1044. if r0 != 0 {
  1045. regerrno = syscall.Errno(r0)
  1046. }
  1047. return
  1048. }
  1049. func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) {
  1050. r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0)
  1051. handle = Handle(r0)
  1052. if handle == 0 {
  1053. err = errnoErr(e1)
  1054. }
  1055. return
  1056. }
  1057. func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) {
  1058. r0, _, e1 := syscall.Syscall(procRegisterServiceCtrlHandlerExW.Addr(), 3, uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context))
  1059. handle = Handle(r0)
  1060. if handle == 0 {
  1061. err = errnoErr(e1)
  1062. }
  1063. return
  1064. }
  1065. func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) {
  1066. r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData)))
  1067. if r1 == 0 {
  1068. err = errnoErr(e1)
  1069. }
  1070. return
  1071. }
  1072. func RevertToSelf() (err error) {
  1073. r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
  1074. if r1 == 0 {
  1075. err = errnoErr(e1)
  1076. }
  1077. return
  1078. }
  1079. func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) {
  1080. r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0)
  1081. if r0 != 0 {
  1082. ret = syscall.Errno(r0)
  1083. }
  1084. return
  1085. }
  1086. func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) {
  1087. r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor)))
  1088. if r1 == 0 {
  1089. err = errnoErr(e1)
  1090. }
  1091. return
  1092. }
  1093. func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
  1094. var _p0 *uint16
  1095. _p0, ret = syscall.UTF16PtrFromString(objectName)
  1096. if ret != nil {
  1097. return
  1098. }
  1099. return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl)
  1100. }
  1101. func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
  1102. r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
  1103. if r0 != 0 {
  1104. ret = syscall.Errno(r0)
  1105. }
  1106. return
  1107. }
  1108. func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) {
  1109. r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet))
  1110. if r1 == 0 {
  1111. err = errnoErr(e1)
  1112. }
  1113. return
  1114. }
  1115. func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) {
  1116. var _p0 uint32
  1117. if daclPresent {
  1118. _p0 = 1
  1119. }
  1120. var _p1 uint32
  1121. if daclDefaulted {
  1122. _p1 = 1
  1123. }
  1124. r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0)
  1125. if r1 == 0 {
  1126. err = errnoErr(e1)
  1127. }
  1128. return
  1129. }
  1130. func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) {
  1131. var _p0 uint32
  1132. if groupDefaulted {
  1133. _p0 = 1
  1134. }
  1135. r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0))
  1136. if r1 == 0 {
  1137. err = errnoErr(e1)
  1138. }
  1139. return
  1140. }
  1141. func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) {
  1142. var _p0 uint32
  1143. if ownerDefaulted {
  1144. _p0 = 1
  1145. }
  1146. r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0))
  1147. if r1 == 0 {
  1148. err = errnoErr(e1)
  1149. }
  1150. return
  1151. }
  1152. func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) {
  1153. syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0)
  1154. return
  1155. }
  1156. func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) {
  1157. var _p0 uint32
  1158. if saclPresent {
  1159. _p0 = 1
  1160. }
  1161. var _p1 uint32
  1162. if saclDefaulted {
  1163. _p1 = 1
  1164. }
  1165. r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0)
  1166. if r1 == 0 {
  1167. err = errnoErr(e1)
  1168. }
  1169. return
  1170. }
  1171. func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) {
  1172. r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0)
  1173. if r0 != 0 {
  1174. ret = syscall.Errno(r0)
  1175. }
  1176. return
  1177. }
  1178. func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) {
  1179. r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0)
  1180. if r1 == 0 {
  1181. err = errnoErr(e1)
  1182. }
  1183. return
  1184. }
  1185. func SetThreadToken(thread *Handle, token Token) (err error) {
  1186. r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0)
  1187. if r1 == 0 {
  1188. err = errnoErr(e1)
  1189. }
  1190. return
  1191. }
  1192. func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) {
  1193. r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0)
  1194. if r1 == 0 {
  1195. err = errnoErr(e1)
  1196. }
  1197. return
  1198. }
  1199. func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) {
  1200. r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0)
  1201. if r1 == 0 {
  1202. err = errnoErr(e1)
  1203. }
  1204. return
  1205. }
  1206. func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) {
  1207. r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors)))
  1208. if r1 == 0 {
  1209. err = errnoErr(e1)
  1210. }
  1211. return
  1212. }
  1213. func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) {
  1214. r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0)
  1215. if r1 == 0 {
  1216. err = errnoErr(e1)
  1217. }
  1218. return
  1219. }
  1220. func CertCloseStore(store Handle, flags uint32) (err error) {
  1221. r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0)
  1222. if r1 == 0 {
  1223. err = errnoErr(e1)
  1224. }
  1225. return
  1226. }
  1227. func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) {
  1228. r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen))
  1229. context = (*CertContext)(unsafe.Pointer(r0))
  1230. if context == nil {
  1231. err = errnoErr(e1)
  1232. }
  1233. return
  1234. }
  1235. func CertDeleteCertificateFromStore(certContext *CertContext) (err error) {
  1236. r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
  1237. if r1 == 0 {
  1238. err = errnoErr(e1)
  1239. }
  1240. return
  1241. }
  1242. func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) {
  1243. r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
  1244. dupContext = (*CertContext)(unsafe.Pointer(r0))
  1245. return
  1246. }
  1247. func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
  1248. r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
  1249. context = (*CertContext)(unsafe.Pointer(r0))
  1250. if context == nil {
  1251. err = errnoErr(e1)
  1252. }
  1253. return
  1254. }
  1255. func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) {
  1256. r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext)))
  1257. cert = (*CertContext)(unsafe.Pointer(r0))
  1258. if cert == nil {
  1259. err = errnoErr(e1)
  1260. }
  1261. return
  1262. }
  1263. func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) {
  1264. r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext)))
  1265. certchain = (*CertChainContext)(unsafe.Pointer(r0))
  1266. if certchain == nil {
  1267. err = errnoErr(e1)
  1268. }
  1269. return
  1270. }
  1271. func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) {
  1272. r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions)))
  1273. ret = (*CertExtension)(unsafe.Pointer(r0))
  1274. return
  1275. }
  1276. func CertFreeCertificateChain(ctx *CertChainContext) {
  1277. syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
  1278. return
  1279. }
  1280. func CertFreeCertificateContext(ctx *CertContext) (err error) {
  1281. r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
  1282. if r1 == 0 {
  1283. err = errnoErr(e1)
  1284. }
  1285. return
  1286. }
  1287. func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) {
  1288. r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0)
  1289. if r1 == 0 {
  1290. err = errnoErr(e1)
  1291. }
  1292. return
  1293. }
  1294. func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) {
  1295. r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size))
  1296. chars = uint32(r0)
  1297. return
  1298. }
  1299. func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
  1300. r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
  1301. handle = Handle(r0)
  1302. if handle == 0 {
  1303. err = errnoErr(e1)
  1304. }
  1305. return
  1306. }
  1307. func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) {
  1308. r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0)
  1309. store = Handle(r0)
  1310. if store == 0 {
  1311. err = errnoErr(e1)
  1312. }
  1313. return
  1314. }
  1315. func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) {
  1316. r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0)
  1317. if r1 == 0 {
  1318. err = errnoErr(e1)
  1319. }
  1320. return
  1321. }
  1322. func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) {
  1323. var _p0 uint32
  1324. if *callerFreeProvOrNCryptKey {
  1325. _p0 = 1
  1326. }
  1327. r1, _, e1 := syscall.Syscall6(procCryptAcquireCertificatePrivateKey.Addr(), 6, uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0)))
  1328. *callerFreeProvOrNCryptKey = _p0 != 0
  1329. if r1 == 0 {
  1330. err = errnoErr(e1)
  1331. }
  1332. return
  1333. }
  1334. func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) {
  1335. r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0)
  1336. if r1 == 0 {
  1337. err = errnoErr(e1)
  1338. }
  1339. return
  1340. }
  1341. func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) {
  1342. r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0)
  1343. if r1 == 0 {
  1344. err = errnoErr(e1)
  1345. }
  1346. return
  1347. }
  1348. func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) {
  1349. r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0)
  1350. if r1 == 0 {
  1351. err = errnoErr(e1)
  1352. }
  1353. return
  1354. }
  1355. func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) {
  1356. r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0)
  1357. if r1 == 0 {
  1358. err = errnoErr(e1)
  1359. }
  1360. return
  1361. }
  1362. func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) {
  1363. r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags))
  1364. store = Handle(r0)
  1365. if store == 0 {
  1366. err = errnoErr(e1)
  1367. }
  1368. return
  1369. }
  1370. func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
  1371. r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
  1372. same = r0 != 0
  1373. return
  1374. }
  1375. func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
  1376. var _p0 *uint16
  1377. _p0, status = syscall.UTF16PtrFromString(name)
  1378. if status != nil {
  1379. return
  1380. }
  1381. return _DnsQuery(_p0, qtype, options, extra, qrs, pr)
  1382. }
  1383. func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) {
  1384. r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
  1385. if r0 != 0 {
  1386. status = syscall.Errno(r0)
  1387. }
  1388. return
  1389. }
  1390. func DnsRecordListFree(rl *DNSRecord, freetype uint32) {
  1391. syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0)
  1392. return
  1393. }
  1394. func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
  1395. r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
  1396. if r0 != 0 {
  1397. errcode = syscall.Errno(r0)
  1398. }
  1399. return
  1400. }
  1401. func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) {
  1402. r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0)
  1403. if r0 != 0 {
  1404. errcode = syscall.Errno(r0)
  1405. }
  1406. return
  1407. }
  1408. func GetIfEntry(pIfRow *MibIfRow) (errcode error) {
  1409. r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0)
  1410. if r0 != 0 {
  1411. errcode = syscall.Errno(r0)
  1412. }
  1413. return
  1414. }
  1415. func AssignProcessToJobObject(job Handle, process Handle) (err error) {
  1416. r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0)
  1417. if r1 == 0 {
  1418. err = errnoErr(e1)
  1419. }
  1420. return
  1421. }
  1422. func CancelIo(s Handle) (err error) {
  1423. r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0)
  1424. if r1 == 0 {
  1425. err = errnoErr(e1)
  1426. }
  1427. return
  1428. }
  1429. func CancelIoEx(s Handle, o *Overlapped) (err error) {
  1430. r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0)
  1431. if r1 == 0 {
  1432. err = errnoErr(e1)
  1433. }
  1434. return
  1435. }
  1436. func CloseHandle(handle Handle) (err error) {
  1437. r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0)
  1438. if r1 == 0 {
  1439. err = errnoErr(e1)
  1440. }
  1441. return
  1442. }
  1443. func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) {
  1444. r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0)
  1445. if r1 == 0 {
  1446. err = errnoErr(e1)
  1447. }
  1448. return
  1449. }
  1450. func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) {
  1451. r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0)
  1452. if r1 == 0 {
  1453. err = errnoErr(e1)
  1454. }
  1455. return
  1456. }
  1457. func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
  1458. r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
  1459. handle = Handle(r0)
  1460. if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
  1461. err = errnoErr(e1)
  1462. }
  1463. return
  1464. }
  1465. func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) {
  1466. r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
  1467. handle = Handle(r0)
  1468. if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
  1469. err = errnoErr(e1)
  1470. }
  1471. return
  1472. }
  1473. func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) {
  1474. r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name)))
  1475. handle = Handle(r0)
  1476. if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
  1477. err = errnoErr(e1)
  1478. }
  1479. return
  1480. }
  1481. func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) {
  1482. r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0)
  1483. handle = Handle(r0)
  1484. if handle == InvalidHandle {
  1485. err = errnoErr(e1)
  1486. }
  1487. return
  1488. }
  1489. func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) {
  1490. r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved))
  1491. if r1&0xff == 0 {
  1492. err = errnoErr(e1)
  1493. }
  1494. return
  1495. }
  1496. func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) {
  1497. r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
  1498. handle = Handle(r0)
  1499. if handle == 0 {
  1500. err = errnoErr(e1)
  1501. }
  1502. return
  1503. }
  1504. func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) {
  1505. r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0)
  1506. handle = Handle(r0)
  1507. if handle == 0 {
  1508. err = errnoErr(e1)
  1509. }
  1510. return
  1511. }
  1512. func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) {
  1513. r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0)
  1514. handle = Handle(r0)
  1515. if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
  1516. err = errnoErr(e1)
  1517. }
  1518. return
  1519. }
  1520. func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) {
  1521. var _p0 uint32
  1522. if initialOwner {
  1523. _p0 = 1
  1524. }
  1525. r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name)))
  1526. handle = Handle(r0)
  1527. if handle == 0 || e1 == ERROR_ALREADY_EXISTS {
  1528. err = errnoErr(e1)
  1529. }
  1530. return
  1531. }
  1532. func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) {
  1533. r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0)
  1534. handle = Handle(r0)
  1535. if handle == InvalidHandle {
  1536. err = errnoErr(e1)
  1537. }
  1538. return
  1539. }
  1540. func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) {
  1541. r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0)
  1542. if r1 == 0 {
  1543. err = errnoErr(e1)
  1544. }
  1545. return
  1546. }
  1547. func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) {
  1548. var _p0 uint32
  1549. if inheritHandles {
  1550. _p0 = 1
  1551. }
  1552. r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0)
  1553. if r1 == 0 {
  1554. err = errnoErr(e1)
  1555. }
  1556. return
  1557. }
  1558. func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) {
  1559. r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags))
  1560. if r1&0xff == 0 {
  1561. err = errnoErr(e1)
  1562. }
  1563. return
  1564. }
  1565. func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) {
  1566. r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0)
  1567. handle = Handle(r0)
  1568. if handle == InvalidHandle {
  1569. err = errnoErr(e1)
  1570. }
  1571. return
  1572. }
  1573. func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
  1574. r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
  1575. if r1 == 0 {
  1576. err = errnoErr(e1)
  1577. }
  1578. return
  1579. }
  1580. func DeleteFile(path *uint16) (err error) {
  1581. r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
  1582. if r1 == 0 {
  1583. err = errnoErr(e1)
  1584. }
  1585. return
  1586. }
  1587. func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) {
  1588. syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0)
  1589. return
  1590. }
  1591. func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) {
  1592. r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0)
  1593. if r1 == 0 {
  1594. err = errnoErr(e1)
  1595. }
  1596. return
  1597. }
  1598. func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
  1599. r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
  1600. if r1 == 0 {
  1601. err = errnoErr(e1)
  1602. }
  1603. return
  1604. }
  1605. func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) {
  1606. var _p0 uint32
  1607. if bInheritHandle {
  1608. _p0 = 1
  1609. }
  1610. r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0)
  1611. if r1 == 0 {
  1612. err = errnoErr(e1)
  1613. }
  1614. return
  1615. }
  1616. func ExitProcess(exitcode uint32) {
  1617. syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0)
  1618. return
  1619. }
  1620. func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) {
  1621. r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
  1622. n = uint32(r0)
  1623. if n == 0 {
  1624. err = errnoErr(e1)
  1625. }
  1626. return
  1627. }
  1628. func FindClose(handle Handle) (err error) {
  1629. r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0)
  1630. if r1 == 0 {
  1631. err = errnoErr(e1)
  1632. }
  1633. return
  1634. }
  1635. func FindCloseChangeNotification(handle Handle) (err error) {
  1636. r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0)
  1637. if r1 == 0 {
  1638. err = errnoErr(e1)
  1639. }
  1640. return
  1641. }
  1642. func FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) {
  1643. var _p0 *uint16
  1644. _p0, err = syscall.UTF16PtrFromString(path)
  1645. if err != nil {
  1646. return
  1647. }
  1648. return _FindFirstChangeNotification(_p0, watchSubtree, notifyFilter)
  1649. }
  1650. func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) {
  1651. var _p1 uint32
  1652. if watchSubtree {
  1653. _p1 = 1
  1654. }
  1655. r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter))
  1656. handle = Handle(r0)
  1657. if handle == InvalidHandle {
  1658. err = errnoErr(e1)
  1659. }
  1660. return
  1661. }
  1662. func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
  1663. r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
  1664. handle = Handle(r0)
  1665. if handle == InvalidHandle {
  1666. err = errnoErr(e1)
  1667. }
  1668. return
  1669. }
  1670. func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) {
  1671. r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
  1672. handle = Handle(r0)
  1673. if handle == InvalidHandle {
  1674. err = errnoErr(e1)
  1675. }
  1676. return
  1677. }
  1678. func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) {
  1679. r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0)
  1680. handle = Handle(r0)
  1681. if handle == InvalidHandle {
  1682. err = errnoErr(e1)
  1683. }
  1684. return
  1685. }
  1686. func FindNextChangeNotification(handle Handle) (err error) {
  1687. r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0)
  1688. if r1 == 0 {
  1689. err = errnoErr(e1)
  1690. }
  1691. return
  1692. }
  1693. func findNextFile1(handle Handle, data *win32finddata1) (err error) {
  1694. r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
  1695. if r1 == 0 {
  1696. err = errnoErr(e1)
  1697. }
  1698. return
  1699. }
  1700. func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) {
  1701. r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength))
  1702. if r1 == 0 {
  1703. err = errnoErr(e1)
  1704. }
  1705. return
  1706. }
  1707. func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) {
  1708. r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength))
  1709. if r1 == 0 {
  1710. err = errnoErr(e1)
  1711. }
  1712. return
  1713. }
  1714. func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) {
  1715. r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType))
  1716. resInfo = Handle(r0)
  1717. if resInfo == 0 {
  1718. err = errnoErr(e1)
  1719. }
  1720. return
  1721. }
  1722. func FindVolumeClose(findVolume Handle) (err error) {
  1723. r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0)
  1724. if r1 == 0 {
  1725. err = errnoErr(e1)
  1726. }
  1727. return
  1728. }
  1729. func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
  1730. r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0)
  1731. if r1 == 0 {
  1732. err = errnoErr(e1)
  1733. }
  1734. return
  1735. }
  1736. func FlushFileBuffers(handle Handle) (err error) {
  1737. r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0)
  1738. if r1 == 0 {
  1739. err = errnoErr(e1)
  1740. }
  1741. return
  1742. }
  1743. func FlushViewOfFile(addr uintptr, length uintptr) (err error) {
  1744. r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0)
  1745. if r1 == 0 {
  1746. err = errnoErr(e1)
  1747. }
  1748. return
  1749. }
  1750. func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) {
  1751. var _p0 *uint16
  1752. if len(buf) > 0 {
  1753. _p0 = &buf[0]
  1754. }
  1755. r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0)
  1756. n = uint32(r0)
  1757. if n == 0 {
  1758. err = errnoErr(e1)
  1759. }
  1760. return
  1761. }
  1762. func FreeEnvironmentStrings(envs *uint16) (err error) {
  1763. r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0)
  1764. if r1 == 0 {
  1765. err = errnoErr(e1)
  1766. }
  1767. return
  1768. }
  1769. func FreeLibrary(handle Handle) (err error) {
  1770. r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0)
  1771. if r1 == 0 {
  1772. err = errnoErr(e1)
  1773. }
  1774. return
  1775. }
  1776. func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) {
  1777. r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0)
  1778. if r1 == 0 {
  1779. err = errnoErr(e1)
  1780. }
  1781. return
  1782. }
  1783. func GetACP() (acp uint32) {
  1784. r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
  1785. acp = uint32(r0)
  1786. return
  1787. }
  1788. func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
  1789. r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
  1790. if r1 == 0 {
  1791. err = errnoErr(e1)
  1792. }
  1793. return
  1794. }
  1795. func GetCommandLine() (cmd *uint16) {
  1796. r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0)
  1797. cmd = (*uint16)(unsafe.Pointer(r0))
  1798. return
  1799. }
  1800. func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) {
  1801. r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
  1802. if r1 == 0 {
  1803. err = errnoErr(e1)
  1804. }
  1805. return
  1806. }
  1807. func GetComputerName(buf *uint16, n *uint32) (err error) {
  1808. r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0)
  1809. if r1 == 0 {
  1810. err = errnoErr(e1)
  1811. }
  1812. return
  1813. }
  1814. func GetConsoleMode(console Handle, mode *uint32) (err error) {
  1815. r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0)
  1816. if r1 == 0 {
  1817. err = errnoErr(e1)
  1818. }
  1819. return
  1820. }
  1821. func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) {
  1822. r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0)
  1823. if r1 == 0 {
  1824. err = errnoErr(e1)
  1825. }
  1826. return
  1827. }
  1828. func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) {
  1829. r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
  1830. n = uint32(r0)
  1831. if n == 0 {
  1832. err = errnoErr(e1)
  1833. }
  1834. return
  1835. }
  1836. func GetCurrentProcessId() (pid uint32) {
  1837. r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
  1838. pid = uint32(r0)
  1839. return
  1840. }
  1841. func GetCurrentThreadId() (id uint32) {
  1842. r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0)
  1843. id = uint32(r0)
  1844. return
  1845. }
  1846. func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
  1847. r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0)
  1848. if r1 == 0 {
  1849. err = errnoErr(e1)
  1850. }
  1851. return
  1852. }
  1853. func GetDriveType(rootPathName *uint16) (driveType uint32) {
  1854. r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
  1855. driveType = uint32(r0)
  1856. return
  1857. }
  1858. func GetEnvironmentStrings() (envs *uint16, err error) {
  1859. r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0)
  1860. envs = (*uint16)(unsafe.Pointer(r0))
  1861. if envs == nil {
  1862. err = errnoErr(e1)
  1863. }
  1864. return
  1865. }
  1866. func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) {
  1867. r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size))
  1868. n = uint32(r0)
  1869. if n == 0 {
  1870. err = errnoErr(e1)
  1871. }
  1872. return
  1873. }
  1874. func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) {
  1875. r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0)
  1876. if r1 == 0 {
  1877. err = errnoErr(e1)
  1878. }
  1879. return
  1880. }
  1881. func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) {
  1882. r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info)))
  1883. if r1 == 0 {
  1884. err = errnoErr(e1)
  1885. }
  1886. return
  1887. }
  1888. func GetFileAttributes(name *uint16) (attrs uint32, err error) {
  1889. r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
  1890. attrs = uint32(r0)
  1891. if attrs == INVALID_FILE_ATTRIBUTES {
  1892. err = errnoErr(e1)
  1893. }
  1894. return
  1895. }
  1896. func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) {
  1897. r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
  1898. if r1 == 0 {
  1899. err = errnoErr(e1)
  1900. }
  1901. return
  1902. }
  1903. func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) {
  1904. r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0)
  1905. if r1 == 0 {
  1906. err = errnoErr(e1)
  1907. }
  1908. return
  1909. }
  1910. func GetFileType(filehandle Handle) (n uint32, err error) {
  1911. r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0)
  1912. n = uint32(r0)
  1913. if n == 0 {
  1914. err = errnoErr(e1)
  1915. }
  1916. return
  1917. }
  1918. func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
  1919. r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0)
  1920. n = uint32(r0)
  1921. if n == 0 {
  1922. err = errnoErr(e1)
  1923. }
  1924. return
  1925. }
  1926. func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) {
  1927. r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0)
  1928. n = uint32(r0)
  1929. if n == 0 {
  1930. err = errnoErr(e1)
  1931. }
  1932. return
  1933. }
  1934. func GetLastError() (lasterr error) {
  1935. r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0)
  1936. if r0 != 0 {
  1937. lasterr = syscall.Errno(r0)
  1938. }
  1939. return
  1940. }
  1941. func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) {
  1942. r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0)
  1943. n = uint32(r0)
  1944. if n == 0 {
  1945. err = errnoErr(e1)
  1946. }
  1947. return
  1948. }
  1949. func GetLogicalDrives() (drivesBitMask uint32, err error) {
  1950. r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0)
  1951. drivesBitMask = uint32(r0)
  1952. if drivesBitMask == 0 {
  1953. err = errnoErr(e1)
  1954. }
  1955. return
  1956. }
  1957. func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) {
  1958. r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen))
  1959. n = uint32(r0)
  1960. if n == 0 {
  1961. err = errnoErr(e1)
  1962. }
  1963. return
  1964. }
  1965. func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) {
  1966. r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size))
  1967. n = uint32(r0)
  1968. if n == 0 {
  1969. err = errnoErr(e1)
  1970. }
  1971. return
  1972. }
  1973. func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) {
  1974. r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module)))
  1975. if r1 == 0 {
  1976. err = errnoErr(e1)
  1977. }
  1978. return
  1979. }
  1980. func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) {
  1981. r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0)
  1982. if r1 == 0 {
  1983. err = errnoErr(e1)
  1984. }
  1985. return
  1986. }
  1987. func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) {
  1988. r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0)
  1989. if r1 == 0 {
  1990. err = errnoErr(e1)
  1991. }
  1992. return
  1993. }
  1994. func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) {
  1995. var _p0 uint32
  1996. if wait {
  1997. _p0 = 1
  1998. }
  1999. r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
  2000. if r1 == 0 {
  2001. err = errnoErr(e1)
  2002. }
  2003. return
  2004. }
  2005. func GetPriorityClass(process Handle) (ret uint32, err error) {
  2006. r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0)
  2007. ret = uint32(r0)
  2008. if ret == 0 {
  2009. err = errnoErr(e1)
  2010. }
  2011. return
  2012. }
  2013. func GetProcAddress(module Handle, procname string) (proc uintptr, err error) {
  2014. var _p0 *byte
  2015. _p0, err = syscall.BytePtrFromString(procname)
  2016. if err != nil {
  2017. return
  2018. }
  2019. return _GetProcAddress(module, _p0)
  2020. }
  2021. func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) {
  2022. r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0)
  2023. proc = uintptr(r0)
  2024. if proc == 0 {
  2025. err = errnoErr(e1)
  2026. }
  2027. return
  2028. }
  2029. func GetProcessId(process Handle) (id uint32, err error) {
  2030. r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0)
  2031. id = uint32(r0)
  2032. if id == 0 {
  2033. err = errnoErr(e1)
  2034. }
  2035. return
  2036. }
  2037. func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
  2038. r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
  2039. if r1 == 0 {
  2040. err = errnoErr(e1)
  2041. }
  2042. return
  2043. }
  2044. func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) {
  2045. r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0)
  2046. if r1 == 0 {
  2047. err = errnoErr(e1)
  2048. }
  2049. return
  2050. }
  2051. func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) {
  2052. r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0)
  2053. if r1 == 0 {
  2054. err = errnoErr(e1)
  2055. }
  2056. return
  2057. }
  2058. func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) {
  2059. syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0)
  2060. return
  2061. }
  2062. func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) {
  2063. r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
  2064. if r1 == 0 {
  2065. err = errnoErr(e1)
  2066. }
  2067. return
  2068. }
  2069. func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) {
  2070. r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen))
  2071. n = uint32(r0)
  2072. if n == 0 {
  2073. err = errnoErr(e1)
  2074. }
  2075. return
  2076. }
  2077. func GetStartupInfo(startupInfo *StartupInfo) (err error) {
  2078. r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0)
  2079. if r1 == 0 {
  2080. err = errnoErr(e1)
  2081. }
  2082. return
  2083. }
  2084. func GetStdHandle(stdhandle uint32) (handle Handle, err error) {
  2085. r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0)
  2086. handle = Handle(r0)
  2087. if handle == InvalidHandle {
  2088. err = errnoErr(e1)
  2089. }
  2090. return
  2091. }
  2092. func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
  2093. r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
  2094. len = uint32(r0)
  2095. if len == 0 {
  2096. err = errnoErr(e1)
  2097. }
  2098. return
  2099. }
  2100. func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
  2101. r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
  2102. if r1 == 0 {
  2103. err = errnoErr(e1)
  2104. }
  2105. return
  2106. }
  2107. func GetSystemTimeAsFileTime(time *Filetime) {
  2108. syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
  2109. return
  2110. }
  2111. func GetSystemTimePreciseAsFileTime(time *Filetime) {
  2112. syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0)
  2113. return
  2114. }
  2115. func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
  2116. r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
  2117. len = uint32(r0)
  2118. if len == 0 {
  2119. err = errnoErr(e1)
  2120. }
  2121. return
  2122. }
  2123. func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) {
  2124. r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
  2125. n = uint32(r0)
  2126. if n == 0 {
  2127. err = errnoErr(e1)
  2128. }
  2129. return
  2130. }
  2131. func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
  2132. r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
  2133. if r1 == 0 {
  2134. err = errnoErr(e1)
  2135. }
  2136. return
  2137. }
  2138. func getTickCount64() (ms uint64) {
  2139. r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0)
  2140. ms = uint64(r0)
  2141. return
  2142. }
  2143. func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) {
  2144. r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0)
  2145. rc = uint32(r0)
  2146. if rc == 0xffffffff {
  2147. err = errnoErr(e1)
  2148. }
  2149. return
  2150. }
  2151. func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) {
  2152. r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0)
  2153. if r1 == 0 {
  2154. err = errnoErr(e1)
  2155. }
  2156. return
  2157. }
  2158. func GetVersion() (ver uint32, err error) {
  2159. r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0)
  2160. ver = uint32(r0)
  2161. if ver == 0 {
  2162. err = errnoErr(e1)
  2163. }
  2164. return
  2165. }
  2166. func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
  2167. r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
  2168. if r1 == 0 {
  2169. err = errnoErr(e1)
  2170. }
  2171. return
  2172. }
  2173. func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
  2174. r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
  2175. if r1 == 0 {
  2176. err = errnoErr(e1)
  2177. }
  2178. return
  2179. }
  2180. func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
  2181. r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
  2182. if r1 == 0 {
  2183. err = errnoErr(e1)
  2184. }
  2185. return
  2186. }
  2187. func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) {
  2188. r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength))
  2189. if r1 == 0 {
  2190. err = errnoErr(e1)
  2191. }
  2192. return
  2193. }
  2194. func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) {
  2195. r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0)
  2196. if r1 == 0 {
  2197. err = errnoErr(e1)
  2198. }
  2199. return
  2200. }
  2201. func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) {
  2202. r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0)
  2203. len = uint32(r0)
  2204. if len == 0 {
  2205. err = errnoErr(e1)
  2206. }
  2207. return
  2208. }
  2209. func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) {
  2210. r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0)
  2211. if r1 == 0 {
  2212. err = errnoErr(e1)
  2213. }
  2214. return
  2215. }
  2216. func IsWow64Process(handle Handle, isWow64 *bool) (err error) {
  2217. var _p0 uint32
  2218. if *isWow64 {
  2219. _p0 = 1
  2220. }
  2221. r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0)
  2222. *isWow64 = _p0 != 0
  2223. if r1 == 0 {
  2224. err = errnoErr(e1)
  2225. }
  2226. return
  2227. }
  2228. func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) {
  2229. err = procIsWow64Process2.Find()
  2230. if err != nil {
  2231. return
  2232. }
  2233. r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine)))
  2234. if r1 == 0 {
  2235. err = errnoErr(e1)
  2236. }
  2237. return
  2238. }
  2239. func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) {
  2240. var _p0 *uint16
  2241. _p0, err = syscall.UTF16PtrFromString(libname)
  2242. if err != nil {
  2243. return
  2244. }
  2245. return _LoadLibraryEx(_p0, zero, flags)
  2246. }
  2247. func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) {
  2248. r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags))
  2249. handle = Handle(r0)
  2250. if handle == 0 {
  2251. err = errnoErr(e1)
  2252. }
  2253. return
  2254. }
  2255. func LoadLibrary(libname string) (handle Handle, err error) {
  2256. var _p0 *uint16
  2257. _p0, err = syscall.UTF16PtrFromString(libname)
  2258. if err != nil {
  2259. return
  2260. }
  2261. return _LoadLibrary(_p0)
  2262. }
  2263. func _LoadLibrary(libname *uint16) (handle Handle, err error) {
  2264. r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0)
  2265. handle = Handle(r0)
  2266. if handle == 0 {
  2267. err = errnoErr(e1)
  2268. }
  2269. return
  2270. }
  2271. func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) {
  2272. r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0)
  2273. resData = Handle(r0)
  2274. if resData == 0 {
  2275. err = errnoErr(e1)
  2276. }
  2277. return
  2278. }
  2279. func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) {
  2280. r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0)
  2281. ptr = uintptr(r0)
  2282. if ptr == 0 {
  2283. err = errnoErr(e1)
  2284. }
  2285. return
  2286. }
  2287. func LocalFree(hmem Handle) (handle Handle, err error) {
  2288. r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0)
  2289. handle = Handle(r0)
  2290. if handle != 0 {
  2291. err = errnoErr(e1)
  2292. }
  2293. return
  2294. }
  2295. func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
  2296. r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
  2297. if r1 == 0 {
  2298. err = errnoErr(e1)
  2299. }
  2300. return
  2301. }
  2302. func LockResource(resData Handle) (addr uintptr, err error) {
  2303. r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0)
  2304. addr = uintptr(r0)
  2305. if addr == 0 {
  2306. err = errnoErr(e1)
  2307. }
  2308. return
  2309. }
  2310. func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) {
  2311. r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0)
  2312. addr = uintptr(r0)
  2313. if addr == 0 {
  2314. err = errnoErr(e1)
  2315. }
  2316. return
  2317. }
  2318. func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) {
  2319. r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
  2320. if r1 == 0 {
  2321. err = errnoErr(e1)
  2322. }
  2323. return
  2324. }
  2325. func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) {
  2326. r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
  2327. if r1 == 0 {
  2328. err = errnoErr(e1)
  2329. }
  2330. return
  2331. }
  2332. func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
  2333. r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
  2334. if r1 == 0 {
  2335. err = errnoErr(e1)
  2336. }
  2337. return
  2338. }
  2339. func MoveFile(from *uint16, to *uint16) (err error) {
  2340. r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0)
  2341. if r1 == 0 {
  2342. err = errnoErr(e1)
  2343. }
  2344. return
  2345. }
  2346. func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
  2347. r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
  2348. nwrite = int32(r0)
  2349. if nwrite == 0 {
  2350. err = errnoErr(e1)
  2351. }
  2352. return
  2353. }
  2354. func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
  2355. var _p0 uint32
  2356. if inheritHandle {
  2357. _p0 = 1
  2358. }
  2359. r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
  2360. handle = Handle(r0)
  2361. if handle == 0 {
  2362. err = errnoErr(e1)
  2363. }
  2364. return
  2365. }
  2366. func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) {
  2367. var _p0 uint32
  2368. if inheritHandle {
  2369. _p0 = 1
  2370. }
  2371. r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name)))
  2372. handle = Handle(r0)
  2373. if handle == 0 {
  2374. err = errnoErr(e1)
  2375. }
  2376. return
  2377. }
  2378. func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) {
  2379. var _p0 uint32
  2380. if inheritHandle {
  2381. _p0 = 1
  2382. }
  2383. r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId))
  2384. handle = Handle(r0)
  2385. if handle == 0 {
  2386. err = errnoErr(e1)
  2387. }
  2388. return
  2389. }
  2390. func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) {
  2391. var _p0 uint32
  2392. if inheritHandle {
  2393. _p0 = 1
  2394. }
  2395. r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId))
  2396. handle = Handle(r0)
  2397. if handle == 0 {
  2398. err = errnoErr(e1)
  2399. }
  2400. return
  2401. }
  2402. func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) {
  2403. r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
  2404. if r1 == 0 {
  2405. err = errnoErr(e1)
  2406. }
  2407. return
  2408. }
  2409. func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) {
  2410. r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
  2411. if r1 == 0 {
  2412. err = errnoErr(e1)
  2413. }
  2414. return
  2415. }
  2416. func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) {
  2417. r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0)
  2418. if r1 == 0 {
  2419. err = errnoErr(e1)
  2420. }
  2421. return
  2422. }
  2423. func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) {
  2424. r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0)
  2425. if r1 == 0 {
  2426. err = errnoErr(e1)
  2427. }
  2428. return
  2429. }
  2430. func PulseEvent(event Handle) (err error) {
  2431. r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0)
  2432. if r1 == 0 {
  2433. err = errnoErr(e1)
  2434. }
  2435. return
  2436. }
  2437. func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) {
  2438. r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max))
  2439. n = uint32(r0)
  2440. if n == 0 {
  2441. err = errnoErr(e1)
  2442. }
  2443. return
  2444. }
  2445. func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) {
  2446. r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0)
  2447. if r1 == 0 {
  2448. err = errnoErr(e1)
  2449. }
  2450. return
  2451. }
  2452. func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) {
  2453. r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0)
  2454. if r1 == 0 {
  2455. err = errnoErr(e1)
  2456. }
  2457. return
  2458. }
  2459. func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) {
  2460. r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0)
  2461. if r1 == 0 {
  2462. err = errnoErr(e1)
  2463. }
  2464. return
  2465. }
  2466. func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
  2467. var _p0 uint32
  2468. if watchSubTree {
  2469. _p0 = 1
  2470. }
  2471. r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0)
  2472. if r1 == 0 {
  2473. err = errnoErr(e1)
  2474. }
  2475. return
  2476. }
  2477. func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
  2478. var _p0 *byte
  2479. if len(buf) > 0 {
  2480. _p0 = &buf[0]
  2481. }
  2482. r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
  2483. if r1 == 0 {
  2484. err = errnoErr(e1)
  2485. }
  2486. return
  2487. }
  2488. func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) {
  2489. r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0)
  2490. if r1 == 0 {
  2491. err = errnoErr(e1)
  2492. }
  2493. return
  2494. }
  2495. func ReleaseMutex(mutex Handle) (err error) {
  2496. r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0)
  2497. if r1 == 0 {
  2498. err = errnoErr(e1)
  2499. }
  2500. return
  2501. }
  2502. func RemoveDirectory(path *uint16) (err error) {
  2503. r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
  2504. if r1 == 0 {
  2505. err = errnoErr(e1)
  2506. }
  2507. return
  2508. }
  2509. func ResetEvent(event Handle) (err error) {
  2510. r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0)
  2511. if r1 == 0 {
  2512. err = errnoErr(e1)
  2513. }
  2514. return
  2515. }
  2516. func ResumeThread(thread Handle) (ret uint32, err error) {
  2517. r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0)
  2518. ret = uint32(r0)
  2519. if ret == 0xffffffff {
  2520. err = errnoErr(e1)
  2521. }
  2522. return
  2523. }
  2524. func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) {
  2525. r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0)
  2526. if r1 == 0 {
  2527. err = errnoErr(e1)
  2528. }
  2529. return
  2530. }
  2531. func setConsoleCursorPosition(console Handle, position uint32) (err error) {
  2532. r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0)
  2533. if r1 == 0 {
  2534. err = errnoErr(e1)
  2535. }
  2536. return
  2537. }
  2538. func SetConsoleMode(console Handle, mode uint32) (err error) {
  2539. r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0)
  2540. if r1 == 0 {
  2541. err = errnoErr(e1)
  2542. }
  2543. return
  2544. }
  2545. func SetCurrentDirectory(path *uint16) (err error) {
  2546. r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
  2547. if r1 == 0 {
  2548. err = errnoErr(e1)
  2549. }
  2550. return
  2551. }
  2552. func SetDefaultDllDirectories(directoryFlags uint32) (err error) {
  2553. r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0)
  2554. if r1 == 0 {
  2555. err = errnoErr(e1)
  2556. }
  2557. return
  2558. }
  2559. func SetDllDirectory(path string) (err error) {
  2560. var _p0 *uint16
  2561. _p0, err = syscall.UTF16PtrFromString(path)
  2562. if err != nil {
  2563. return
  2564. }
  2565. return _SetDllDirectory(_p0)
  2566. }
  2567. func _SetDllDirectory(path *uint16) (err error) {
  2568. r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
  2569. if r1 == 0 {
  2570. err = errnoErr(e1)
  2571. }
  2572. return
  2573. }
  2574. func SetEndOfFile(handle Handle) (err error) {
  2575. r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0)
  2576. if r1 == 0 {
  2577. err = errnoErr(e1)
  2578. }
  2579. return
  2580. }
  2581. func SetEnvironmentVariable(name *uint16, value *uint16) (err error) {
  2582. r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0)
  2583. if r1 == 0 {
  2584. err = errnoErr(e1)
  2585. }
  2586. return
  2587. }
  2588. func SetErrorMode(mode uint32) (ret uint32) {
  2589. r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0)
  2590. ret = uint32(r0)
  2591. return
  2592. }
  2593. func SetEvent(event Handle) (err error) {
  2594. r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0)
  2595. if r1 == 0 {
  2596. err = errnoErr(e1)
  2597. }
  2598. return
  2599. }
  2600. func SetFileAttributes(name *uint16, attrs uint32) (err error) {
  2601. r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0)
  2602. if r1 == 0 {
  2603. err = errnoErr(e1)
  2604. }
  2605. return
  2606. }
  2607. func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) {
  2608. r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0)
  2609. if r1 == 0 {
  2610. err = errnoErr(e1)
  2611. }
  2612. return
  2613. }
  2614. func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) {
  2615. r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0)
  2616. if r1 == 0 {
  2617. err = errnoErr(e1)
  2618. }
  2619. return
  2620. }
  2621. func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) {
  2622. r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0)
  2623. newlowoffset = uint32(r0)
  2624. if newlowoffset == 0xffffffff {
  2625. err = errnoErr(e1)
  2626. }
  2627. return
  2628. }
  2629. func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) {
  2630. r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0)
  2631. if r1 == 0 {
  2632. err = errnoErr(e1)
  2633. }
  2634. return
  2635. }
  2636. func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) {
  2637. r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags))
  2638. if r1 == 0 {
  2639. err = errnoErr(e1)
  2640. }
  2641. return
  2642. }
  2643. func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
  2644. r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
  2645. ret = int(r0)
  2646. if ret == 0 {
  2647. err = errnoErr(e1)
  2648. }
  2649. return
  2650. }
  2651. func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) {
  2652. r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0)
  2653. if r1 == 0 {
  2654. err = errnoErr(e1)
  2655. }
  2656. return
  2657. }
  2658. func SetPriorityClass(process Handle, priorityClass uint32) (err error) {
  2659. r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0)
  2660. if r1 == 0 {
  2661. err = errnoErr(e1)
  2662. }
  2663. return
  2664. }
  2665. func SetProcessPriorityBoost(process Handle, disable bool) (err error) {
  2666. var _p0 uint32
  2667. if disable {
  2668. _p0 = 1
  2669. }
  2670. r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0)
  2671. if r1 == 0 {
  2672. err = errnoErr(e1)
  2673. }
  2674. return
  2675. }
  2676. func SetProcessShutdownParameters(level uint32, flags uint32) (err error) {
  2677. r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0)
  2678. if r1 == 0 {
  2679. err = errnoErr(e1)
  2680. }
  2681. return
  2682. }
  2683. func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) {
  2684. r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0)
  2685. if r1 == 0 {
  2686. err = errnoErr(e1)
  2687. }
  2688. return
  2689. }
  2690. func SetStdHandle(stdhandle uint32, handle Handle) (err error) {
  2691. r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0)
  2692. if r1 == 0 {
  2693. err = errnoErr(e1)
  2694. }
  2695. return
  2696. }
  2697. func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) {
  2698. r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0)
  2699. if r1 == 0 {
  2700. err = errnoErr(e1)
  2701. }
  2702. return
  2703. }
  2704. func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) {
  2705. r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0)
  2706. if r1 == 0 {
  2707. err = errnoErr(e1)
  2708. }
  2709. return
  2710. }
  2711. func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) {
  2712. r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0)
  2713. size = uint32(r0)
  2714. if size == 0 {
  2715. err = errnoErr(e1)
  2716. }
  2717. return
  2718. }
  2719. func SleepEx(milliseconds uint32, alertable bool) (ret uint32) {
  2720. var _p0 uint32
  2721. if alertable {
  2722. _p0 = 1
  2723. }
  2724. r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0)
  2725. ret = uint32(r0)
  2726. return
  2727. }
  2728. func TerminateJobObject(job Handle, exitCode uint32) (err error) {
  2729. r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0)
  2730. if r1 == 0 {
  2731. err = errnoErr(e1)
  2732. }
  2733. return
  2734. }
  2735. func TerminateProcess(handle Handle, exitcode uint32) (err error) {
  2736. r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0)
  2737. if r1 == 0 {
  2738. err = errnoErr(e1)
  2739. }
  2740. return
  2741. }
  2742. func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
  2743. r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
  2744. if r1 == 0 {
  2745. err = errnoErr(e1)
  2746. }
  2747. return
  2748. }
  2749. func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) {
  2750. r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0)
  2751. if r1 == 0 {
  2752. err = errnoErr(e1)
  2753. }
  2754. return
  2755. }
  2756. func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) {
  2757. r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
  2758. if r1 == 0 {
  2759. err = errnoErr(e1)
  2760. }
  2761. return
  2762. }
  2763. func UnmapViewOfFile(addr uintptr) (err error) {
  2764. r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0)
  2765. if r1 == 0 {
  2766. err = errnoErr(e1)
  2767. }
  2768. return
  2769. }
  2770. func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) {
  2771. r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0)
  2772. if r1 == 0 {
  2773. err = errnoErr(e1)
  2774. }
  2775. return
  2776. }
  2777. func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) {
  2778. r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0)
  2779. value = uintptr(r0)
  2780. if value == 0 {
  2781. err = errnoErr(e1)
  2782. }
  2783. return
  2784. }
  2785. func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) {
  2786. r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype))
  2787. if r1 == 0 {
  2788. err = errnoErr(e1)
  2789. }
  2790. return
  2791. }
  2792. func VirtualLock(addr uintptr, length uintptr) (err error) {
  2793. r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
  2794. if r1 == 0 {
  2795. err = errnoErr(e1)
  2796. }
  2797. return
  2798. }
  2799. func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) {
  2800. r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0)
  2801. if r1 == 0 {
  2802. err = errnoErr(e1)
  2803. }
  2804. return
  2805. }
  2806. func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) {
  2807. r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0)
  2808. if r1 == 0 {
  2809. err = errnoErr(e1)
  2810. }
  2811. return
  2812. }
  2813. func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
  2814. r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length))
  2815. if r1 == 0 {
  2816. err = errnoErr(e1)
  2817. }
  2818. return
  2819. }
  2820. func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
  2821. r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0)
  2822. if r1 == 0 {
  2823. err = errnoErr(e1)
  2824. }
  2825. return
  2826. }
  2827. func VirtualUnlock(addr uintptr, length uintptr) (err error) {
  2828. r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
  2829. if r1 == 0 {
  2830. err = errnoErr(e1)
  2831. }
  2832. return
  2833. }
  2834. func WTSGetActiveConsoleSessionId() (sessionID uint32) {
  2835. r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0)
  2836. sessionID = uint32(r0)
  2837. return
  2838. }
  2839. func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
  2840. var _p0 uint32
  2841. if waitAll {
  2842. _p0 = 1
  2843. }
  2844. r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0)
  2845. event = uint32(r0)
  2846. if event == 0xffffffff {
  2847. err = errnoErr(e1)
  2848. }
  2849. return
  2850. }
  2851. func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) {
  2852. r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0)
  2853. event = uint32(r0)
  2854. if event == 0xffffffff {
  2855. err = errnoErr(e1)
  2856. }
  2857. return
  2858. }
  2859. func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) {
  2860. r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0)
  2861. if r1 == 0 {
  2862. err = errnoErr(e1)
  2863. }
  2864. return
  2865. }
  2866. func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) {
  2867. var _p0 *byte
  2868. if len(buf) > 0 {
  2869. _p0 = &buf[0]
  2870. }
  2871. r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0)
  2872. if r1 == 0 {
  2873. err = errnoErr(e1)
  2874. }
  2875. return
  2876. }
  2877. func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) {
  2878. r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0)
  2879. if r1 == 0 {
  2880. err = errnoErr(e1)
  2881. }
  2882. return
  2883. }
  2884. func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
  2885. r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0)
  2886. if r1 == 0 {
  2887. err = errnoErr(e1)
  2888. }
  2889. return
  2890. }
  2891. func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) {
  2892. syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0)
  2893. return
  2894. }
  2895. func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) {
  2896. r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0)
  2897. if r1 == 0 {
  2898. err = errnoErr(e1)
  2899. }
  2900. return
  2901. }
  2902. func NetApiBufferFree(buf *byte) (neterr error) {
  2903. r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0)
  2904. if r0 != 0 {
  2905. neterr = syscall.Errno(r0)
  2906. }
  2907. return
  2908. }
  2909. func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) {
  2910. r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType)))
  2911. if r0 != 0 {
  2912. neterr = syscall.Errno(r0)
  2913. }
  2914. return
  2915. }
  2916. func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) {
  2917. r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0)
  2918. if r0 != 0 {
  2919. neterr = syscall.Errno(r0)
  2920. }
  2921. return
  2922. }
  2923. func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) {
  2924. r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0)
  2925. if r0 != 0 {
  2926. ntstatus = NTStatus(r0)
  2927. }
  2928. return
  2929. }
  2930. func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) {
  2931. r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0)
  2932. if r0 != 0 {
  2933. ntstatus = NTStatus(r0)
  2934. }
  2935. return
  2936. }
  2937. func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) {
  2938. r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0)
  2939. if r0 != 0 {
  2940. ntstatus = NTStatus(r0)
  2941. }
  2942. return
  2943. }
  2944. func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) {
  2945. r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0)
  2946. if r0 != 0 {
  2947. ntstatus = NTStatus(r0)
  2948. }
  2949. return
  2950. }
  2951. func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) {
  2952. r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0)
  2953. if r0 != 0 {
  2954. ntstatus = NTStatus(r0)
  2955. }
  2956. return
  2957. }
  2958. func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) {
  2959. r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0)
  2960. if r0 != 0 {
  2961. ntstatus = NTStatus(r0)
  2962. }
  2963. return
  2964. }
  2965. func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) {
  2966. r0, _, _ := syscall.Syscall(procNtSetSystemInformation.Addr(), 3, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen))
  2967. if r0 != 0 {
  2968. ntstatus = NTStatus(r0)
  2969. }
  2970. return
  2971. }
  2972. func RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) {
  2973. r0, _, _ := syscall.Syscall(procRtlAddFunctionTable.Addr(), 3, uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress))
  2974. ret = r0 != 0
  2975. return
  2976. }
  2977. func RtlDefaultNpAcl(acl **ACL) (ntstatus error) {
  2978. r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0)
  2979. if r0 != 0 {
  2980. ntstatus = NTStatus(r0)
  2981. }
  2982. return
  2983. }
  2984. func RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) {
  2985. r0, _, _ := syscall.Syscall(procRtlDeleteFunctionTable.Addr(), 1, uintptr(unsafe.Pointer(functionTable)), 0, 0)
  2986. ret = r0 != 0
  2987. return
  2988. }
  2989. func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) {
  2990. r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0)
  2991. if r0 != 0 {
  2992. ntstatus = NTStatus(r0)
  2993. }
  2994. return
  2995. }
  2996. func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) {
  2997. r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0)
  2998. if r0 != 0 {
  2999. ntstatus = NTStatus(r0)
  3000. }
  3001. return
  3002. }
  3003. func RtlGetCurrentPeb() (peb *PEB) {
  3004. r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0)
  3005. peb = (*PEB)(unsafe.Pointer(r0))
  3006. return
  3007. }
  3008. func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) {
  3009. syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber)))
  3010. return
  3011. }
  3012. func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) {
  3013. r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0)
  3014. if r0 != 0 {
  3015. ntstatus = NTStatus(r0)
  3016. }
  3017. return
  3018. }
  3019. func RtlInitString(destinationString *NTString, sourceString *byte) {
  3020. syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0)
  3021. return
  3022. }
  3023. func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) {
  3024. syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0)
  3025. return
  3026. }
  3027. func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) {
  3028. r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0)
  3029. ret = syscall.Errno(r0)
  3030. return
  3031. }
  3032. func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) {
  3033. r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0)
  3034. if r0 != 0 {
  3035. ret = syscall.Errno(r0)
  3036. }
  3037. return
  3038. }
  3039. func coCreateGuid(pguid *GUID) (ret error) {
  3040. r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0)
  3041. if r0 != 0 {
  3042. ret = syscall.Errno(r0)
  3043. }
  3044. return
  3045. }
  3046. func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) {
  3047. r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0)
  3048. if r0 != 0 {
  3049. ret = syscall.Errno(r0)
  3050. }
  3051. return
  3052. }
  3053. func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) {
  3054. r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0)
  3055. if r0 != 0 {
  3056. ret = syscall.Errno(r0)
  3057. }
  3058. return
  3059. }
  3060. func CoTaskMemFree(address unsafe.Pointer) {
  3061. syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0)
  3062. return
  3063. }
  3064. func CoUninitialize() {
  3065. syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0)
  3066. return
  3067. }
  3068. func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) {
  3069. r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax))
  3070. chars = int32(r0)
  3071. return
  3072. }
  3073. func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) {
  3074. r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0)
  3075. if r1 == 0 {
  3076. err = errnoErr(e1)
  3077. }
  3078. return
  3079. }
  3080. func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) {
  3081. r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0)
  3082. if r1 == 0 {
  3083. err = errnoErr(e1)
  3084. }
  3085. return
  3086. }
  3087. func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) {
  3088. var _p0 *uint32
  3089. if len(processIds) > 0 {
  3090. _p0 = &processIds[0]
  3091. }
  3092. r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned)))
  3093. if r1 == 0 {
  3094. err = errnoErr(e1)
  3095. }
  3096. return
  3097. }
  3098. func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) {
  3099. r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0)
  3100. if r1 == 0 {
  3101. err = errnoErr(e1)
  3102. }
  3103. return
  3104. }
  3105. func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) {
  3106. r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0)
  3107. if r1 == 0 {
  3108. err = errnoErr(e1)
  3109. }
  3110. return
  3111. }
  3112. func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) {
  3113. r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0)
  3114. if r1 == 0 {
  3115. err = errnoErr(e1)
  3116. }
  3117. return
  3118. }
  3119. func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) {
  3120. ret = procSubscribeServiceChangeNotifications.Find()
  3121. if ret != nil {
  3122. return
  3123. }
  3124. r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0)
  3125. if r0 != 0 {
  3126. ret = syscall.Errno(r0)
  3127. }
  3128. return
  3129. }
  3130. func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) {
  3131. err = procUnsubscribeServiceChangeNotifications.Find()
  3132. if err != nil {
  3133. return
  3134. }
  3135. syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0)
  3136. return
  3137. }
  3138. func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) {
  3139. r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize)))
  3140. if r1&0xff == 0 {
  3141. err = errnoErr(e1)
  3142. }
  3143. return
  3144. }
  3145. func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) {
  3146. r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0)
  3147. if r1&0xff == 0 {
  3148. err = errnoErr(e1)
  3149. }
  3150. return
  3151. }
  3152. func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) {
  3153. r1, _, e1 := syscall.Syscall(procSetupDiBuildDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType))
  3154. if r1 == 0 {
  3155. err = errnoErr(e1)
  3156. }
  3157. return
  3158. }
  3159. func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) {
  3160. r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)))
  3161. if r1 == 0 {
  3162. err = errnoErr(e1)
  3163. }
  3164. return
  3165. }
  3166. func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) {
  3167. r1, _, e1 := syscall.Syscall(procSetupDiCancelDriverInfoSearch.Addr(), 1, uintptr(deviceInfoSet), 0, 0)
  3168. if r1 == 0 {
  3169. err = errnoErr(e1)
  3170. }
  3171. return
  3172. }
  3173. func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) {
  3174. r1, _, e1 := syscall.Syscall6(procSetupDiClassGuidsFromNameExW.Addr(), 6, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved))
  3175. if r1 == 0 {
  3176. err = errnoErr(e1)
  3177. }
  3178. return
  3179. }
  3180. func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) {
  3181. r1, _, e1 := syscall.Syscall6(procSetupDiClassNameFromGuidExW.Addr(), 6, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved))
  3182. if r1 == 0 {
  3183. err = errnoErr(e1)
  3184. }
  3185. return
  3186. }
  3187. func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) {
  3188. r0, _, e1 := syscall.Syscall6(procSetupDiCreateDeviceInfoListExW.Addr(), 4, uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0)
  3189. handle = DevInfo(r0)
  3190. if handle == DevInfo(InvalidHandle) {
  3191. err = errnoErr(e1)
  3192. }
  3193. return
  3194. }
  3195. func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) {
  3196. r1, _, e1 := syscall.Syscall9(procSetupDiCreateDeviceInfoW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData)), 0, 0)
  3197. if r1 == 0 {
  3198. err = errnoErr(e1)
  3199. }
  3200. return
  3201. }
  3202. func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) {
  3203. r1, _, e1 := syscall.Syscall(procSetupDiDestroyDeviceInfoList.Addr(), 1, uintptr(deviceInfoSet), 0, 0)
  3204. if r1 == 0 {
  3205. err = errnoErr(e1)
  3206. }
  3207. return
  3208. }
  3209. func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) {
  3210. r1, _, e1 := syscall.Syscall(procSetupDiDestroyDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType))
  3211. if r1 == 0 {
  3212. err = errnoErr(e1)
  3213. }
  3214. return
  3215. }
  3216. func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) {
  3217. r1, _, e1 := syscall.Syscall(procSetupDiEnumDeviceInfo.Addr(), 3, uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData)))
  3218. if r1 == 0 {
  3219. err = errnoErr(e1)
  3220. }
  3221. return
  3222. }
  3223. func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) {
  3224. r1, _, e1 := syscall.Syscall6(procSetupDiEnumDriverInfoW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData)), 0)
  3225. if r1 == 0 {
  3226. err = errnoErr(e1)
  3227. }
  3228. return
  3229. }
  3230. func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) {
  3231. r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0)
  3232. handle = DevInfo(r0)
  3233. if handle == DevInfo(InvalidHandle) {
  3234. err = errnoErr(e1)
  3235. }
  3236. return
  3237. }
  3238. func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) {
  3239. r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0)
  3240. if r1 == 0 {
  3241. err = errnoErr(e1)
  3242. }
  3243. return
  3244. }
  3245. func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) {
  3246. r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData)), 0)
  3247. if r1 == 0 {
  3248. err = errnoErr(e1)
  3249. }
  3250. return
  3251. }
  3252. func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) {
  3253. r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams)))
  3254. if r1 == 0 {
  3255. err = errnoErr(e1)
  3256. }
  3257. return
  3258. }
  3259. func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) {
  3260. r1, _, e1 := syscall.Syscall6(procSetupDiGetDeviceInstanceIdW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize)), 0)
  3261. if r1 == 0 {
  3262. err = errnoErr(e1)
  3263. }
  3264. return
  3265. }
  3266. func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) {
  3267. r1, _, e1 := syscall.Syscall9(procSetupDiGetDevicePropertyW.Addr(), 8, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags), 0)
  3268. if r1 == 0 {
  3269. err = errnoErr(e1)
  3270. }
  3271. return
  3272. }
  3273. func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) {
  3274. r1, _, e1 := syscall.Syscall9(procSetupDiGetDeviceRegistryPropertyW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), 0, 0)
  3275. if r1 == 0 {
  3276. err = errnoErr(e1)
  3277. }
  3278. return
  3279. }
  3280. func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) {
  3281. r1, _, e1 := syscall.Syscall6(procSetupDiGetDriverInfoDetailW.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize)))
  3282. if r1 == 0 {
  3283. err = errnoErr(e1)
  3284. }
  3285. return
  3286. }
  3287. func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) {
  3288. r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0)
  3289. if r1 == 0 {
  3290. err = errnoErr(e1)
  3291. }
  3292. return
  3293. }
  3294. func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) {
  3295. r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)))
  3296. if r1 == 0 {
  3297. err = errnoErr(e1)
  3298. }
  3299. return
  3300. }
  3301. func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) {
  3302. r0, _, e1 := syscall.Syscall6(procSetupDiOpenDevRegKey.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired))
  3303. key = Handle(r0)
  3304. if key == InvalidHandle {
  3305. err = errnoErr(e1)
  3306. }
  3307. return
  3308. }
  3309. func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) {
  3310. r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0)
  3311. if r1 == 0 {
  3312. err = errnoErr(e1)
  3313. }
  3314. return
  3315. }
  3316. func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) {
  3317. r1, _, e1 := syscall.Syscall(procSetupDiSetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams)))
  3318. if r1 == 0 {
  3319. err = errnoErr(e1)
  3320. }
  3321. return
  3322. }
  3323. func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) {
  3324. r1, _, e1 := syscall.Syscall6(procSetupDiSetDeviceRegistryPropertyW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), 0)
  3325. if r1 == 0 {
  3326. err = errnoErr(e1)
  3327. }
  3328. return
  3329. }
  3330. func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) {
  3331. r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0)
  3332. if r1 == 0 {
  3333. err = errnoErr(e1)
  3334. }
  3335. return
  3336. }
  3337. func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) {
  3338. r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)))
  3339. if r1 == 0 {
  3340. err = errnoErr(e1)
  3341. }
  3342. return
  3343. }
  3344. func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) {
  3345. r1, _, e1 := syscall.Syscall(procSetupUninstallOEMInfW.Addr(), 3, uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved))
  3346. if r1 == 0 {
  3347. err = errnoErr(e1)
  3348. }
  3349. return
  3350. }
  3351. func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) {
  3352. r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0)
  3353. argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0))
  3354. if argv == nil {
  3355. err = errnoErr(e1)
  3356. }
  3357. return
  3358. }
  3359. func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) {
  3360. r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0)
  3361. if r0 != 0 {
  3362. ret = syscall.Errno(r0)
  3363. }
  3364. return
  3365. }
  3366. func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) {
  3367. r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd))
  3368. if r1 <= 32 {
  3369. err = errnoErr(e1)
  3370. }
  3371. return
  3372. }
  3373. func ExitWindowsEx(flags uint32, reason uint32) (err error) {
  3374. r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0)
  3375. if r1 == 0 {
  3376. err = errnoErr(e1)
  3377. }
  3378. return
  3379. }
  3380. func GetShellWindow() (shellWindow HWND) {
  3381. r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
  3382. shellWindow = HWND(r0)
  3383. return
  3384. }
  3385. func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) {
  3386. r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0)
  3387. tid = uint32(r0)
  3388. if tid == 0 {
  3389. err = errnoErr(e1)
  3390. }
  3391. return
  3392. }
  3393. func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
  3394. r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
  3395. ret = int32(r0)
  3396. if ret == 0 {
  3397. err = errnoErr(e1)
  3398. }
  3399. return
  3400. }
  3401. func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) {
  3402. var _p0 uint32
  3403. if inheritExisting {
  3404. _p0 = 1
  3405. }
  3406. r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
  3407. if r1 == 0 {
  3408. err = errnoErr(e1)
  3409. }
  3410. return
  3411. }
  3412. func DestroyEnvironmentBlock(block *uint16) (err error) {
  3413. r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
  3414. if r1 == 0 {
  3415. err = errnoErr(e1)
  3416. }
  3417. return
  3418. }
  3419. func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
  3420. r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
  3421. if r1 == 0 {
  3422. err = errnoErr(e1)
  3423. }
  3424. return
  3425. }
  3426. func GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32, err error) {
  3427. var _p0 *uint16
  3428. _p0, err = syscall.UTF16PtrFromString(filename)
  3429. if err != nil {
  3430. return
  3431. }
  3432. return _GetFileVersionInfoSize(_p0, zeroHandle)
  3433. }
  3434. func _GetFileVersionInfoSize(filename *uint16, zeroHandle *Handle) (bufSize uint32, err error) {
  3435. r0, _, e1 := syscall.Syscall(procGetFileVersionInfoSizeW.Addr(), 2, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle)), 0)
  3436. bufSize = uint32(r0)
  3437. if bufSize == 0 {
  3438. err = errnoErr(e1)
  3439. }
  3440. return
  3441. }
  3442. func GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) {
  3443. var _p0 *uint16
  3444. _p0, err = syscall.UTF16PtrFromString(filename)
  3445. if err != nil {
  3446. return
  3447. }
  3448. return _GetFileVersionInfo(_p0, handle, bufSize, buffer)
  3449. }
  3450. func _GetFileVersionInfo(filename *uint16, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) {
  3451. r1, _, e1 := syscall.Syscall6(procGetFileVersionInfoW.Addr(), 4, uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer), 0, 0)
  3452. if r1 == 0 {
  3453. err = errnoErr(e1)
  3454. }
  3455. return
  3456. }
  3457. func VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) {
  3458. var _p0 *uint16
  3459. _p0, err = syscall.UTF16PtrFromString(subBlock)
  3460. if err != nil {
  3461. return
  3462. }
  3463. return _VerQueryValue(block, _p0, pointerToBufferPointer, bufSize)
  3464. }
  3465. func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) {
  3466. r1, _, e1 := syscall.Syscall6(procVerQueryValueW.Addr(), 4, uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize)), 0, 0)
  3467. if r1 == 0 {
  3468. err = errnoErr(e1)
  3469. }
  3470. return
  3471. }
  3472. func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) {
  3473. r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data)))
  3474. if r0 != 0 {
  3475. ret = syscall.Errno(r0)
  3476. }
  3477. return
  3478. }
  3479. func FreeAddrInfoW(addrinfo *AddrinfoW) {
  3480. syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
  3481. return
  3482. }
  3483. func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) {
  3484. r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0)
  3485. if r0 != 0 {
  3486. sockerr = syscall.Errno(r0)
  3487. }
  3488. return
  3489. }
  3490. func WSACleanup() (err error) {
  3491. r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0)
  3492. if r1 == socket_error {
  3493. err = errnoErr(e1)
  3494. }
  3495. return
  3496. }
  3497. func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) {
  3498. r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength)))
  3499. n = int32(r0)
  3500. if n == -1 {
  3501. err = errnoErr(e1)
  3502. }
  3503. return
  3504. }
  3505. func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) {
  3506. var _p0 uint32
  3507. if wait {
  3508. _p0 = 1
  3509. }
  3510. r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0)
  3511. if r1 == 0 {
  3512. err = errnoErr(e1)
  3513. }
  3514. return
  3515. }
  3516. func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) {
  3517. r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine))
  3518. if r1 == socket_error {
  3519. err = errnoErr(e1)
  3520. }
  3521. return
  3522. }
  3523. func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) {
  3524. r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
  3525. if r1 == socket_error {
  3526. err = errnoErr(e1)
  3527. }
  3528. return
  3529. }
  3530. func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) {
  3531. r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
  3532. if r1 == socket_error {
  3533. err = errnoErr(e1)
  3534. }
  3535. return
  3536. }
  3537. func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) {
  3538. r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0)
  3539. if r1 == socket_error {
  3540. err = errnoErr(e1)
  3541. }
  3542. return
  3543. }
  3544. func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) {
  3545. r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)))
  3546. if r1 == socket_error {
  3547. err = errnoErr(e1)
  3548. }
  3549. return
  3550. }
  3551. func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) {
  3552. r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags))
  3553. handle = Handle(r0)
  3554. if handle == InvalidHandle {
  3555. err = errnoErr(e1)
  3556. }
  3557. return
  3558. }
  3559. func WSAStartup(verreq uint32, data *WSAData) (sockerr error) {
  3560. r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
  3561. if r0 != 0 {
  3562. sockerr = syscall.Errno(r0)
  3563. }
  3564. return
  3565. }
  3566. func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) {
  3567. r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
  3568. if r1 == socket_error {
  3569. err = errnoErr(e1)
  3570. }
  3571. return
  3572. }
  3573. func Closesocket(s Handle) (err error) {
  3574. r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0)
  3575. if r1 == socket_error {
  3576. err = errnoErr(e1)
  3577. }
  3578. return
  3579. }
  3580. func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) {
  3581. r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen))
  3582. if r1 == socket_error {
  3583. err = errnoErr(e1)
  3584. }
  3585. return
  3586. }
  3587. func GetHostByName(name string) (h *Hostent, err error) {
  3588. var _p0 *byte
  3589. _p0, err = syscall.BytePtrFromString(name)
  3590. if err != nil {
  3591. return
  3592. }
  3593. return _GetHostByName(_p0)
  3594. }
  3595. func _GetHostByName(name *byte) (h *Hostent, err error) {
  3596. r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
  3597. h = (*Hostent)(unsafe.Pointer(r0))
  3598. if h == nil {
  3599. err = errnoErr(e1)
  3600. }
  3601. return
  3602. }
  3603. func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
  3604. r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
  3605. if r1 == socket_error {
  3606. err = errnoErr(e1)
  3607. }
  3608. return
  3609. }
  3610. func GetProtoByName(name string) (p *Protoent, err error) {
  3611. var _p0 *byte
  3612. _p0, err = syscall.BytePtrFromString(name)
  3613. if err != nil {
  3614. return
  3615. }
  3616. return _GetProtoByName(_p0)
  3617. }
  3618. func _GetProtoByName(name *byte) (p *Protoent, err error) {
  3619. r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
  3620. p = (*Protoent)(unsafe.Pointer(r0))
  3621. if p == nil {
  3622. err = errnoErr(e1)
  3623. }
  3624. return
  3625. }
  3626. func GetServByName(name string, proto string) (s *Servent, err error) {
  3627. var _p0 *byte
  3628. _p0, err = syscall.BytePtrFromString(name)
  3629. if err != nil {
  3630. return
  3631. }
  3632. var _p1 *byte
  3633. _p1, err = syscall.BytePtrFromString(proto)
  3634. if err != nil {
  3635. return
  3636. }
  3637. return _GetServByName(_p0, _p1)
  3638. }
  3639. func _GetServByName(name *byte, proto *byte) (s *Servent, err error) {
  3640. r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0)
  3641. s = (*Servent)(unsafe.Pointer(r0))
  3642. if s == nil {
  3643. err = errnoErr(e1)
  3644. }
  3645. return
  3646. }
  3647. func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) {
  3648. r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
  3649. if r1 == socket_error {
  3650. err = errnoErr(e1)
  3651. }
  3652. return
  3653. }
  3654. func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) {
  3655. r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0)
  3656. if r1 == socket_error {
  3657. err = errnoErr(e1)
  3658. }
  3659. return
  3660. }
  3661. func listen(s Handle, backlog int32) (err error) {
  3662. r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0)
  3663. if r1 == socket_error {
  3664. err = errnoErr(e1)
  3665. }
  3666. return
  3667. }
  3668. func Ntohs(netshort uint16) (u uint16) {
  3669. r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0)
  3670. u = uint16(r0)
  3671. return
  3672. }
  3673. func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) {
  3674. var _p0 *byte
  3675. if len(buf) > 0 {
  3676. _p0 = &buf[0]
  3677. }
  3678. r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
  3679. n = int32(r0)
  3680. if n == -1 {
  3681. err = errnoErr(e1)
  3682. }
  3683. return
  3684. }
  3685. func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) {
  3686. var _p0 *byte
  3687. if len(buf) > 0 {
  3688. _p0 = &buf[0]
  3689. }
  3690. r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen))
  3691. if r1 == socket_error {
  3692. err = errnoErr(e1)
  3693. }
  3694. return
  3695. }
  3696. func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) {
  3697. r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0)
  3698. if r1 == socket_error {
  3699. err = errnoErr(e1)
  3700. }
  3701. return
  3702. }
  3703. func shutdown(s Handle, how int32) (err error) {
  3704. r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0)
  3705. if r1 == socket_error {
  3706. err = errnoErr(e1)
  3707. }
  3708. return
  3709. }
  3710. func socket(af int32, typ int32, protocol int32) (handle Handle, err error) {
  3711. r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol))
  3712. handle = Handle(r0)
  3713. if handle == InvalidHandle {
  3714. err = errnoErr(e1)
  3715. }
  3716. return
  3717. }
  3718. func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) {
  3719. r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0)
  3720. if r1 == 0 {
  3721. err = errnoErr(e1)
  3722. }
  3723. return
  3724. }
  3725. func WTSFreeMemory(ptr uintptr) {
  3726. syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0)
  3727. return
  3728. }
  3729. func WTSQueryUserToken(session uint32, token *Token) (err error) {
  3730. r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0)
  3731. if r1 == 0 {
  3732. err = errnoErr(e1)
  3733. }
  3734. return
  3735. }