{"id":673,"date":"2008-05-20T07:07:07","date_gmt":"2008-05-20T07:07:07","guid":{"rendered":"http:\/\/6teen.ru\/?p=622"},"modified":"2008-05-20T07:07:07","modified_gmt":"2008-05-20T07:07:07","slug":"8890","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=673","title":{"rendered":"\u041f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0438 \u0430\u0434\u043c\u0438\u043d\u0430 \u0432 \u041e\u0421"},"content":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0438 \u0430\u0434\u043c\u0438\u043d\u0430 \u0432 \u041e\u0421<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u041f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0438 \u0430\u0434\u043c\u0438\u043d\u0430 \u0432 \u041e\u0421\n\nconst\nSECURITY_NT_AUTHORITY: TSIDIdentifierAuthority =\n(Value: (0, 0, 0, 0, 0, 5));\nSECURITY_BUILTIN_DOMAIN_RID = $00000020;\nDOMAIN_ALIAS_RID_ADMINS = $00000220;\n\n...\n\nfunction IsAdmin: Boolean;\nvar\nhAccessToken: THandle;\nptgGroups: PTokenGroups;\ndwInfoBufferSize: DWORD;\npsidAdministrators: PSID;\nx: Integer;\nbSuccess: BOOL;\nbegin\nResult := False;\nbSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True,\nhAccessToken);\nif not bSuccess then\nbegin\nif GetLastError = ERROR_NO_TOKEN then\nbSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY,\nhAccessToken);\nend;\nif bSuccess then\nbegin\nGetMem(ptgGroups, 1024);\nbSuccess := GetTokenInformation(hAccessToken, TokenGroups,\nptgGroups, 1024, dwInfoBufferSize);\nCloseHandle(hAccessToken);\nif bSuccess then\nbegin\nAllocateAndInitializeSid(SECURITY_NT_AUTHORITY, 2,\nSECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS,\n0, 0, 0, 0, 0, 0, psidAdministrators);\n{$R-}\nfor x := 0 to ptgGroups.GroupCount - 1 do\nif EqualSid(psidAdministrators, ptgGroups.Groups[x].Sid) then\nbegin\nResult := True;\nBreak;\nend;\n{$R+}\nFreeSid(psidAdministrators);\nend;\nFreeMem(ptgGroups);\nend;\nend;\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0438 \u0430\u0434\u043c\u0438\u043d\u0430 \u0432 \u041e\u0421<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[448,454],"tags":[1215,1607],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/673"}],"collection":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=673"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/673\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}