Problem is all of this things already were present in the question.
No, they aren't.
the shortest code necessary to reproduce the problem
This means: we should be able to copy and paste code out of your question, without adding or changing anything, compile and run, in order to see the exact problem you are describing, directly.
In particular:
Code in C++ doesn't run outside of functions, and programs require a main function; provide those.
This appears to be Windows API code; include the corresponding #include
lines.
Include a minimal amount of code needed to verify that the file is or is not being opened properly - for example, by reading something from the file.
Include any necessary setup instructions, like "put the IP of the remote machine here" or "have a file on the remote machine at such and such a path". Alexei's answer went into this in more detail.
What I've tried:
Instead of describing that you used such and such a function, show corresponding versions of the prior code with those modifications.
According to event log of remote machine, CreateFile
attempts to work with credentials of the user that started process.
Instead of describing this, show the apparent relevant part of the log. What does "work with" mean? What happened when it "attempted to work with" the credentials? Did it fail? Obviously if the credentials appear in plaintext in the log then censor that; but explain: did it use the credentials you expected it to use? Were they rejected? If so, where/by what system?
From comments:
I'm not unwilling, I just can't.
Then you do not have a question that Stack Overflow can answer. Frankly, there might not even be actual discussion forums that can properly answer the question. If the problem can only possibly be reproduced with sensitive information, then you should start by talking about the problem within your organization.
Please keep in mind that the purpose of Stack Overflow is not to resolve your individual issue, but to build a searchable Q&A library usable by others. This means, your question must be in a form that makes sense for others to look for with a search engine, read, and use to try to resolve their own issue.
#include
directives would be necessary. A .csproj file does not fit in the same category: it is not code (we need the necessary information in the question itself, so binary files in proprietary formats are not useful), and it is not relevant (it is only used by one specific compiler/IDE setup, and it is not necessary to use that compiler or IDE in order to create Windows programs).#include
it in the example. If the header is required and it's a library header for a common tool (standard library, third-party framework, etc...) that readers will need in order to be able to build your program, assume that the header will already be on their system. If it's one of your headers, strip it down to the bare essentials and build it directly into the example code.