Home > Back-end >  Win2016 environment for end users Shared disk prompt 1707 error. (delphi7)
Win2016 environment for end users Shared disk prompt 1707 error. (delphi7)

Time:09-17

 function GetUserResource (IpAddr: string; Var List: TStringList) : Boolean; 
Type
TNetResourceArray=^ TNetResource;//network type array
Var
I: Integer;
Buf: Pointer;
Temp: TNetResourceArray;
LphEnum: THandle;
NetResource: TNetResource;
Count, BufSize, Res: DWord;
The Begin
Result:=False;
List. The Clear;
If the copy (Ipaddr, 0, 2) & lt;> Then '\ \'
IpAddr: + IpAddr='\ \';//fill in the Ip address information
FillChar (NetResource, SizeOf (NetResource), 0).//initialize the network level information
NetResource. LpRemoteName:=@ IpAddr [1].//the specified computer name
//handle to obtain the specified computer network resources
Res:=WNetOpenEnum (RESOURCE_GLOBALNET RESOURCETYPE_ANY,
RESOURCEUSAGE_CONNECTABLE, @ NetResource lphEnum);
Buf:=nil;
If Res & lt;> NO_ERROR then exit. Failed to perform//
While True do//list specified working group of the network resources
The begin
Count:=$FFFFFFFF;//number of unlimited resources
BufSize:=8192;//the buffer size is set to 8 k
GetMem (Buf, BufSize);//the application memory, used to get working group information
//get specified network resources of the computer name
Res:=WNetEnumResource (lphEnum, Count, Pointer (Buf), BufSize);
If Res=ERROR_NO_MORE_ITEMS then break;/finished/resource list
If (Res & lt;> NO_ERROR) then the Exit; Failed to perform//
Temp:=TNetResourceArray (Buf);
For I:=0 to do the Count - 1
The begin
//get assigned a Shared resource in computer name, + 2 to delete "\ " said,
//such as//192.168.0.1=& gt; 192.168.0.1
List. The Add (Temp ^. LpRemoteName + 2);
Inc (Temp);
The end;
The end;
Res:=WNetCloseEnum (lphEnum);//off a list
If Res & lt;> NO_ERROR then exit. Failed to perform//
Result:=True;
FreeMem (Buf);
The End;


for end users Shared disk:
 
IpAddr:='\ \ tsclient';

Res:=WNetOpenEnum (RESOURCE_GLOBALNET RESOURCETYPE_ANY,
RESOURCEUSAGE_CONNECTABLE, @ NetResource lphEnum);


in win10 (win2016) environment, return to 1707. The Res (1707 0 x000006ab network address is invalid)

But in win2003 and win2008 environment is normal. (Res returns 0)

How to solve this problem? You can give some advice, thanks.

CodePudding user response:

1017 error is a network address is invalid, version, not the same as a result, should modify the code,

CodePudding user response:

reference 1st floor lyhoo163 response:
1017 error is a network address is invalid, version, not the same as a result, should modify the code,

What other way?
  • Related