In this patch I make 3 functions (FIXME): NetShareEnum, NetShareDel,
NetShareAdd

Files to change:
dlls/svrapi/svrapi_main.c
dlls/svrapi/svrapi.spec

--
Best Regards, Konstantin Petrov


--- dlls/svrapi/svrapi_main.c	2006-09-04 20:18:12 +0400
+++ dlls/svrapi/svrapi_main.c1	2006-09-04 20:19:10 +0400
@@ -53,3 +53,107 @@
     }
     return TRUE;
 }
+
+/***********************************************************************
+*  NetShareEnum retrieves information about each shared resource on a server, however,
+*  it does not enumerate hidden shares (for this use NetShareEnum) or 
+*  users connected to a share (for this use NetConnectionEnum).
+*
+*  pszServer      [in]   Points to the DNS or NetBIOS name of the remote server. If NULL,
+*                        the local computer is used.
+*  sLevel     [in]: 1    So the pbBuffer points to an array of share_info_1 structures.
+*                   50   So the pbBuffer points to an array of share_info_50 structures.
+*  pbBuffer       [out]  Points to the buffer that receives the data. The format depends on sLevel.
+*                        !!!The caller must allocate and deallocate this buffer!!!
+*  cbBuffer       [in]   For Win9x, specifies the size, in bytes, of the buffer pointed to by the pbBuffer.
+*                        Also the resume handle parameter is not available on Win9x.
+*  pcEntriesRead  [out]  Points to a counter of actually enumerated elements.
+*  pcTotalAvail   [out]  Points to the end quantity value of elements.
+*
+* RETURNS:
+*  NERR_Success            If function succeeds
+*  ERROR_MORE_DATA         If the buffer size is small to hold all entries
+*  any system error code   If fails
+*/
+ NET_API_STATUS WINAPI WIN98_NetShareEnum( const char* pszServer, short sLevel, char* pbBuffer, unsigned short cbBuffer, unsigned short* pcEntriesRead, unsigned short* pcTotalAvail)
+{
+       if((cbBuffer == 0) || (pbBuffer == NULL)) return ERROR_INVALID_DATA;
+
+       FIXME("Stub (%s %d %p %d %p %p)\n", debugstr_a(pszServer), sLevel, pbBuffer,
+             cbBuffer, pcEntriesRead, pcTotalAvail);
+       /* free memory myself */
+       HeapFree(GetProcessHeap(), 0, pbBuffer);  
+       pbBuffer = NULL;
+
+       *pcEntriesRead = 0;
+       *pcTotalAvail = 0;
+
+/*    return ERROR_NOT_SUPPORTED;*/
+    return NERR_Success;
+}
+
+/************************************************************************
+*  NetShareDel deletes a network share on either a local or remote machine,
+*  disconnecting all connections to the shared resource.
+*  
+*  pszServer    [in]      Points to the DNS or NetBIOS name of the remote server.
+*                         If NULL, the local computer is used.
+*  pszNetName   [in]      Points to the name of Share to delete
+*  usReserved   [in]      =0. Reserved.
+*
+* RETURNS:
+*  NERR_Success            If function succeeds
+*  ERROR_ACCESS_DENIED     If the user is restricted to access the requested information.
+*  ERROR_INVALID_PARAMETER If the specified parameter is invalid.
+*  ERROR_NOT_ENOUGH_MEMORY Insufficient memory is available.
+*  NERR_NetNameNotFound    If there is no such share name.
+*/
+ NET_API_STATUS WINAPI WIN98_NetShareDel( const char* pszServer, const char* pszNetName,
+ unsigned short usReserved )
+{
+       FIXME("Stub (%s %s %d)\n", (pszServer ? pszServer:"NULL"), (pszNetName ? pszNetName:"NULL"), usReserved );
+       if(usReserved != 0) return ERROR_INVALID_PARAMETER;
+       /*network computer*/
+       if(pszServer != NULL) return NERR_NetNameNotFound;
+       /*local computer*/
+       else return NERR_Success;
+}
+
+/************************************************************************
+*  NetShareAdd function shares a server resource or workstation resource.
+*
+*  pszServer    [in]      Points to the DNS or NetBIOS name of the remote server. If NULL,
+*                         the local computer is used.
+*  sLevel       [in]      Defines the format of the additional information about Share. In Win98 = 50. 
+*  pbBuffer     [in]      Points to a structure with additional info about Share. The format of this structure depends on the sLevel. 
+*                         This information includes the name, type of the resource, comment associated with the resource, passwords.
+*                         On NT,2000,XP the call can pass either a SHARE_INFO_2 or SHARE_INFO_502 structure. 
+*                         On Win9x machines must pass a SHARE_INFO_50 type. In addition, on 9x the string
+*                         specified in the shi50_path member can only be !!!upper case!!!
+*                         If the path contains lowercase characters,
+*                         calls to NetShareAdd can fail with NERR_UnknownDevDir or ERROR_BAD_NET_NAME.
+*  cbBuffer     [in]      In Windows 9x always = sizeof(struct share_info_50)
+*
+* RETURNS:
+*  NERR_Success            If function succeeds
+*  ERROR_INVALID_NAME      If the character or file system name is invalid.
+*  NERR_DuplicateShare     If The requested Share already exists on the specified server.
+*  NERR_RedirectedPath     If the specified device name is assigned to a shared resource.
+*  NERR_UnknownDevDir      If the directory or device does not exist.
+*  ERROR_ACCESS_DENIED     If the user is restricted to access the requested information.
+*  ERROR_INVALID_PARAMETER If the specified parameter is invalid.
+*  ERROR_INVALID_LEVEL     If the sLevel value is invalid.
+*/
+ NET_API_STATUS WINAPI WIN98_NetShareAdd(const char* pszServer,short sLevel,const char* pbBuffer,  unsigned short cbBuffer)
+{
+       FIXME("Stub (%s %d %s %d)\n", (pszServer ? pszServer:"NULL"), sLevel, (pbBuffer ? pbBuffer:"NULL"), cbBuffer);
+/*     if ((sLevel == 50) && (cbBuffer == sizeof(share_info_50))) real size of share_info_50 is not known*/
+       if ((sLevel == 50) && (cbBuffer != 0))
+       {
+           /*network computer*/
+               if(pszServer != NULL) return NERR_UnknownDevDir;
+               /*local computer*/
+               else return NERR_Success;
+       }
+       else return ERROR_INVALID_PARAMETER;
+}

--- dlls/svrapi/svrapi.spec	2006-09-04 20:21:47 +0400
+++ dlls/svrapi/svrapi.spec	2006-09-04 20:21:52 +0400
@@ -13,8 +13,8 @@
 @ stub NetSessionDel
 @ stub NetSessionEnum
 @ stub NetSessionGetInfo
-@ stub NetShareAdd
-@ stub NetShareDel
-@ stub NetShareEnum
+@ stdcall NetShareAdd(str long str long) WIN98_NetShareAdd
+@ stdcall NetShareDel(str str long) WIN98_NetShareDel
+@ stdcall NetShareEnum(str long ptr long ptr ptr) WIN98_NetShareEnum
 @ stub NetShareGetInfo
 @ stub NetShareSetInfo


Reply via email to