???? ??? "ERROR_ACCESS_DENIED" ??? ?????? ??????? ??? ??? ?? ???? ???? ?????

?????? ????????? ?????? ?????????
???? ???????: 842792 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ??????? ??? ??????? ??? ????? ???????. ??? ????? ?????? ???? ?? ??? ???? ???????? ??????? ?? ???? ?????? ???????? ?? ???? ???? ?????. ?????? ??? ??????? ??? ????? ??? ???? ???????? ?? ????? ????????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
256986??? ????? Microsoft Windows
????? ???? | ?? ????

?? ??? ??????

???????

?? ?? ???? ??????? ?????? WriteFile. ????? ??? ?????? ??? ?????? ???????:
  • ??????? ???? ??????? ???? ???? ????? ??????? Microsoft Windows XP Service Pack 1 (SP1).
  • ??????? ???? WriteFile ?????? ??????? ??? ??? ?? ???? ???? ?????.
  • ???? ????? ??? ??????? ???? ???? ????? ??????? Microsoft Windows 2000 ?? ???? ??????? Windows Server 2003.
???????? ??? ???? ?? ???? ????? ????? ???????:
error_access_denied

?????

???? ??? ??????? ??? ?????? ???????:
  • ??? ??????? ???? CreateFile ?????? ????? ??????? ???? GENERIC_WRITE ?? ??????? dwDesiredAccess.
  • ??? ????? ????? Message Block (SMB) ?????? ??????? ??? ????????? ?????? ????? ????????? ??????.

???? ??????

??????? ?????? ??? ??? ??????? ?????? ???? ????? ???????:
  • ????? ???? GENERIC_READ ?? GENERIC_WRITE ????? ?? ??????? dwDesiredAccess.
  • ????? ????? SMB.

????? ???? GENERIC_READ ???? GENERIC_WRITE ?? ??????? dwDesiredAccess

??????? ????????? ???????? ??????? ?????? ?????.

?????? ?????? ??????? ??????? ???????:
  • ??????? ?????? ?????? ServerName ??? ??????? ???? ???? ????? ??????? Windows 2000 ?? Windows Server 2003.
  • ??????? ?????? ?????? FolderName ??? ???? ?????? ??????? ??? ??????? ??????.
// 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);

????? ????? SMB

????? ?? ???? ??????? "???? ???????" ?????? ??? ?????? ?? ???? ???? ?????? ????? ???? ????? ????? ???? ???????. ??? ???? Microsoft ?? ???????? ???? ???? ?? ??????? "???? ???????" ?????? ??? ?????. ?????? "???? ???????" ??? ???????? ??????.
???? ??????? ??????? ??? ????????? ?????? ? ??? ???? ????????? ??????:
  1. ??? ???? ?? "???? ???????" ? ?? ???? ??? ????? ??????? ?????? ??????:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\Parameters
  2. ?? ????? ?????? ?? "???? ???????" ? ???? ??? ?????? ?????? ??? requiresecuritysignature ?? ????? ??? ??? ?? ???? ??? ?????. ????? ???? DWORD ???? ???? ??????.
  3. ?? ?????? ?????? ?????? ? ???? 0 ?? ???? ??? ?????.
  4. ?? ?????? "???? ???????" ? ?? ?? ?????? ????? ???? ?????????.

??????? ????

????? ????? ????? ??????

  1. ??? ???? ??????? ???? ????? ??????? Windows XP SP1 ? ?????? Microsoft Visual C++ 6.0 ?????? ????? ????? ???? ?????? Win32 ???? ???? ??????. ?????????? ??? ????? ??? Test.cpp.
  2. ????? ??? ?????? ???? GENERIC_WRITE ?? ??????? dwDesiredAccess ??? ??????? ???? CreateFile.
  3. ?????? ?????? WriteFile ?????? ??????? ??? ?????. ?????? ????? ?? ???????? ????????? ???????? ???????? ?? ??? Test.cpp ???????? ???????? ???????.

    ?????? ?????? ??????? ??????? ???????:
    • ??????? ?????? ?????? ServerName ??? ??????? ???? ???? ????? ??????? Windows 2000 ?? Windows Server 2003.
    • ??????? ?????? ?????? FolderName ??? ???? ?????? ??????? ??? ??????? ??????.
    :
    #include "stdafx.h"
    #include "windows.h"
    #include "stdio.h"
    #include "conio.h"
    
    void main()
    {
        HANDLE hFile;
        char lpBuffer[99999];
        DWORD lpNumberOfBytesWritten;
    
        // Write data to the buffer that you will
        // you use to write data to the file.
        for (int i = 0; i < 100000; ++i)
            lpBuffer[i] = 'a';
    
        // Specify only the GENERIC_WRITE constant in the
        // dwDesiredAccess parameter when you create the file.
        hFile = CreateFile("\\\\ServerName\\FolderName\\Test.txt",
            GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
    
        // Try to write the data in the buffer to the file.
        // If the call to the WriteFile function fails,
        // call the GetLastError function.
        if (!WriteFile(hFile, lpBuffer, 100000, &lpNumberOfBytesWritten, NULL))
    
            // If an ERROR_ACCESS_DENIED error has occurred, inform the user.
            if (GetLastError() == ERROR_ACCESS_DENIED)
            {
                printf("An ERROR_ACCESS_DENIED error has occurred.");
                printf("Press any key to continue.");
                getch();
            }
    
        // Close the handle to the file.
        CloseHandle(hFile);
    }
  4. ????? ?? ?? ?????? ???????. ???? ???? ???? ????. ?? ???? ???? ??????? ???????? ?? ??? "???????" ???? ???? ?????? ????? ??? ??????? ??????:
    ??? ??? ERROR_ACCESS_DENIED.
    ???? ?? ????? ????????.

?????

????? ?? ????????? ??? ???? CreateFile ??????? WriteFile ?????? ????? ???? ????? Microsoft (MSDN) ?????? ??? ?????:
CreateFile
http://msdn2.microsoft.com/en-us/library/aa363858.aspx
WriteFile
http://msdn2.microsoft.com/en-us/library/aa365747.aspx

???????

???? ???????: 842792 - ????? ??? ??????: 27/?? ?????/1427 - ??????: 1.5
????? ???
  • Microsoft Windows XP Professional SP1, ????? ?????? ??:
    • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
    • the operating system: Microsoft Windows 2000
  • Microsoft Windows XP Home Edition SP1, ????? ?????? ??:
    • Microsoft Windows Server 2003, Standard Edition (32-bit x86)
    • the operating system: Microsoft Windows 2000
????? ??????: 
kbmt kbclient kbprb kberrmsg kbregistry kbkern32dll kbapi kbsmb kbserver KB842792 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????842792

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com