An "ERROR_ACCESS_DENIED" error occurs when you try to write to a file that is in a network shared folder (842792)
The information in this article applies to:
- Microsoft Windows XP Professional SP1, when used with:
- the operating system: Microsoft Windows Server 2003
- the operating system: Microsoft Windows 2000
- Microsoft Windows XP Home Edition SP1, when used with:
- the operating system: Microsoft Windows Server 2003
- the operating system: Microsoft Windows 2000
Important This article contains information about modifying the registry.
Before you modify the registry, make sure to back it up and make sure that you
understand how to restore the registry if a problem occurs. For information
about how to back up, restore, and edit the registry, click the following
article number to view the article in the Microsoft Knowledge Base: 256986 Description of the Microsoft Windows Registry SYMPTOMSA call to the WriteFile function may not succeed. You experience this symptom when the following conditions are true: - You are using a client computer that is running Microsoft Windows XP
Service Pack 1 (SP1).
- You use the WriteFile function to try to write to a
file that is in a network shared folder.
- The shared folder is on a server computer that is running
either Microsoft Windows 2000 or Microsoft Windows Server 2003.
Additionally, you may receive the following error message: ERROR_ACCESS_DENIED CAUSEThis problem occurs when the following conditions are true:
- When you used the CreateFile function to create the
file, you specified only the GENERIC_WRITE constant in the dwDesiredAccess parameter.
- Server Message Block (SMB) signing is enabled for
communication between the client computer and the server computer.
WORKAROUNDTo work around this problem, use either of the following
methods:
- Specify the GENERIC_READ constant and the GENERIC_WRITE
constant in the dwDesiredAccess parameter.
- Modify SMB signing.
Specify the GENERIC_READ constant and the GENERIC_WRITE constant in the dwDesiredAccess parameterUse the following code to create the file. Note Replace
the following placeholders: - Replace the ServerName placeholder with the name of a server computer that
is running Windows 2000 or Windows Server 2003.
- Replace
the FolderName placeholder with the name of a network shared folder on
the server computer.
// Specify the GENERIC_READ constant and the GENERIC_WRITE constant
// in the dwDesiredAccess parameter when you create the file.
hFile = CreateFile("\\\\ServerName\\FolderName\\Test.txt", GENERIC_READ |
GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); Modify SMB signingWarning If you use Registry Editor incorrectly, you may cause serious
problems that may require you to reinstall your operating system. Microsoft
cannot guarantee that you can solve problems that result from using Registry
Editor incorrectly. Use Registry Editor at your own
risk. Follow these steps on the server computer and on the
client computer:
- In Registry Editor, locate and then click the following
registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\Parameters - In the right pane of Registry Editor, right-click
requiresecuritysignature in the Name field,
and then click Modify. The Edit DWORD Value
dialog box appears.
- In the Value data box, type
0, and then click OK.
- Quit Registry Editor, and then restart the computer.
REFERENCESFor more information about the CreateFile function and the
WriteFile function, visit the following Microsoft Developer Network (MSDN) Web
sites:
Modification Type: | Minor | Last Reviewed: | 2/18/2006 |
---|
Keywords: | kbClient kbprb kberrmsg kbRegistry kbkern32dll kbAPI kbSMB kbServer KB842792 kbAudDeveloper |
---|
|