Показать сообщение отдельно
Старый 20.11.2009, 17:07   #1124
Пользователь
 
Регистрация: 23.03.2009
Сообщений: 50
Сказал Спасибо: 10
Имеет 10 спасибок в 1 сообщении
murc пока неопределено
По умолчанию

alexteam, например вот так ?
Код:
function WSPStartup(wVersionRequested: WORD; lpWSPData: LPWSPDATA;
  lpProtocolInfo: LPWSAPROTOCOL_INFOW; UpcallTable: WSPUPCALLTABLE;
  lpProcTable: LPWSPPROC_TABLE): Integer; stdcall;
var
  WSPStartupFunc : LPWSPSTARTUP;
  WSAData: TWSADATA;
  Buf: PWSAPROTOCOL_INFOW;
  hDLL : Cardinal;
  wDLLpath: PWideChar;
  sDllpath: String;
  Len, Layerid, NextLayerid: dword;
  iLen, i, Count, Error: Integer;
begin
  WSAStartUp($202, WSAData);
  Count := WSCEnumProtocols(nil, buf, len, error);
  if Count = -1 then begin
    GetMem(Buf, Len+1);
    Count := WSCEnumProtocols(nil, buf, len, error);
  end;
    for i:=1 to Count do begin
      if @buf.ProviderId = @LSPGUID then begin
        Layerid := buf.dwCatalogEntryId;
        break;
      end;
        buf := Pointer(Dword(buf) +$274);
    end;
    for i:=0 to lpProtocolInfo.ProtocolChain.ChainLen do begin
      if lpProtocolInfo.ProtocolChain.ChainEntries[i] = Layerid then begin
        NextLayerid := lpProtocolInfo.ProtocolChain.ChainEntries[i+1];
        break;
      end;
    end;
    for i:=1 to Count do begin
      if NextLayerid = buf.dwCatalogEntryId then begin
        iLen := 255;
        WSCGetProviderPath(buf.ProviderId, wDLLpath, iLen, Error);
        sDLLpath := WideCharLenToString(wDLLpath, Length(wDLLpath));
        Break;
      end;
      buf := Pointer(Dword(buf) +$274);
    end;
  hDLL := Loadlibrary(Pchar(sDLLpath));
    if hDLL = 0 then Exit;
  WSPStartupFunc := LPWSPSTARTUP(GetProcAddress(hDLL,pchar('WSPStartup')));
    if assigned(WSPStartupFunc) then
      begin
        result := WSPStartupFunc(wVersionRequested,lpWSPData,lpProtocolInfo,UpcallTable,lpProcTable);
          if result = 0 then
            begin
              NextProcTable:=lpProcTable^;
              lpProcTable.lpWSPRecv := WSPRecv;
          end;
    end;
end;
murc вне форума   Ответить с цитированием