{"id":338,"date":"2008-05-19T13:13:11","date_gmt":"2008-05-19T13:13:11","guid":{"rendered":"http:\/\/6teen.ru\/?p=125"},"modified":"2008-05-19T13:13:11","modified_gmt":"2008-05-19T13:13:11","slug":"8047","status":"publish","type":"post","link":"http:\/\/pblog.ru\/lab\/?p=338","title":{"rendered":"\u0417\u0430\u0448\u0430\u0440\u0438\u0442\u044c\/\u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441"},"content":{"rendered":"<p>\u0417\u0430\u0448\u0430\u0440\u0438\u0442\u044c\/\u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441<br \/>\n<!--more--><\/p>\n<pre class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; width:580px; height:320px; overflow:auto\"><div>\u0417\u0430\u0448\u0430\u0440\u0438\u0442\u044c\/\u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\n\n\u0410\u0432\u0442\u043e\u0440: Repairman\n\n\u042d\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f Share \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0438 \u043a\u0430\u043a \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c, \u0442\u0430\u043a \u0438 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 (\u0435\u0441\u043b\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0443 \u0412\u0430\u0441 \u043f\u0440\u0430\u0432\u0430 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430 \u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0435 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u044d\u0442\u043e \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e... ;-))\n\n\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0434 NT \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 DLL...\n\u0424\u0443\u043d\u043a\u0446\u0438\u044f SetShareOnDisk - \u0441\u0442\u0430\u0432\u0438\u0442 \u0448\u0430\u0440\u0443, RemoveShareFromDisk - \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u0435\u0435.\n\nunit Share;\n\/\/(c)2002 <repairman> repairman@uzel.ru\ninterface\ntype\nTPassw = string[8];\nTNetName = string[12];\n\nfunction SetShareOnDisk(HostName: string; \/\/\u0438\u043c\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\nLocalPath: string; \/\/\u043f\u0430\u043f\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430\nNetName: TNetName; \/\/\u0438\u043c\u044f \u0440\u0430\u0441\u0448\u0430\u0440\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 \u0432 \u0441\u0435\u0442\u0438\nRemark: string; \/\/\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0432\u0438\u0434\u0438\u043c\u044b\u0439 \u0432 \u0441\u0435\u0442\u0438\nAccess: word; \/\/\u0434\u043e\u0441\u0442\u0443\u043f\nRO_Passw: TPassw; \/\/\u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435\nRW_Passw: TPassw \/\/\u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0430 \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\n): boolean;\n\nfunction RemoveShareFromDisk(HostName: string; \/\/\u0438\u043c\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\nNetName: string; \/\/\u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0438\u043c\u044f \u043f\u0430\u043f\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c\nLocalPath: string \/\/\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043f\u0430\u043f\u043a\u0438\n): boolean;\nvar\nShareResult: word;\n\/\/-------------------------------------------------------------------------------------------\nimplementation\nuses SysUtils, Windows, ShlObj;\n\nfunction NetShareAdd(ServerName: PChar; \/\/\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0438\u043c\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 '\\\\Server'#0, \u0435\u0441\u043b\u0438 \u0441\u0432\u043e\u0439, \u0442\u043e \u043c\u043e\u0436\u043d\u043e nil\nLevel: Word; \/\/\u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Share_info, \u0437\u0434\u0435\u0441\u044c 50\nPShareInfo: PChar; \/\/\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 Share_Info\nParmErr: DWord) \/\/\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 ???\n: dword; stdcall; external 'svrapi.dll'; \/\/svrapi \u0434\u043b\u044f Win9X, NetApi32 \u0434\u043b\u044f NT\n\nfunction NetShareDel(ServerName: PChar;\nNetName: PChar;\nReserved: DWord): dword; stdcall; external 'svrapi.dll';\n\ntype\n_share_info_50 = record \/\/\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Share \u0443\u0440\u043e\u0432\u043d\u044f 50\nNetName: array[1..13] of char; \/\/\u041a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0438\u0441\u043a \u0432 \u0441\u0435\u0442\u0438\nSType: byte; \/\/\u0442\u0438\u043f =0 (STYPE_DISKTREE) - \u0448\u0430\u0440\u0438\u0442\u044c \u0434\u0438\u0441\u043a\u0438\nFlags: word; \/\/\u0444\u043b\u0430\u0433\u0438 $0191,$0192,$0193....(\u0434\u043e\u0441\u0442\u0443\u043f \u0438\u0437 \u0441\u0435\u0442\u0438)\nRemark: PChar; \/\/\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0432\u0438\u0434\u0438\u043c\u044b\u0439 \u0438\u0437 \u0441\u0435\u0442\u0438\nPath: PChar; \/\/\u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0438\u043c\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 'c:\\'#0\nRW_Password: array[1..9] of char; \/\/\u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d =#0\nRO_Password: array[1..9] of char; \/\/\u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d =#0\nend;\n\/\/----------------------------\n\nfunction SetShareOnDisk(HostName, LocalPath: string; NetName: TNetName; Remark: string;\nAccess: word; RO_Passw, RW_Passw: TPassw): boolean;\nvar ShareInfo: _Share_Info_50;\nbegin\nResult := false;\nStrPCopy(@ShareInfo.NetName, NetName);\nShareInfo.SType := 0;\nShareInfo.Flags := Access;\nShareInfo.Remark := PChar(Remark);\nShareInfo.Path := PChar(LocalPath);\nStrPCopy(@ShareInfo.RO_Password, RO_Passw);\nStrPCopy(@ShareInfo.RW_Password, RW_Passw);\nShareResult := NetShareAdd(PChar(HostName), 50, @ShareInfo, $0000002A); \/\/\u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c Share\nif ShareResult <> 0 then Exit; \/\/\u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u043d\u0435\u0443\u0434\u0430\u043b\u043e\u0441\u044c\nSHChangeNotify(SHCNE_NETSHARE, SHCNF_PATH, PChar(LocalPath), nil); \/\/\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0448\u0435\u043b\u043b\u0443 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445\nResult := true;\nend;\n\/\/----------------------------\n\nfunction RemoveShareFromDisk(HostName, NetName, LocalPath: string): boolean;\nbegin\nResult := false;\nShareResult := NetShareDel(PChar(HostName), PChar(NetName), 0); \/\/\u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0448\u0430\u0440\u0443\nif ShareResult <> 0 then Exit;\nSHChangeNotify(SHCNE_NETUNSHARE, SHCNF_PATH, PChar(LocalPath), nil); \/\/\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0448\u0435\u043b\u043b\u0443 \u043e\u0431 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u0445\nResult := true;\nend;\n\/\/----------------------------\nend.\n\n\n\u0412\u0437\u044f\u0442\u043e \u0441 \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432.ru http:\/\/www.sources.ru\n<\/div><\/pre>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0448\u0430\u0440\u0438\u0442\u044c\/\u0440\u0430\u0441\u0448\u0430\u0440\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[448,457],"tags":[751,960],"_links":{"self":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/338"}],"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=338"}],"version-history":[{"count":0,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=\/wp\/v2\/posts\/338\/revisions"}],"wp:attachment":[{"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pblog.ru\/lab\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}