PRB: StgOpenStorage Does Not Send ACCESSDENIED Error on Novell

ID: Q201426


The information in this article applies to:

Novell Netware is manufactured by Novell, Inc., a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability.

SYMPTOMS

If the file's attribute is marked as Read Only on Windows NT Server, when you use the following:


   hr = StgOpenStorage(wcsName, NULL,

            STGM_SHARE_EXCLUSIVE | STGM_READWRITE,
            NULL, 0, &lpStg); 
a STG_E_ACCESSDENIED error is generated. This does not work, however, on Novell Netware Server when you use CSNW to connect to it.


RESOLUTION

Use GSNW instead of CSNW to connect to Novell Netware Server to solve this problem.


MORE INFORMATION

For example, the following code demonstrates that when the file's attribute is marked as Read Only, the open will fail the first time as expected on Windows NT Server, but it will succeed on Novell Netware Server when you use CSNW on both Windows 95 and Windows NT:


#include <stdio.h>
#include <windows.h>
#include <conio.h>

#define BUFFER_SIZE 256

void main(void)
{

   char szFileName[BUFFER_SIZE]="";
   OLECHAR wcsName[BUFFER_SIZE]=L"";
   LPSTORAGE lpStg=NULL;
   HRESULT hr=0;

   printf("Enter File name:");
   scanf("%s",szFileName);
   mbstowcs(wcsName, szFileName, strlen(szFileName) + 1);
   hr = StgOpenStorage(wcsName, NULL,

            STGM_SHARE_EXCLUSIVE | STGM_READWRITE,
            NULL, 0, &lpStg);

   printf(TEXT("StgOpenStorage 0x%0x\n"), hr);

   if (hr==S_OK){

      printf("S_OK first\n");
      getch();
      lpStg->Release();
      exit(0);

   }

   if (hr==STG_E_ACCESSDENIED){

      printf("STG_E_ACCESSDENIED\n");
      hr = StgOpenStorage(wcsName, NULL,
            STGM_READ | STGM_SHARE_DENY_WRITE,
            NULL, 0, &lpStg);

      printf(TEXT("StgOpenStorage 0x%0x\n"), hr);

      if (hr==S_OK){
         printf("S_OK second\n");
         getch();
         lpStg->Release();
      }
   }

} 

Additional query words:


Keywords          : kb3rdparty kbnetwork kbNTOS400 kbWinOS95 kbWinOS98 
Version           : WINDOWS:95; winnt:4.0
Platform          : WINDOWS winnt 
Issue type        : kbprb 

Last Reviewed: May 20, 1999