Форум: "Сети";
Текущий архив: 2002.12.05;
Скачать: [xml.tar.bz2];
Внизкак проверить установлен ли TCP/IP протокол? Найти похожие ветки
← →
Sergey V. Shadrin (2002-10-02 15:56) [0]как проверить установлен ли TCP/IP протокол на копмьютере?
← →
Song (2002-10-02 15:59) [1]
function TCPIPInstalled: boolean;
var
Reg: TRegistry;
RKeys: TStrings;
begin
Result:=False;
try
Reg := TRegistry.Create;
RKeys := TStringList.Create;
Reg.RootKey:=HKEY_LOCAL_MACHINE;
if Reg.OpenKey("\Enum\Network\MSTCP", False) Then
begin
reg.GetKeyNames(RKeys);
Result := RKeys.Count > 0;
end;
finally
Reg.free;
RKeys.free;
end;
← →
Sergey V. Shadrin (2002-10-02 16:20) [2]чего-то я не понял. какой ключ реестра надо искать. что-то я у себя не нашел такой :(
← →
Song (2002-10-02 16:36) [3]У Вас наверно w2k
← →
Digitman (2002-10-02 17:08) [4]см. WSAEnumProtocols()
← →
Sergey V. Shadrin (2002-10-03 06:56) [5]
>
> Song © (02.10.02 16:36)
> У Вас наверно w2k
ага. В2к на машине. а работать должно под всеми ос.
← →
Sergey V. Shadrin (2002-10-03 07:32) [6]
> Digitman © (02.10.02 17:08)
> см. WSAEnumProtocols()
а в uses чего написать надо? что-то оно ни в winsocs, ни в shellapi нету. а поиск в директории lib во всех файлах фразы WSAEnumProtocols ничего не дал :(
← →
Digitman (2002-10-03 08:26) [7]>Sergey V. Shadrin
В uses ничего не пиши, если у теба нет модуля winsock2.pas.
А если бы и был - все равно не пиши. Из-за одной-единственной ф-ции делать это нет смысла.
Вот соотв.декларации из этого модуля :
interface
type
type
TWSAProtocol_InfoA = record
dwServiceFlags1: LongInt;
dwServiceFlags2: LongInt;
dwServiceFlags3: LongInt;
dwServiceFlags4: LongInt;
dwProviderFlags: LongInt;
ProviderId: TGUID;
dwCatalogEntryId: LongInt;
ProtocolChain: TWSAProtocolChain;
iVersion: Integer;
iAddressFamily: Integer;
iMaxSockAddr: Integer;
iMinSockAddr: Integer;
iSocketType: Integer;
iProtocol: Integer;
iProtocolMaxOffset: Integer;
iNetworkByteOrder: Integer;
iSecurityScheme: Integer;
dwMessageSize: LongInt;
dwProviderReserved: LongInt;
szProtocol: Array[0..WSAPROTOCOL_LEN+1-1] of Char;
end {TWSAProtocol_InfoA};
PWSAProtocol_InfoA = ^TWSAProtocol_InfoA;
LPWSAProtocol_InfoA = PWSAProtocol_InfoA;
TWSAProtocol_InfoW = record
dwServiceFlags1: LongInt;
dwServiceFlags2: LongInt;
dwServiceFlags3: LongInt;
dwServiceFlags4: LongInt;
dwProviderFlags: LongInt;
ProviderId: TGUID;
dwCatalogEntryId: LongInt;
ProtocolChain: TWSAProtocolChain;
iVersion: Integer;
iAddressFamily: Integer;
iMaxSockAddr: Integer;
iMinSockAddr: Integer;
iSocketType: Integer;
iProtocol: Integer;
iProtocolMaxOffset: Integer;
iNetworkByteOrder: Integer;
iSecurityScheme: Integer;
dwMessageSize: LongInt;
dwProviderReserved: LongInt;
szProtocol: Array[0..WSAPROTOCOL_LEN+1-1] of WideChar;
end {TWSAProtocol_InfoW};
PWSAProtocol_InfoW = ^TWSAProtocol_InfoW;
LPWSAProtocol_InfoW = PWSAProtocol_InfoW;
{$IFDEF UNICODE}
WSAProtocol_Info = TWSAProtocol_InfoW;
TWSAProtocol_Info = TWSAProtocol_InfoW;
PWSAProtocol_Info = PWSAProtocol_InfoW;
LPWSAProtocol_Info = PWSAProtocol_InfoW;
{$ELSE}
WSAProtocol_Info = TWSAProtocol_InfoA;
TWSAProtocol_Info = TWSAProtocol_InfoA;
PWSAProtocol_Info = PWSAProtocol_InfoA;
LPWSAProtocol_Info = PWSAProtocol_InfoA;
{$ENDIF}
function WSAEnumProtocols; external "ws2_32.dll" name "WSAEnumProtocolsA";
inplementation
function WSAEnumProtocols( lpiProtocols : PInteger; lpProtocolBuffer : LPWSAProtocol_Info; var lpdwBufferLength : DWORD ) : Integer; stdcall;
← →
Sergey V. Shadrin (2002-10-03 09:21) [8]так, а чуть более понятнее т.е. что я на выходе получу и что должен запихать на входе?
← →
Digitman (2002-10-03 09:25) [9]The Windows Sockets WSAEnumProtocols function retrieves information about available transport protocols.
int WSAEnumProtocols (
LPINT lpiProtocols,
LPWSAPROTOCOL_INFO lpProtocolBuffer,
ILPDWORD lpdwBufferLength
);
Parameters
lpiProtocols
[in] A NULL-terminated array of iProtocol values. This parameter is optional; if lpiProtocols is NULL, information on all available protocols is returned. Otherwise, information is retrieved only for those protocols listed in the array.
lpProtocolBuffer
[out] A buffer which is filled with WSAPROTOCOL_INFO structures. See below for a detailed description of the contents of the WSAPROTOCOL_INFO structure.
lpdwBufferLength
[in/out] On input, the count of bytes in the lpProtocolBuffer buffer passed to WSAEnumProtocols. On output, the minimum buffer size that can be passed to WSAEnumProtocols to retrieve all the requested information. This routine has no ability to enumerate over multiple calls; the passed-in buffer must be large enough to hold all entries in order for the routine to succeed. This reduces the complexity of the API and should not pose a problem because the number of protocols loaded on a machine is typically small.
Remarks
This function is used to discover information about the collection of transport protocols and protocol chains installed on the local machine. Since layered protocols are only usable by applications when installed in protocol chains, information on layered protocols is not included in lpProtocolBuffer. The lpiProtocols parameter can be used as a filter to constrain the amount of information provided. Normally it will be supplied as a NULL pointer which will cause the routine to return information on all available transport protocols and protocol chains.
A WSAPROTOCOL_INFO structure is provided in the buffer pointed to by lpProtocolBuffer for each requested protocol. If the supplied buffer is not large enough (as indicated by the input value of lpdwBufferLength ), the value pointed to by lpdwBufferLength will be updated to indicate the required buffer size. The application should then obtain a large enough buffer and call this function again.
The order in which the WSAPROTOCOL_INFO structures appear in the buffer coincides with the order in which the protocol entries were registered by the service provider with the Windows Sockets DLL, or with any subsequent re-ordering that may have occurred through the Windows Sockets applet supplied for establishing default TCP/IP providers.
Return Values
If no error occurs, WSAEnumProtocols returns the number of protocols to be reported on. Otherwise, a value of SOCKET_ERROR is returned and a specific error code may be retrieved by calling WSAGetLastError.
Error Codes
WSANOTINITIALISED A successful WSAStartup must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress.
WSAEINVAL Indicates that one of the specified parameters was invalid.
WSAENOBUFS The buffer length was too small to receive all the relevant WSAPROTOCOL_INFO structures and associated information. Pass in a buffer at least as large as the value returned in lpdwBufferLength.
← →
Sergey V. Shadrin (2002-10-08 08:19) [10]ага. фиг. ругается на ProtocolChain: TWSAProtocolChain; это первое где оно ругнулось. :(
← →
Digitman (2002-10-08 09:05) [11]const
MAX_PROTOCOL_CHAIN = 7;
BASE_PROTOCOL = 1;
LAYERED_PROTOCOL = 0;
WSAPROTOCOL_LEN = 255;
type
TWSAProtocolChain = record
ChainLen: Integer; // the length of the chain,
// length = 0 means layered protocol,
// length = 1 means base protocol,
// length > 1 means protocol chain
ChainEntries: Array[0..MAX_PROTOCOL_CHAIN-1] of LongInt; // a list of dwCatalogEntryIds
end;
← →
Sergey V. Shadrin (2002-10-08 09:13) [12]
>
> function WSAEnumProtocols; external "ws2_32.dll" name "WSAEnumProtocolsA";
а теперь тут говорит, что funcrion needs result type
← →
Digitman (2002-10-08 12:56) [13]Мда... Паскаль мы не знаем и учить его не собираемся)
Короче, найди в сети и скачай себе готовый файл Winsock2.pas и не парься
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2002.12.05;
Скачать: [xml.tar.bz2];
Память: 0.48 MB
Время: 0.007 c