Jump to content

_WinAPI_ReadDirectoryChanges Error 58


Go to solution Solved by SkysLastChance,

Recommended Posts

When running the _WinAPI_ReadDirectoryChanges example on a network folder. I keep getting this error.

How can I tell what permisions I need to run this example on my netowrk folder at work?

It works fine when I run it on a local  drive folder. 

image.png.e43c97d8631d29426b066f7ef3d18968.png

#include <APIFilesConstants.au3>
#include <Array.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPIFiles.au3>
#include <WinAPIMem.au3>

Global $g_sPath = "J:\Folder\SubFolder1\SubFolder2"

Local $hDirectory = _WinAPI_CreateFileEx($g_sPath, $OPEN_EXISTING, $FILE_LIST_DIRECTORY, BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), $FILE_FLAG_BACKUP_SEMANTICS)
If @error Then
        _WinAPI_ShowLastError('', 1)
EndIf

Local $pBuffer = _WinAPI_CreateBuffer(8388608)

Local $aData
While 1
        $aData = _WinAPI_ReadDirectoryChanges($hDirectory, BitOR($FILE_NOTIFY_CHANGE_FILE_NAME, $FILE_NOTIFY_CHANGE_DIR_NAME), $pBuffer, 8388608, 1)
        If Not @error Then
                _ArrayDisplay($aData, '_WinAPI_ReadDirectoryChanges')
        Else
                _WinAPI_ShowLastError('', 1)
        EndIf
WEnd

 

Edit:

It seems I would have all of these as permissions.   

image.png.c67c851c3abd158fd276bf5eac2fba88.png

 

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Link to post
Share on other sites
  • Solution

I feel dumb. RTFM

"If the buffer is greater than 64 KB and the application is monitoring a directory over the network, the function fails.
This is due to a packet size limitation with the underlying file sharing protocols."

 

#include <APIFilesConstants.au3>
#include <Array.au3>
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIError.au3>
#include <WinAPIFiles.au3>
#include <WinAPIMem.au3>

Global $g_sPath = "J:\Folder\SubFolder1\SubFolder2"

Local $hDirectory = _WinAPI_CreateFileEx($g_sPath, $OPEN_EXISTING, $FILE_LIST_DIRECTORY, BitOR($FILE_SHARE_READ, $FILE_SHARE_WRITE), $FILE_FLAG_BACKUP_SEMANTICS)
If @error Then
        _WinAPI_ShowLastError('', 1)
EndIf

Local $pBuffer = _WinAPI_CreateBuffer(65536)

Local $aData
While 1
        $aData = _WinAPI_ReadDirectoryChanges($hDirectory, BitOR($FILE_NOTIFY_CHANGE_FILE_NAME, $FILE_NOTIFY_CHANGE_DIR_NAME), $pBuffer, 65536, 1)
        If Not @error Then
                _ArrayDisplay($aData, '_WinAPI_ReadDirectoryChanges')
        Else
                _WinAPI_ShowLastError('', 1)
        EndIf
WEnd


 

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Link to post
Share on other sites

If you made it to season 6. I would be willing to bet it won't be the last time you watch it. I have lost count on the number of times I have watched it all the way through. Majority of people say it drops off after season 7. However, I love them all. 

Edited by SkysLastChance

Life's simple. You make choices and you don't look back.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...