SkysLastChance Posted October 12, 2022 Share Posted October 12, 2022 (edited) 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. #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. Edited October 12, 2022 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
Solution SkysLastChance Posted October 14, 2022 Author Solution Share Posted October 14, 2022 (edited) 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 October 14, 2022 by SkysLastChance You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
KaFu Posted October 14, 2022 Share Posted October 14, 2022 64 * 1024 Byte = 65.536 Byte 👍🏻 SkysLastChance 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 14, 2022 Author Share Posted October 14, 2022 @KaFuThank you! Edited. KaFu 1 You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
KaFu Posted October 14, 2022 Share Posted October 14, 2022 P.S.: I’m currently binging The Office on Netflix, at the end of season 6 😉 SkysLastChance 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
SkysLastChance Posted October 14, 2022 Author Share Posted October 14, 2022 (edited) 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 October 14, 2022 by SkysLastChance KaFu 1 You miss 100% of the shots you don't take. -Wayne Gretzky -Michael Scott Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now