-6

Question CreateFile (share file) returns error 1326 was closed with reason

"Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem."

The problem is all of these things already were present in the question. I tried to edit the question to mark where exactly these points were, but there hasn't been any activity since.

If it's expected from me to write a question in some specific template, feel free to state it as the close reason and provide me with said template.

So my current question is: what is the real reason my question was closed?

15
  • 14
    Lack of debugging details. You're expected to provide a small program that does nothing but expose the bad behaviour, something that any other user on this site (with the correct tools and knowledge, of course) can drop into their tools and see the exact same thing you do. A single line of code is almost never enough context to solve a software problem. Commented May 23, 2023 at 20:03
  • 5
    it's quite possible that your problem isn't programmatic in nature at all. the error you're getting obviously indicates that the credentials you are using don't match the requirements of the target you are trying to access.
    – Kevin B
    Commented May 23, 2023 at 20:07
  • @user4581301 you mean you want includes, main and such?
    – Bogudan
    Commented May 23, 2023 at 20:15
  • @kevin-b same credentials is enough for Explorer to access same file...
    – Bogudan
    Commented May 23, 2023 at 20:16
  • 8
    A complete, runnable (unless the problem is a compiler error, in that case it should produce the compiler error you're asking about and as few other diagnostics as possible) program that is the bug, the whole bug, and nothing but the bug. But as Kevin points out, the problem could be a configuration issue at your end, and something we will not be able to reproduce. In that case the program will make that clear, and folks will ask for details on the system and its configuration. Commented May 23, 2023 at 20:24
  • @user4581301 should I also provide content of csproj file then?
    – Bogudan
    Commented May 23, 2023 at 20:39
  • The csproj would be uninformative. We need details on the security system preventing login, something you're (below) rightly wary to reveal on the internet. Commented May 23, 2023 at 21:01
  • @user4581301 in this case how list of includes will be informative to you?
    – Bogudan
    Commented May 23, 2023 at 21:03
  • 6
    It's not the list of includes. It's the ability to drop the program into your tools without changing a thing. Everything a potential answerer has to change is a point at which they can insert and report on a new mistake or accidentally fix the mistake. Heck, sometimes the mistake even turns out to be In toolchain X, iostream includes string and the asker's using toolchain Y which does not. But in the end, every detail you add makes it less likely for some pedantic bastard to go "Can't compile." Closevote. Downvote. Commented May 23, 2023 at 21:38
  • 7
    "What is the real reason my question was closed?" - Three experienced users, voted to close your question, after it received your last substantial edit. The edit you made after the question was closed and selected that it should be reviewed to be reopen, was not substantial. Your comments suggest you are trying to create a file on a network share the process does not have access to, since the user had not been authenticated, when you attempt to create the file. What authentication happens outside of the code by your application is immaterial to that of the process. Commented May 23, 2023 at 21:54
  • 1
    Keep in mind your question is still in the reopen queue and hasn't been reviewed to be reopened at this time. The queue that contains questions to be reopened has a substantial number of reviews ahead of your request. Commented May 23, 2023 at 21:58
  • 4
    "in this case how list of includes will be informative to you?" No matter what compiler we use to try the code, the #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). Commented May 24, 2023 at 0:03
  • @karl-knechtel should I then include text of includes I use?
    – Bogudan
    Commented May 24, 2023 at 5:03
  • 2
    No, because if we use an ordinary compiler, the #include statement will bring in the standard library. If you use a third-party library you should explain how it is installed; if you use a platform library like the Windows API you should say that you use it. But you should have the #include statement because it is text that will be needed in a valid source code file. Commented May 24, 2023 at 5:12
  • 2
    This is where we start getting back into minimal. If the problem can be demonstrated without a header, don't #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. Commented May 24, 2023 at 19:46

3 Answers 3

14

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.

6
  • 3
    Actually, none of these are strict requirements. It would be very unusual to close a question because they posted a snippet of C++ code without a small amount of boilerplate to run it, as it's expected anyone answering a C++ question knows how to add it.
    – user20574
    Commented May 24, 2023 at 2:08
  • 6
    "you do not have a question that Stack Overflow can answer" is a very relevant point to many people who are frustrated their question is closed - Stack Overflow does not really attempt to answer every question but actually only certain kinds of questions
    – user20574
    Commented May 24, 2023 at 2:11
  • 5
    No. Questions don't have to be copy-pasteable, runnable programs. That adds way too much irrelevant details. A tag indicating it's about Windows gives enough context already. The non-repro part here really is the network and security setup.
    – CodeCaster
    Commented May 24, 2023 at 6:10
  • 1
    @CodeCaster - Which goes back to the fact, if the author cannot even properly reproduce it with a MRE, how could anyone in the community do so. Commented May 24, 2023 at 11:51
  • 2
    @SecurityHound correct, a question should contain enough information to reproduce the problem, but that is not necessarily an entire, runnable program. Karl suggests that every C++ question must include a main() function and be copy-pasteable and runnable, to which I don't agree. See my answer to "What feedback should I give if a post doesn't have import statements?" for more context.
    – CodeCaster
    Commented May 24, 2023 at 12:03
  • 4
    I agree with the comments, but I still upvote this based on the statement "Then you do not have a question that Stack Overflow can answer" which is really what it is all about. Having personal issues and stress is unfortunate, but it doesn't give you a free pass on this particular website. Most other websites though, no problem. Success not guaranteed and probably low chance but you're free to try.
    – Gimby
    Commented May 24, 2023 at 12:59
14

An MRE includes not just code, but also input and output, where the input may include non-trivial amounts of environment information.

In the particular case of the linked question, it clearly indicates that the problem is with permissions or authentication. As a result, you are expected to understand that showing just code is not enough. It looks like you attempted to provide some information (stating that after the initial authentication, Windows Explorer remembers the credentials and uses them later), but the question does not provide useful names of users.

This is roughly information that needs to be in the question:

  • code runs on Machine1
  • The code runs under account {Machine1\User1 | Domain1\User1 | NETWORK SERVICE | IUSR (or any other IIS-related accounts | something else }
  • The process runs under account {...} if there is impersonation involved (that should not be the case for the MRE, but good for your own verification.
  • The file is located on Machine2 (or Machine1) on the {same | different | Internet} network
  • The share requires { Machine2\User2 | Domain1\User2 | Domain2\User2 | something else} user permissions

I personally think the code portion is ok (everyone remotely familiar with Win32 should be able to get that code to compile). Making runnable code would be nice, but it is not going to add real information to the question.

9
  • I can't provide big chunk of actual information for security reasons. Only environment where I can try to reproduce this issue is at work and most information about out corporate network is a thing under non-disclosure agreement. And if I try to obfuscate, it will be looking almost word in word as you wrote.
    – Bogudan
    Commented May 23, 2023 at 20:48
  • 11
    So... you are explicitly saying you are unwilling to provide information that is necessary to reproduce the problem and yet you disagree with the close reason... You either need to find a way to repro with public information or hire contractor to solve your problem. I believe your comment explains you why the question is closed currently. Commented May 23, 2023 at 20:54
  • give me two windows machines for 2 days :) I'm not unwilling, I just can't. I don't want to loose my job yet. And I don't see connection between my comment and closure reason.
    – Bogudan
    Commented May 23, 2023 at 20:57
  • That's pretty much unwilling, but with a good reason backing it up. Can't would be if you'd left your hands at home and you couldn't type effectively with your toes yet. Commented May 23, 2023 at 21:00
  • 11
    @Bogudan "Can't" - if it is not possible to reproduce the error the question make no value for SO. (Also it is strange that in the same comment you hinted that if community will pay for 2 Windows machines for you the repo potentially can be created... I'm confused how that aligns with the fact you can't create the repro - also it's hard to argue if someone would just gift me couple PC :) ) Commented May 23, 2023 at 21:35
  • @SecurityHound indeed I can create environment where such error happens - how that would help OP or improve the question? (We really expected not to rewrite a question to our liking even if I personally don't support this policy) Commented May 23, 2023 at 23:21
  • 2
    Sorry, my comment was really toward the author, who indicated saying a complete MRE wasn't possible. I must have gotten confused by the comment order. Commented May 23, 2023 at 23:48
  • 2
    (What is "ISRUSR"? Not "IUSR"? (related to IIS)) Commented May 24, 2023 at 9:06
  • @PeterMortensen good point - was trying to remember the right name but clearly got mixed up the letters :) . Indeed intended as IIS account - learn.microsoft.com/en-us/iis/get-started/planning-for-security/… Commented May 24, 2023 at 16:40
6

I've just come across this in the review queue... 🤔

I think you are correct that the closure reason does not apply here, though not for the reasons you think. Even though it seems like a debugging question at first glance (mainly due to the title pointing at a specific error) it is not one: it is clear what fails and why. Rather, the question is (explicitly!) asking how to perform such an operation with non-default credentials.

There is no need to provide a MRE for How To questions!

I have edited the title to remove the red herring that indicated this were a debugging question.

As far as I can tell, it is clear what operation is the context as well as what specific additional behaviour it asks about. This looks like a well-defined How To question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .