English 中文(简体)
网上用户
原标题:Usage of NetGroupGetUsers

我想让一个使用<代码>的集团的用户参与进来。 NetGroupGetUsers function.

DWORD dwError = 0;
NET_API_STATUS nStatus;
LPDWORD entriesread=0;
LPDWORD totalentries=0;
LPBYTE *buff;
nStatus=NetGroupGetUsers(NULL,L"Users",0,buff,MAX_PREFERRED_LENGTH,
                          entriesread,totalentries,NULL);

(一) 使用这个错误;

xC0000005: Access violation reading location 0xffffffffffffffff.

如何在什么时候奏效? 同时,我也试图这样做;

GROUP_USERS_INFO_0 *buff;
nStatus=NetGroupGetUsers(NULL,L"Users",0,(LPBYTE*)&buff,MAX_PREFERRED_LENGTH,
entriesread,totalentries,NULL);

但也有同样的错误。

EDIT:NStatus Value is NERR_group Notfound i 认为侵犯准入的原因正试图读出实际上确定的uff。

EDIT2:i利用这一功能Net LocalGroupGet Memberss。 现在它取得了成功,但<代码>buff->grui0_name毫无意义。 有一个名为“ali”的用户,但buff->grui0_name的价值只是“d”。 WHAT AM I DOING WRONG?

最后一部法典;

LPCWSTR TargetGroup = L"group1";

DWORD dwError = 0;
NET_API_STATUS stat;

GROUP_USERS_INFO_0 *buff;
LPDWORD entriesread=new DWORD;
LPDWORD totalentries=new DWORD;

stat=NetGroupGetUsers(NULL,TargetGroup,0,(LPBYTE *)&buff,MAX_PREFERRED_LENGTH,
                          entriesread,totalentries,NULL);

表2

stat=NetLocalGroupGetMembers(NULL,TargetGroup,0,(LPBYTE *)&buff,
                  MAX_PREFERRED_LENGTH,entriesread,totalentries,NULL);

请帮助......

最佳回答
LPCWSTR TargetGroup = L"group1";

NET_API_STATUS stat;

LOCALGROUP_MEMBERS_INFO_1 *buff;
LPDWORD entriesread=new DWORD;
LPDWORD totalentries=new DWORD;

stat=NetLocalGroupGetMembers(NULL,TargetGroup,1,(LPBYTE *)&buff,
                        MAX_PREFERRED_LENGTH,entriesread,totalentries,NULL);



wprintf(buff->lgrmi1_name);

该法典现在起作用。 感谢大家。

问题回答

页: 1 你应该写

GROUP_USERS_INFO_0 *buff;
... NetGroupGetUsers(..., (LPBYTE*)&buff, ...);

otherwise you re telling NetGroupGetUsers to write the results to a garbage location. Note that the bufptr parameter is documented as [out]. That means that it is the caller s responsibility to specify where the result should go. There s more to calling a function than just getting the types to match.

我感到吃惊的是,你没有从编辑处得到“使用初步变数”的报警。

这里没有新版本:

LPCWSTR TargetGroup = L"group1";

NET_API_STATUS stat;

LOCALGROUP_MEMBERS_INFO_1 *buff;
DWORD entriesread;
DWORD totalentries;

stat = NetLocalGroupGetMembers(NULL,TargetGroup,1,(LPBYTE *)&buff,
    MAX_PREFERRED_LENGTH,&entriesread,&totalentries,NULL);

wprintf(buff->lgrmi1_name);




相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签