Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by nivekski
Wed, 28 Jun 2006 21:04
Create a shared network folder. part 2?
Author: nivekski
Date: Wed, 28 Jun 2006 21:04
Date: Wed, 28 Jun 2006 21:04
31 lines
1549 bytes
1549 bytes
Hi
The code below now compiles fine but on running I get error 53 yet c:\DTT
does exist, any thoughts please folks?
void __fastcall TmainForm::create_share_drive(void)
{
NET_API_STATUS res;
SHARE_INFO_2 p;
DWORD parm_err = 0;
wchar_t *pFolder = L"C:\\DTT";
wchar_t *pShare = L"DTTServer";
p.shi2_netname = pShare;
p.shi2_type = STYPE_DISKTREE; // disk drive
p.shi2_remark = pShare;
p.shi2_permissions = ACCESS_ALL;
p.shi2_max_uses = -1;
p.shi2_current_uses = 0;
p.shi2_path = pFolder;
p.shi2_passwd = NULL; // no password
res=NetShareAdd(pShare, 2, (LPBYTE) &p, &parm_err);
}
--
Nevikski
www.kevsbox.com
Re: Create a shared network folder. part 2?
Author: Remy Lebeau (TeamB)
Date: Wed, 28 Jun 2006 22:09
Date: Wed, 28 Jun 2006 22:09
33 lines
1970 bytes
1970 bytes
"nivekski" <nevikski@tisconi.com> wrote in message
news:44a2eeda@newsgroups.borland.com...
> The code below now compiles fine but on running I get
> error 53 yet c:\DTT does exist, any thoughts please folks?
53 is ERROR_BAD_NETPATH. You are specifying the remote machine's name as
the share where you should be specifying the name of the actual share that
the remote computer has defined. You are also not including backslashes in
the server name
Try this instead (untested):
void __fastcall TmainForm::create_share_drive(void)
{
SHARE_INFO_2 p = {0};
DWORD parm_err = 0;
p.shi2_netname = TEXT("TheShareName");
p.shi2_type = STYPE_DISKTREE; // disk drive
p.shi2_remark = TEXT("TheShareName test");
p.shi2_permissions = ACCESS_ALL;
p.shi2_max_uses = -1;
p.shi2_current_uses = 0;
p.shi2_path = TEXT("C:\\DTT");
p.shi2_passwd = NULL; // no password
NetShareAdd(TEXT("\\\\DTTServer"), 2, (LPBYTE) &p, &parm_err);
}
Gambit
Re: Create a shared network folder. part 2?
Author: nivekski
Date: Thu, 29 Jun 2006 07:22
Date: Thu, 29 Jun 2006 07:22
43 lines
2259 bytes
2259 bytes
Ah, thanks
--
Nevikski
www.kevsbox.com
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:44a2fe9f$1@newsgroups.borland.com...
>
> "nivekski" <nevikski@tisconi.com> wrote in message
> news:44a2eeda@newsgroups.borland.com...
>
>> The code below now compiles fine but on running I get
>> error 53 yet c:\DTT does exist, any thoughts please folks?
>
> 53 is ERROR_BAD_NETPATH. You are specifying the remote machine's name as
> the share where you should be specifying the name of the actual share that
> the remote computer has defined. You are also not including backslashes
> in
> the server name
>
> Try this instead (untested):
>
> void __fastcall TmainForm::create_share_drive(void)
> {
> SHARE_INFO_2 p = {0};
> DWORD parm_err = 0;
>
> p.shi2_netname = TEXT("TheShareName");
> p.shi2_type = STYPE_DISKTREE; // disk drive
> p.shi2_remark = TEXT("TheShareName test");
> p.shi2_permissions = ACCESS_ALL;
> p.shi2_max_uses = -1;
> p.shi2_current_uses = 0;
> p.shi2_path = TEXT("C:\\DTT");
> p.shi2_passwd = NULL; // no password
>
> NetShareAdd(TEXT("\\\\DTTServer"), 2, (LPBYTE) &p, &parm_err);
> }
>
>
> Gambit
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads