Author: ekohl
Date: Sun Jun 4 14:34:27 2017
New Revision: 74910
URL:
http://svn.reactos.org/svn/reactos?rev=74910&view=rev
Log:
[NETAPI32]
- Implement NetSessionDel, NetSessionEnum and NetSessionGetInfo. These functions call
their counterparts in the server service.
Modified:
trunk/reactos/dll/win32/netapi32/netapi32.spec
trunk/reactos/dll/win32/netapi32/share.c
trunk/reactos/dll/win32/netapi32/srvsvc.c
Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Sun Jun 4 14:34:27 2017
@@ -220,9 +220,9 @@
@ stub NetServiceEnum
@ stub NetServiceGetInfo
@ stub NetServiceInstall
-@ stub NetSessionDel
+@ stdcall NetSessionDel(wstr wstr wstr)
@ stdcall NetSessionEnum(wstr wstr wstr long ptr long ptr ptr ptr)
-@ stub NetSessionGetInfo
+@ stdcall NetSessionGetInfo(wstr wstr wstr long ptr)
@ stub NetSetPrimaryComputerName
@ stdcall NetShareAdd(wstr long ptr ptr)
@ stdcall NetShareCheck(wstr wstr ptr)
Modified: trunk/reactos/dll/win32/netapi32/share.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/share.c…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/share.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/share.c [iso-8859-1] Sun Jun 4 14:34:27 2017
@@ -20,43 +20,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(share);
/************************************************************
- * NetSessionEnum (NETAPI32.@)
- *
- * PARAMS
- * servername [I] Pointer to a string with the name of the server
- * UncClientName [I] Pointer to a string with the name of the session
- * username [I] Pointer to a string with the name of the user
- * level [I] Data information level
- * bufptr [O] Buffer to the data
- * prefmaxlen [I] Preferred maximum length of the data
- * entriesread [O] Pointer to the number of entries enumerated
- * totalentries [O] Pointer to the possible number of entries
- * resume_handle [I/O] Pointer to a handle for subsequent searches
- *
- * RETURNS
- * If successful, the function returns NERR_Success
- * On failure it returns:
- * ERROR_ACCESS_DENIED User has no access to the requested information
- * ERROR_INVALID_LEVEL Value of 'level' is not correct
- * ERROR_INVALID_PARAMETER Wrong parameter
- * ERROR_MORE_DATA Need a larger buffer
- * ERROR_NOT_ENOUGH_MEMORY Not enough memory
- * NERR_ClientNameNotFound A session does not exist on a given computer
- * NERR_InvalidComputer Invalid computer name
- * NERR_UserNotFound User name could not be found.
- */
-NET_API_STATUS WINAPI NetSessionEnum(LMSTR servername, LMSTR UncClientName,
- LMSTR username, DWORD level, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread,
- LPDWORD totalentries, LPDWORD resume_handle)
-{
- FIXME("Stub (%s %s %s %d %p %d %p %p %p)\n", debugstr_w(servername),
- debugstr_w(UncClientName), debugstr_w(username),
- level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
-
- return NERR_Success;
-}
-
-/************************************************************
* NetFileEnum (NETAPI32.@)
*/
NET_API_STATUS WINAPI NetFileEnum(
Modified: trunk/reactos/dll/win32/netapi32/srvsvc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/srvsvc.…
==============================================================================
--- trunk/reactos/dll/win32/netapi32/srvsvc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/netapi32/srvsvc.c [iso-8859-1] Sun Jun 4 14:34:27 2017
@@ -100,132 +100,38 @@
NET_API_STATUS
WINAPI
-NetShareAdd(
- _In_ LMSTR servername,
- _In_ DWORD level,
- _In_ LPBYTE buf,
- _Out_ LPDWORD parm_err)
-{
- NET_API_STATUS status;
-
- TRACE("NetShareAdd(%s %lu %p %p)\n",
- debugstr_w(servername), level, buf, parm_err);
-
- if (level != 2 && level != 502 && level != 503)
- return ERROR_INVALID_LEVEL;
-
- RpcTryExcept
- {
- status = NetrShareAdd(servername,
- level,
- (LPSHARE_INFO)&buf,
- parm_err);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
-
- return status;
-}
-
-
-NET_API_STATUS
-WINAPI
-NetShareCheck(
- _In_ LMSTR servername,
- _In_ LMSTR device,
- _Out_ LPDWORD type)
-{
- NET_API_STATUS status;
-
- TRACE("NetShareCheck(%s %s %p)\n",
- debugstr_w(servername), debugstr_w(device), type);
-
- RpcTryExcept
- {
- status = NetrShareCheck(servername,
- device,
- type);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
-
- return status;
-
-}
-
-
-NET_API_STATUS
-WINAPI
-NetShareDel(
- _In_ LMSTR servername,
- _In_ LMSTR netname,
- _In_ DWORD reserved)
-{
- NET_API_STATUS status;
-
- TRACE("NetShareDel(%s %s %lu)\n",
- debugstr_w(servername), debugstr_w(netname), reserved);
-
- if (netname == NULL || (*netname == 0) || reserved != 0)
- return ERROR_INVALID_PARAMETER;
-
- RpcTryExcept
- {
- status = NetrShareDel(servername,
- netname,
- reserved);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
-
- return status;
-}
-
-
-NET_API_STATUS
-WINAPI
-NetShareDelSticky(
- _In_ LMSTR servername,
- _In_ LMSTR netname,
- _In_ DWORD reserved)
-{
- NET_API_STATUS status;
-
- TRACE("NetShareDelSticky(%s %s %lu)\n",
- debugstr_w(servername), debugstr_w(netname), reserved);
-
- if (netname == NULL || (*netname == 0) || reserved != 0)
- return ERROR_INVALID_PARAMETER;
-
- RpcTryExcept
- {
- status = NetrShareDelSticky(servername,
- netname,
- reserved);
- }
- RpcExcept(EXCEPTION_EXECUTE_HANDLER)
- {
- status = I_RpcMapWin32Status(RpcExceptionCode());
- }
- RpcEndExcept;
-
- return status;
-}
-
-
-NET_API_STATUS
-WINAPI
-NetShareEnum(
- _In_ LMSTR servername,
+NetSessionDel(
+ _In_ LMSTR servername,
+ _In_ LMSTR UncClientName,
+ _In_ LMSTR username)
+{
+ NET_API_STATUS status;
+
+ TRACE("NetSessionDel(%s %s %s)\n",
+ debugstr_w(servername), debugstr_w(UncClientName), debugstr_w(username));
+
+ RpcTryExcept
+ {
+ status = NetrSessionDel(servername,
+ UncClientName,
+ username);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetSessionEnum(
+ _In_ LMSTR servername,
+ _In_ LMSTR UncClientName,
+ _In_ LMSTR username,
_In_ DWORD level,
_Out_ LPBYTE *bufptr,
_In_ DWORD prefmaxlen,
@@ -233,83 +139,100 @@
_Out_ LPDWORD totalentries,
_Inout_ LPDWORD resume_handle)
{
- SHARE_ENUM_STRUCT EnumStruct;
- SHARE_INFO_0_CONTAINER Level0Container = {0, NULL};
- SHARE_INFO_1_CONTAINER Level1Container = {0, NULL};
- SHARE_INFO_2_CONTAINER Level2Container = {0, NULL};
- SHARE_INFO_502_CONTAINER Level502Container = {0, NULL};
- NET_API_STATUS status;
-
- TRACE("NetShareEnum(%s %lu %p %lu %p %p %p)\n",
- debugstr_w(servername), level, bufptr, prefmaxlen,
- entriesread, totalentries, resume_handle);
-
- if (level > 2 && level != 502)
+ SESSION_ENUM_STRUCT EnumStruct;
+ SESSION_INFO_0_CONTAINER Level0Container = {0, NULL};
+ SESSION_INFO_1_CONTAINER Level1Container = {0, NULL};
+ SESSION_INFO_2_CONTAINER Level2Container = {0, NULL};
+ SESSION_INFO_10_CONTAINER Level10Container = {0, NULL};
+ SESSION_INFO_502_CONTAINER Level502Container = {0, NULL};
+ NET_API_STATUS status;
+
+ FIXME("NetSessionEnum(%s %s %s %lu %p %lu %p %p %p)\n",
+ debugstr_w(servername), debugstr_w(UncClientName), debugstr_w(username),
+ level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
+
+ if (level > 2 && level != 10 && level != 502)
return ERROR_INVALID_LEVEL;
+
+ if (UncClientName == NULL || username == NULL)
+ return ERROR_INVALID_PARAMETER;
*bufptr = NULL;
*entriesread = 0;
- *totalentries = 0;
EnumStruct.Level = level;
switch (level)
{
case 0:
- EnumStruct.ShareInfo.Level0 = &Level0Container;
+ EnumStruct.SessionInfo.Level0 = &Level0Container;
break;
case 1:
- EnumStruct.ShareInfo.Level1 = &Level1Container;
+ EnumStruct.SessionInfo.Level1 = &Level1Container;
break;
case 2:
- EnumStruct.ShareInfo.Level2 = &Level2Container;
+ EnumStruct.SessionInfo.Level2 = &Level2Container;
+ break;
+
+ case 10:
+ EnumStruct.SessionInfo.Level10 = &Level10Container;
break;
case 502:
- EnumStruct.ShareInfo.Level502 = &Level502Container;
- break;
- }
-
- RpcTryExcept
- {
- status = NetrShareEnum(servername,
- &EnumStruct,
- prefmaxlen,
- totalentries,
- resume_handle);
+ EnumStruct.SessionInfo.Level502 = &Level502Container;
+ break;
+ }
+
+ RpcTryExcept
+ {
+ status = NetrSessionEnum(servername,
+ UncClientName,
+ username,
+ &EnumStruct,
+ prefmaxlen,
+ totalentries,
+ resume_handle);
switch (level)
{
case 0:
- if (EnumStruct.ShareInfo.Level0->Buffer != NULL)
- {
- *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level0->Buffer;
- *entriesread = EnumStruct.ShareInfo.Level0->EntriesRead;
+ if (EnumStruct.SessionInfo.Level0->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level0->Buffer;
+ *entriesread = EnumStruct.SessionInfo.Level0->EntriesRead;
}
break;
case 1:
- if (EnumStruct.ShareInfo.Level1->Buffer != NULL)
- {
- *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level1->Buffer;
- *entriesread = EnumStruct.ShareInfo.Level1->EntriesRead;
+ if (EnumStruct.SessionInfo.Level1->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level1->Buffer;
+ *entriesread = EnumStruct.SessionInfo.Level1->EntriesRead;
}
break;
case 2:
- if (EnumStruct.ShareInfo.Level2->Buffer != NULL)
- {
- *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level2->Buffer;
- *entriesread = EnumStruct.ShareInfo.Level2->EntriesRead;
+ if (EnumStruct.SessionInfo.Level2->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level2->Buffer;
+ *entriesread = EnumStruct.SessionInfo.Level2->EntriesRead;
+ }
+ break;
+
+ case 10:
+ if (EnumStruct.SessionInfo.Level10->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level10->Buffer;
+ *entriesread = EnumStruct.SessionInfo.Level10->EntriesRead;
}
break;
case 502:
- if (EnumStruct.ShareInfo.Level502->Buffer != NULL)
- {
- *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level502->Buffer;
- *entriesread = EnumStruct.ShareInfo.Level502->EntriesRead;
+ if (EnumStruct.SessionInfo.Level502->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level502->Buffer;
+ *entriesread = EnumStruct.SessionInfo.Level502->EntriesRead;
}
break;
}
@@ -326,7 +249,222 @@
NET_API_STATUS
WINAPI
-NetShareEnumSticky(
+NetSessionGetInfo(
+ _In_ LMSTR servername,
+ _In_ LMSTR UncClientName,
+ _In_ LMSTR username,
+ _In_ DWORD level,
+ _Out_ LPBYTE *bufptr)
+{
+ SESSION_ENUM_STRUCT EnumStruct;
+ SESSION_INFO_0_CONTAINER Level0Container = {0, NULL};
+ SESSION_INFO_1_CONTAINER Level1Container = {0, NULL};
+ SESSION_INFO_2_CONTAINER Level2Container = {0, NULL};
+ SESSION_INFO_10_CONTAINER Level10Container = {0, NULL};
+ DWORD dwTotalEntries;
+ NET_API_STATUS status;
+
+ FIXME("NetSessionGetInfo(%s %s %s %lu %p)\n",
+ debugstr_w(servername), debugstr_w(UncClientName),
+ debugstr_w(username), level, bufptr);
+
+ if (level > 2 && level != 10)
+ return ERROR_INVALID_LEVEL;
+
+ if (UncClientName == NULL || username == NULL)
+ return ERROR_INVALID_PARAMETER;
+
+ *bufptr = NULL;
+
+ EnumStruct.Level = level;
+ switch (level)
+ {
+ case 0:
+ EnumStruct.SessionInfo.Level0 = &Level0Container;
+ break;
+
+ case 1:
+ EnumStruct.SessionInfo.Level1 = &Level1Container;
+ break;
+
+ case 2:
+ EnumStruct.SessionInfo.Level2 = &Level2Container;
+ break;
+
+ case 10:
+ EnumStruct.SessionInfo.Level10 = &Level10Container;
+ break;
+ }
+
+ RpcTryExcept
+ {
+ status = NetrSessionEnum(servername,
+ UncClientName,
+ username,
+ &EnumStruct,
+ MAX_PREFERRED_LENGTH, //(DWORD)-1,
+ &dwTotalEntries,
+ NULL);
+
+ switch (level)
+ {
+ case 0:
+ if (EnumStruct.SessionInfo.Level0->Buffer != NULL)
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level0->Buffer;
+ break;
+
+ case 1:
+ if (EnumStruct.SessionInfo.Level1->Buffer != NULL)
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level1->Buffer;
+ break;
+
+ case 2:
+ if (EnumStruct.SessionInfo.Level2->Buffer != NULL)
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level2->Buffer;
+ break;
+
+ case 10:
+ if (EnumStruct.SessionInfo.Level10->Buffer != NULL)
+ *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level10->Buffer;
+ break;
+ }
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetShareAdd(
+ _In_ LMSTR servername,
+ _In_ DWORD level,
+ _In_ LPBYTE buf,
+ _Out_ LPDWORD parm_err)
+{
+ NET_API_STATUS status;
+
+ TRACE("NetShareAdd(%s %lu %p %p)\n",
+ debugstr_w(servername), level, buf, parm_err);
+
+ if (level != 2 && level != 502 && level != 503)
+ return ERROR_INVALID_LEVEL;
+
+ RpcTryExcept
+ {
+ status = NetrShareAdd(servername,
+ level,
+ (LPSHARE_INFO)&buf,
+ parm_err);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetShareCheck(
+ _In_ LMSTR servername,
+ _In_ LMSTR device,
+ _Out_ LPDWORD type)
+{
+ NET_API_STATUS status;
+
+ TRACE("NetShareCheck(%s %s %p)\n",
+ debugstr_w(servername), debugstr_w(device), type);
+
+ RpcTryExcept
+ {
+ status = NetrShareCheck(servername,
+ device,
+ type);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetShareDel(
+ _In_ LMSTR servername,
+ _In_ LMSTR netname,
+ _In_ DWORD reserved)
+{
+ NET_API_STATUS status;
+
+ TRACE("NetShareDel(%s %s %lu)\n",
+ debugstr_w(servername), debugstr_w(netname), reserved);
+
+ if (netname == NULL || (*netname == 0) || reserved != 0)
+ return ERROR_INVALID_PARAMETER;
+
+ RpcTryExcept
+ {
+ status = NetrShareDel(servername,
+ netname,
+ reserved);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetShareDelSticky(
+ _In_ LMSTR servername,
+ _In_ LMSTR netname,
+ _In_ DWORD reserved)
+{
+ NET_API_STATUS status;
+
+ TRACE("NetShareDelSticky(%s %s %lu)\n",
+ debugstr_w(servername), debugstr_w(netname), reserved);
+
+ if (netname == NULL || (*netname == 0) || reserved != 0)
+ return ERROR_INVALID_PARAMETER;
+
+ RpcTryExcept
+ {
+ status = NetrShareDelSticky(servername,
+ netname,
+ reserved);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetShareEnum(
_In_ LMSTR servername,
_In_ DWORD level,
_Out_ LPBYTE *bufptr,
@@ -342,6 +480,108 @@
SHARE_INFO_502_CONTAINER Level502Container = {0, NULL};
NET_API_STATUS status;
+ TRACE("NetShareEnum(%s %lu %p %lu %p %p %p)\n",
+ debugstr_w(servername), level, bufptr, prefmaxlen,
+ entriesread, totalentries, resume_handle);
+
+ if (level > 2 && level != 502)
+ return ERROR_INVALID_LEVEL;
+
+ *bufptr = NULL;
+ *entriesread = 0;
+ *totalentries = 0;
+
+ EnumStruct.Level = level;
+ switch (level)
+ {
+ case 0:
+ EnumStruct.ShareInfo.Level0 = &Level0Container;
+ break;
+
+ case 1:
+ EnumStruct.ShareInfo.Level1 = &Level1Container;
+ break;
+
+ case 2:
+ EnumStruct.ShareInfo.Level2 = &Level2Container;
+ break;
+
+ case 502:
+ EnumStruct.ShareInfo.Level502 = &Level502Container;
+ break;
+ }
+
+ RpcTryExcept
+ {
+ status = NetrShareEnum(servername,
+ &EnumStruct,
+ prefmaxlen,
+ totalentries,
+ resume_handle);
+
+ switch (level)
+ {
+ case 0:
+ if (EnumStruct.ShareInfo.Level0->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level0->Buffer;
+ *entriesread = EnumStruct.ShareInfo.Level0->EntriesRead;
+ }
+ break;
+
+ case 1:
+ if (EnumStruct.ShareInfo.Level1->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level1->Buffer;
+ *entriesread = EnumStruct.ShareInfo.Level1->EntriesRead;
+ }
+ break;
+
+ case 2:
+ if (EnumStruct.ShareInfo.Level2->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level2->Buffer;
+ *entriesread = EnumStruct.ShareInfo.Level2->EntriesRead;
+ }
+ break;
+
+ case 502:
+ if (EnumStruct.ShareInfo.Level502->Buffer != NULL)
+ {
+ *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level502->Buffer;
+ *entriesread = EnumStruct.ShareInfo.Level502->EntriesRead;
+ }
+ break;
+ }
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ status = I_RpcMapWin32Status(RpcExceptionCode());
+ }
+ RpcEndExcept;
+
+ return status;
+}
+
+
+NET_API_STATUS
+WINAPI
+NetShareEnumSticky(
+ _In_ LMSTR servername,
+ _In_ DWORD level,
+ _Out_ LPBYTE *bufptr,
+ _In_ DWORD prefmaxlen,
+ _Out_ LPDWORD entriesread,
+ _Out_ LPDWORD totalentries,
+ _Inout_ LPDWORD resume_handle)
+{
+ SHARE_ENUM_STRUCT EnumStruct;
+ SHARE_INFO_0_CONTAINER Level0Container = {0, NULL};
+ SHARE_INFO_1_CONTAINER Level1Container = {0, NULL};
+ SHARE_INFO_2_CONTAINER Level2Container = {0, NULL};
+ SHARE_INFO_502_CONTAINER Level502Container = {0, NULL};
+ NET_API_STATUS status;
+
TRACE("NetShareEnumSticky(%s %lu %p %lu %p %p %p)\n",
debugstr_w(servername), level, bufptr, prefmaxlen,
entriesread, totalentries, resume_handle);