Ok so, im making this programm that lets me access and write in a usb device. Im having this problem that, when i try to run the WriteFile( hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped ); it doenst work and returns 5 if i do the GetLastErrror(). If consulted manny foruns in the web and pretty much they all say that i need to run it as admin, but im admin and i set the compiler to run as admin, and the project too... so what am i doing wrong? Hanny help would be much appreciated!
C++ WriteFile doesnt work and returns 5 ( GetLastError() ), even tho i have admin permition
357 Views Asked by thecner At
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in LOW-LEVEL
- Where exactly is the first data sector on a FAT file system?
- how to write a large value > 32 bits with a format string exploit %n
- Why is there low-level and high-level assembly
- C# Key and mouse hook not working on excel
- Parsing SQLite file columns without sqlite3.h header file
- How can you get a DEVICE_OBJECT from the name of the device?
- On Windows, intercepts and change a click event system-wide
- Workaround for "use of variable before deduction of auto"
- How is asynchronous programming implemented under the hood without continuous cheching?
- Address translation of a instruction of multiple bytes
- How to set buttons and leds using addresses in mips assembly?
- static link ffmpeg to rust binary
- Bochs Panicing After Not Finding Speaker In WSL
- C# does the compiler leave re-references in the final binary?
- Sanitizing static freestanding nolibc programs?
Related Questions in WRITEFILE
- Time Delay while sending data through UART using WriteFile intervally for some duration
- Writing large buffer data to a file using Windows API
- The problem with writing a file with the with open construction
- Issue with Writing to File in x64 Assembly using MASM on Windows
- Receiving multiples files from server
- save in own format imagej or imagej2
- Microsoft Detours hook WriteFile
- Problem related to appending the objects in the serialization process
- Store a data stream on hard disk in Windows
- C# using a method from a class to another class, instance, DependencyProperty.Register error
- Electron app restarts automatically after calling fs.writeFile method
- How can multiple processes append to a Windows Terminal Server Client file without overwriting?
- UNBUFFERED READWRITE with Win32 API in C++
- Writing to file gives me other result when I use dictionary values in Python
- how to append comma inbetween json file in cypress
Related Questions in GETLASTERROR
- I need the macro to apply only to a range of cells
- Pymem Could not read memory at: , length: 4 - GetLastError: 299
- ctypes.get_last_error doesn't work but Win32 API call works
- How to add data to txt file in C?
- Why Microsoft Error Message uses the word "Token"?
- Direct writing a disk results in error code 5 according to GetLastError
- GetLastError returns 6 after call to WinHttpOpenRequest
- Handling WinAPI error return values
- WinHttpSendRequest and ERROR_WINHTTP_RESEND_REQUEST
- List of GetLastError() error codes for every winapi function
- WinAPI - GetLastError always returns 0 when called via a COM ATL DLL
- Compilations involving `std::string` cause Windows error status
- Why am I receiving 67 code from QOSStartTrackingClient method?
- C++ WriteFile doesnt work and returns 5 ( GetLastError() ), even tho i have admin permition
- What's the meaning of the error value 0x16f returned by the GetLastError() function
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Admin doesn't mean you have all permissions. Check if admin has write permissions on the file. As admin, you can either add write permissions or (if that doesn't work) take ownership and then add write permissions to admin and switch ownership back to the previous owner.