How can I set shared access to some directory when I work in network or change it or get access type?
Thank you, Mike.
Thank you, Mike.
Mike,
Could you please repeat your question specifying what you wanna do? We wont have problems in giving you an answer.
Could you please repeat your question specifying what you wanna do? We wont have problems in giving you an answer.
maybe you are interested in NetShareAdd
he NetShareAdd function shares a server resource.
Security Requirements
Only members of the Administrators or Account Operators local group or those with Communication, Print, or Server operator group membership can successfully execute NetShareAdd. The Print operator can add only Printer queues. The Communication operator can add only communication-device queues.
NET_API_STATUS NetShareAdd(
LPTSTR servername,
DWORD level,
LPBYTE buf,
LPDWORD parm_err
);
Parameters
servername
Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
level
Specifies one of the following values to set the level of information provided.
Value Meaning
2 The buf parameter points to an array of SHARE_INFO_2 structures.
502 The buf parameter points to an array of SHARE_INFO_502 structures.
buf
Pointer to the buffer in which the data set with the level parameter is stored.
parm_err
Optional pointer to a DWORD that contains the index of the first parameter that causes ERROR_INVALID_PARAMETER. If NULL, the parameter is not returned on error.
See Also
NetShareDel
for more info check Win32 API help (for win9x - SVRAPI.DLL; for winnt - NETAPI32.DLL)
UPDATE:
its samba
cya
he NetShareAdd function shares a server resource.
Security Requirements
Only members of the Administrators or Account Operators local group or those with Communication, Print, or Server operator group membership can successfully execute NetShareAdd. The Print operator can add only Printer queues. The Communication operator can add only communication-device queues.
NET_API_STATUS NetShareAdd(
LPTSTR servername,
DWORD level,
LPBYTE buf,
LPDWORD parm_err
);
Parameters
servername
Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
level
Specifies one of the following values to set the level of information provided.
Value Meaning
2 The buf parameter points to an array of SHARE_INFO_2 structures.
502 The buf parameter points to an array of SHARE_INFO_502 structures.
buf
Pointer to the buffer in which the data set with the level parameter is stored.
parm_err
Optional pointer to a DWORD that contains the index of the first parameter that causes ERROR_INVALID_PARAMETER. If NULL, the parameter is not returned on error.
See Also
NetShareDel
UPDATE:
its samba
cya
No problems. Create some directory, e.g. C:\MyDir and write into it two or more files (for example file1.txt and file2.txt). If you computer works in local network under any version of Windows and you want everybody can read this files you must click this directory (in explorer or Windows Commander) and give access (read-only or full, by password or not). Yes, I can do it using mouse but how can I do the same from the program? (I can create, rename or remove directories but I don't know API for networking.
Mike.
Mike.
Mike,
Use, as Nemo told you, NetShareAdd. And also you have another functions such as the following:
NetShareCheck Queries whether a server is sharing a device.
NetShareDel Deletes a share name from a server's list of shared resources.
NetShareEnum Retrieves share information about each shared resource on a server.
NetShareGetInfo Retrieves information about a specified shared resource on a server.
NetShareSetInfo Sets a shared resource's parameters.
I must say that the i copied the words below from Win32.hlp.
:-)
Good luck Mike.
Use, as Nemo told you, NetShareAdd. And also you have another functions such as the following:
NetShareCheck Queries whether a server is sharing a device.
NetShareDel Deletes a share name from a server's list of shared resources.
NetShareEnum Retrieves share information about each shared resource on a server.
NetShareGetInfo Retrieves information about a specified shared resource on a server.
NetShareSetInfo Sets a shared resource's parameters.
I must say that the i copied the words below from Win32.hlp.
:-)
Good luck Mike.