zsyscall_windows.go 191 KB

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