Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » Indigo Rose AutoPlay Media Studio (часть 4)

Модерирует : gyra, Maz

articlebot (05-08-2012 06:20): Лимит страниц, переезжаем сюда  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

Zloy_Gelud



Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

Код:
NetShare = {};
 
-- Shares a server resource.

--  sServer  -  Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If
--              this parameter is blank, the local computer is used.]
--  sShare   -     Share name of a resource
--  nType    -  Contains the type of the shared resource.  
--  sPath    -  Local path for the shared resource. For disks, this is the path being shared. For print queues,
--              this is the name of the print queue being shared.
--  sComment -  [optional] String that contains an comment about the shared resource
--  nMaxUses -  [optional] The maximum number of concurrent connections that the shared resource can accommodate. The
--              number of connections is unlimited if the value specified is –1.
               
--  Return: Success: True  
--          Failure: False
NetShare.Add = function (sServer, sShare, nType, sPath, sComment, nMaxUses)
    sComment = sComment or "";
    nMaxUses = nMaxUses or -1;
    local pServer = Memory.Allocate(512);
    local pShare = Memory.Allocate(512);
    local pPath  = Memory.Allocate(512);
    local pPwd  = Memory.Allocate(512);
    if sServer == "" then sServer = "127.0.0.1"; end
    if String.Left(sServer, 2) ~= "\\\\" then sServer = "\\\\" .. sServer; end
    local pComment = 0;
    if sComment ~= "" then
        local pComment  = Memory.Allocate(512);
        pComment = Memory.PutString(pComment, sComment, -1, "Unicode");
    end
    local pInfo = Memory.CreateStructure("int, int, int, int, int, int, int, int");
     
    Memory.PutString(pServer, sServer, -1, "Unicode");
    Memory.PutString(pShare, sShare, -1, "Unicode");
    Memory.PutString(pPath, sPath, -1, "Unicode");
    Memory.PutString(pPwd, "", -1, "Unicode");
 
    Memory.SetStructureData(pInfo, 1, 0, pShare, "");
    Memory.SetStructureData(pInfo, 2, 0, nType, "");
    Memory.SetStructureData(pInfo, 3, 0, pComment, "");
    Memory.SetStructureData(pInfo, 4, 0, 258, "");
    Memory.SetStructureData(pInfo, 7, 0, pPath, "");
    Memory.SetStructureData(pInfo, 5, 0, nMaxUses, "");
    Memory.SetStructureData(pInfo, 6, 0, 0, "");
    Memory.SetStructureData(pInfo, 8, 0, pPwd, "");
 
    local sRes = DLL.CallFunction("netapi32.dll", "NetShareAdd", pServer..", 2,"..pInfo..",0", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
     
    Memory.Free(pServer);
    Memory.Free(pPwd);
    Memory.Free(pShare);
    Memory.Free(pPath);
    if pComment ~= 0 then Memory.Free(pComment); end
    Memory.FreeStructure(pInfo);
     
    return sRes == "0";
end
 
--  Deletes a share name from a server's list of shared resources.

--  sServer - Specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If
--            this parameter is blank, the local computer is used.
--  sShare -  Specifies the name of the share to delete
   
--  Return: Success: True  
--          Failure: False
NetShare.Del = function (sServer, sShare)
    if sServer == "" then sServer = "127.0.0.1"; end
    if String.Left(sServer, 2) ~= "\\\\" then sServer = "\\\\" .. sServer; end
    local pServer = Memory.Allocate(512);
    local pShare = Memory.Allocate(512);
    Memory.PutString(pServer, sServer, -1, "Unicode");
    Memory.PutString(pShare, sShare, -1, "Unicode");
    local sRes = DLL.CallFunction("netapi32.dll", "NetShareDel", pServer..", "..pShare..",0", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    Memory.Free(pServer);
    Memory.Free(pShare);
    return sRes == "0";
end

Всего записей: 3266 | Зарегистр. 30-05-2007 | Отправлено: 00:05 28-02-2012 | Исправлено: Zloy_Gelud, 00:25 28-02-2012
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » Indigo Rose AutoPlay Media Studio (часть 4)
articlebot (05-08-2012 06:20): Лимит страниц, переезжаем сюда


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru