Microsoft KB Archive/201426

= PRB: StgOpenStorage Does Not Send ACCESSDENIED Error on Novell =

Article ID: 201426

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Windows 95
 * Microsoft Windows 98 Standard Edition
 * Microsoft Windows NT 4.0

-



This article was previously published under Q201426



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:
 * 1) include 
 * 2) include 
 * 3) include 


 * 1) 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; }  }

}

Keywords: kb3rdparty kbnetwork kbprb KB201426

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.