![]() |
|
[C] ntdll!ntquerydirectoryfile, how initialize buffer? - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] ntdll!ntquerydirectoryfile, how initialize buffer? (/showthread.php?tid=6132404) |
ntdll!ntquerydirectoryfile, how initialize buffer? - poker - Jan 8, 2021 Hi to all, I'm using NtQueryDirectoryFile from ntdll (userland mode)to get all items in a specific path. This is the official documentation Code __kernel_entry NTSYSCALLAPI NTSTATUS NtQueryDirectoryFile(I dont know whats is the correct way to initialize FileInformation param, because, if i create a variable in stack, like this: Code char buffer[100000];It's working, but when i call this function in a recursive way(for example, if i want to delete all item in a desired path), like this example i have a bad_alloc exception 😭😭😭 Code function RemoveInPath(path){In this code i can have multiples array_items and this Code char buffer[100000];I was looking myself, but i cant find the solution (i cannot post links): - ExAllocatePool - I think this only can be used in kernel mode - WCHAR Buffer[8192] - why 8192 ?? There are a maximum size for this param? In other sites i saw something like this: if you want, for example _FILE_BOTH_DIR_INFORMATION: - _FILE_BOTH_DIR_INFORMATION* buff = 512 * sizeof(_FILE_BOTH_DIR_INFORMATION); - Why 512? Thanks for reading |