![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
принадлежность ип к данной группе
Aks © (2004-03-23 12:33:00)Как это можно узнать? А можно ли узнать по нику?
Ozone (2004-03-23 15:45:00) [1]Приезжай в Новосиб, для пива всегда место найдется ;-)
Aks (2004-03-23 15:35:00) [2]Всем спасибо. Дал бы пива, если бы такая возможность была. Мб кто-нить живет в ГЗ МГУ?
Ozone (2004-03-23 15:29:00) [3]Ну и вызываешь:
var
HostInfo: THostInfo;
begin
HostInfo := GetNetUser('127.0.0.1');
Caption := HostInfo.logon_domain;
end;
Ozone (2004-03-23 15:24:00) [4]Вот полный код функции:
function GetNetUser(HostName: WideString): THostInfo;
var
Info: Pointer;
ElTotal: PDWord;
ElCount: PDWord;
Resume: PDWord;
Error: LongInt;
begin
Resume:=0;
NetWkstaUserEnum(PWideChar(HostName),1, Info,0,
ElCount,ElTotal,Resume);
Error:=NetWkstaUserEnum(PWideChar(HostName),1,Info,256*Integer(ElTotal),
ElCount,ElTotal,Resume);
case Error of
ERROR_ACCESS_DENIED: Result.UserName:= 'ERROR - ACCESS DENIED';
ERROR_MORE_DATA: Result.UserName:= 'ERROR - MORE DATA';
ERROR_INVALID_LEVEL: Result.UserName:= 'ERROR - INVALID LEVEL';
else if Info <> nil then Result:=THostInfo(info^)
else begin
Result.username:= '';
Result.logon_domain:= '';
Result.oth_domains:= '';
Result.logon_server:= '';
end;
end;
end;
Aks (2004-03-23 15:19:00) [5]на этой строке возникает ошибка Read of adress 0000000
P := THostInfo(Info^);
кто-нить знает почему? вроде все правильно
Ozone (2004-03-23 14:48:00) [6]Я же писал
stdcall; external 'netapi32.dll' name 'NetWkstaUserEnum';
Aks (2004-03-23 14:45:00) [7]А какую библиотеку надо подключить и как(ниразу не подключал библиотеки)?
Ozone (2004-03-23 14:38:00) [8]NetWkstaUserEnum
NetWkstaUserEnum(servername: PWideChar; // IP
level : DWord;
var bufptr: Pointer; // вот здесь будет лежать все что нужно (см. (*))
prefmaxlen: DWord;
var entriesread: PDWord;
var totalentries: PDWord;
var resumehandle: PDWord ): LongInt ;
stdcall; external 'netapi32.dll' name 'NetWkstaUserEnum';
(*) THostInfo = record
username: PWideChar;
logon_domain: PWideChar;
oth_domains: PWideChar;
logon_server: PWideChar;
end;
Вызывается все это дело:
NetWkstaUserEnum(PWideChar(HostName),1,Info,256*Integer(ElTotal),
ElCount,ElTotal,Resume)
P := THostInfo(Info^)
где
Info: Pointer;
ElTotal: PDWord;
ElCount: PDWord;
Resume: PDWord;
P: THostInfo;
BiN (2004-03-23 14:23:00) [9]NetUserGetGroups
в мсдн даже пример есть
Aks (2004-03-23 14:12:00) [10]Спасибо. Полазил, ничего подходящего, к сожалению, не нашел. Может еще какие ссылки есть?
Ozone (2004-03-23 14:03:00) [11]Открывай только в IE
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemain4/html/_wcesdk_iphlpapi_Module.asp
Если надо, могу выслать додуль с описанием всех этих процедур.
Aks (2004-03-23 13:58:00) [12]Всем спасибо, действительно не помогла. А может кто знает, какая поможет? Очень нужно.
Rouse_ (2004-03-23 13:50:00) [13]В примере > PChar(Usr)нужно заменить на nil:)
Rouse_ (2004-03-23 13:44:00) [14]Ну в справке же описано, первый параметр имя, второй буфер (к примеру array [0..255] of Char) третий размер буфера
procedure TForm1.Button1Click(Sender: TObject);
var
Buff: array [0..255] of Char;
Length: Cardinal;
begin
Length := 256;
WNetGetUser(PChar(Usr), @Buff, Length);
Caption := String(Buff);
end;
Но только эта функция не даст тебе нужного результата...
Ozone (2004-03-23 13:43:00) [15]lpName
Contains the name of the local device the caller is interested in, or the name of a remote network resource that the user has made a connection to, or the name of a network provider, or NULL or the empty string if the caller is interested in the name of the user currently logged on to the system.
lpUserID
Points to a buffer to receive the user profile name. This is an identification string that the user made to establish the connection (for example, a user name, or group name).
If the name passed in is a network provider and the network does not have a network wide log on, then an empty string is returned.
If a network resource name is passed in, and the user is connected to that resource using different names, it is possible that a NP cannot resolve which user profile name to return. In this case the NP may make an arbitrary choice amongst the possible user names.
Aks (2004-03-23 13:29:00) [16]Нашел функцию
WNetGetUser(lpName,lpUserName: PAnsiChar; var lpLength: Cardinal)
может кто-нить сможет обьяснить мне параметры, а то я что-то туплю.
Aks (2004-03-23 12:39:00) [17]Например, есть домен, в нем две группы А и Б, чел Petr принадлежит группе А.
Как я смогу это узнать?
panov (2004-03-23 12:35:00) [18]принадлежность ип к данной группе
Что за группы?
А можно ли узнать по нику?
Адрес IP никак не связан с никами.