[svrapi 2/2] realizes 3 functions of svrapi.dll

2006-09-08 Thread Петров Константин

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]: 1So 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_SuccessIf 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_SuccessIf 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_NetNameNotFoundIf 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_SuccessIf function succeeds
+*  ERROR_INVALID_NAME  If the character or file system name is invalid.
+*  NERR_DuplicateShare 

Re: [svrapi 2/2] realizes 3 functions of svrapi.dll

2006-09-08 Thread Steven Edwards
On 9/8/06, Frank Richter <[EMAIL PROTECTED]> wrote:
Hm, but wouldn't "didn't look at MSDN" also include "rewording"? Toreword something, you need to look at the original, after all. So in thestrictest interpretation, it looks to me that only "clean-room docs"
(infer the documentation by looking at the source code) would be acceptable.As far as I understand US and Internation Copyright law the interface cannot be copywritten so it would be permissable to look at the documentation
when learning how to implement the function and then closing your browser and writting the documentation from memory. At least thats how it was explained to me at the first wineconf. Its a stretch I know but there is nothing legally that I can tell that prevents the developer from reading the API documentation and later writting his own documentation. IANAL so take that with a grain of salt. Perhaps the standard should be that the same developer that writes the API cannot document it. Julliards point of view seems to be when you write the interface your free to look at MSDN however don't write the API docs at the same time. Go back later, look at what you have done and base your documentation on your own work.
-- Steven Edwards"There is one thing stronger than all the armies in the world, and that is an idea whose time has come." - Victor Hugo



Re: [svrapi 2/2] realizes 3 functions of svrapi.dll

2006-09-08 Thread Frank Richter
On 08.09.2006 17:20, Steven Edwards wrote:
> On 9/8/06, Alexandre Julliard <[EMAIL PROTECTED]> wrote:
>> Since many people don't seem to understand this, from now on I'm going
>> to reject all patches that add documentation, unless the submitter
>> explicitly mentions that he didn't look at MSDN to write it. I'm sorry
>> to penalize people who do the right thing, but I can't continue to
>> waste time checking every single doc patch against MSDN.
> 
> "NOTE: When submitting documentation changes, you must clearly state
> that when creating your patch that you did not copy the function
> documentation from MSDN. When implementing a new function it is fine
> to look at the API documentation on MSDN however the api documentation
> must be written in your own words."

Hm, but wouldn't "didn't look at MSDN" also include "rewording"? To
reword something, you need to look at the original, after all. So in the
strictest interpretation, it looks to me that only "clean-room docs"
(infer the documentation by looking at the source code) would be acceptable.

-f.r.




Re: [svrapi 2/2] realizes 3 functions of svrapi.dll

2006-09-08 Thread Steven Edwards

On 9/8/06, Alexandre Julliard <[EMAIL PROTECTED]> wrote:

Since many people don't seem to understand this, from now on I'm going
to reject all patches that add documentation, unless the submitter
explicitly mentions that he didn't look at MSDN to write it. I'm sorry
to penalize people who do the right thing, but I can't continue to
waste time checking every single doc patch against MSDN.


I've updated the IMPLEMENTING NEW API CALLS section of the DEVELOPER
HINTS on the wiki to reflect this new policy change in the example
section

"NOTE: When submitting documentation changes, you must clearly state
that when creating your patch that you did not copy the function
documentation from MSDN. When implementing a new function it is fine
to look at the API documentation on MSDN however the api documentation
must be written in your own words."


--
Steven Edwards

"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo




Re: [svrapi 2/2] realizes 3 functions of svrapi.dll

2006-09-08 Thread Alexandre Julliard
Петров Константин <[EMAIL PROTECTED]> writes:

> +/
> +*  The NetShareDel function deletes a share name from a server's list of 
> shared resources,
> +*  disconnecting all connections to the shared resource.
> +*  servername
> +*  pszServer[in]  Pointer to a string that specifies the DNS or 
> NetBIOS name of the remote
> +* server on which the function is to execute. If 
> this parameter is NULL,
> +* the local computer is used.
> +*  pszNetName   [in]  Pointer to a string that specifies the name of the 
> share to delete.
> +*  usReserved   [in]  Reserved, must be zero.
> +*/

This documentation is copied straight from MSDN, that's not
acceptable.

Since many people don't seem to understand this, from now on I'm going
to reject all patches that add documentation, unless the submitter
explicitly mentions that he didn't look at MSDN to write it. I'm sorry
to penalize people who do the right thing, but I can't continue to
waste time checking every single doc patch against MSDN.

-- 
Alexandre Julliard
[EMAIL PROTECTED]




[svrapi 2/2] realizes 3 functions of svrapi.dll

2006-09-04 Thread Петров Константин
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,75 @@
 }
 return TRUE;
 }
+
+/***
+ */
+ 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);
+   HeapFree(GetProcessHeap(), 0, pbBuffer);
+   pbBuffer = NULL;
+
+   /**bufptr = NULL;*/
+
+   *pcEntriesRead = 0;
+   *pcTotalAvail = 0;
+
+/*return ERROR_NOT_SUPPORTED;*/
+return NERR_Success;
+}
+
+/
+*  The NetShareDel function deletes a share name from a server's list of shared resources,
+*  disconnecting all connections to the shared resource.
+*  servername
+*  pszServer[in]  Pointer to a string that specifies the DNS or NetBIOS name of the remote
+* server on which the function is to execute. If this parameter is NULL,
+* the local computer is used.
+*  pszNetName   [in]  Pointer to a string that specifies the name of the share to delete.
+*  usReserved   [in]  Reserved, must be zero.
+*/
+ 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;
+}
+
+/
+  The NetShareAdd function shares a server resource.
+*
+*
+*  pszServer[in]  Pointer to a string that specifies the DNS or NetBIOS name of the remote
+* server on which the function is to execute. If this parameter is NULL,
+* the local computer is used.
+*  sLevel   [in] = 50 Specifies information about the shared resource, including the name and
+* type of the resource, a comment associated with the resource, and
+* passwords. The pbBuffer parameter points to a share_info_50 structure.
+* Note that the string you specify in the shi50_path member must contain
+* only uppercase characters. If the path contains lowercase characters,
+* calls to NetShareAdd can fail with NERR_UnknownDevDir or ERROR_BAD_NET_NAME.
+*  pbBuffer [in]  Pointer to the buffer that specifies the data. The format of this data
+* depends on the value of the level parameter
+*  cbBuffer [in]  = sizeof(struct share_info_50);
+*/
+ 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