8

I have asked a question on how to delete a non-deleteable file in Windows, asking for "any chance to delete this file in Shell or C++". I tagged the question and .

A user provided an answer using NT Native API functions (NtOpenFile etc.) and was criticized that this would not answer the question as written. This was not a restriction that I intended to imply, though.

My questions:

  • If only the tags and were used, would this imply that I am (1) looking for any C++ solution using any API or (2) looking only for ISO C++ solutions?

  • If the tag is additionally used, does this mean that answers are restricted to Windows API (not ISO C++, not NT API) solutions?

  • Would it be best to include the tag for all C++/Windows questions for which Native API solutions should not be expressly discouraged?

12
  • 1
    Yes, if you tag a question with [winapi] then answers ought to restrict themselves to the winapi. But they chose to ignore the tag, the problem did not exactly match the tag. They ought to have removed the tag. There is pushback because this programming style is unboring but pretty unwise, Vista is getting to be a fading memory. Bigger problem I see is that when you ask a programmer to solve a problem then he tends to think only of a program to solve it. Superuser.com is the best place to get help with regaining control over your machine, 5 minutes and you're back in business. Commented Oct 13, 2017 at 15:58
  • Maybe I haven't looked carefully enough at the question, but I'm not seeing what Vista has to do with anything, @Hans. Are you just implying that the Windows API is deprecated and shouldn't be targeted anymore?
    – Cody Gray Mod
    Commented Oct 13, 2017 at 16:06
  • 2
    @Cody - the opposite. The native API can change with a WIndows update, Vista was the last major version update that made heavy changes to it. A big reason why it was so popular. The winapi doesn't change. Judging from the questions, there isn't anything very subtle about Creator's edition either btw, some rainy day I'll have to stop clicking "not now". Commented Oct 13, 2017 at 16:10
  • 2
    you ask very concrete question - how delete wrong created file on your comp. the simplest way from my look - do single api call ZwDeleteFile. and here at all no sense discuss about - documented-not documented, can - can not changed etc. need once simply delete file and all. this is not program which need support and which need work on many comps. tags here only hints for get attention to problem
    – RbMm
    Commented Oct 13, 2017 at 16:31
  • 1
    @RbMm: Stack Overflow is not a forum. It's a Q&A site, that tries to gather solutions to programming problems. That database should be of value to anybody, not just the OP. The tags on this question communicated a clear constraint: Use the Windows API. Tags do not serve as hints to get the attention. Tags are a queryable part of a question, to more easily find relevant solutions. Commented Oct 13, 2017 at 17:14
  • @IInspectable - was concrete problem - i give concrete and the best answer how delete file - ZwDeleteFile and all. and this is also winapi. because this is only exported api function from some user mode dll. what different between kernel32.DeleteFile and ntdll.ZwDeleteFile ? only in name of dll and function. if DeleteFile is winapi - NtDeleteFile too
    – RbMm
    Commented Oct 13, 2017 at 17:22
  • 3
    @RbMm: The specific question was tagged winapi. ZwDeleteFile isn't part of the Windows API. How this is wired up internally is an implementation detail, that is deliberately undocumented. Given the constraints of the question, you didn't provide the best answer. In fact, given the constraints, you didn't even provide a sufficient answer. You need to spend more time at the help center to learn, what Stack Overflow is about. If you are more comfortable with Russian, try this instead. Commented Oct 13, 2017 at 17:29
  • 1
    @IInspectable - why ZwDeleteFile isn't part of the Windows API ? because you say this ? i say that ZwDeleteFile this is also win api. you not reply what is different between kernel32.DeleteFile and ntdll.ZwDeleteFile ? and ZwDeleteFile very well documented for use in both kernel and user mode
    – RbMm
    Commented Oct 13, 2017 at 17:36
  • 1
    @RbMm: ZwDeleteFile isn't part of the Windows API, because it isn't listed in the Windows API Index. The difference between ZwDeleteFile and DeleteFile is, that one is part of the Windows API and the other isn't. A question being tagged winapi thus cannot use one, but can use the other. Commented Oct 13, 2017 at 18:07
  • @IInspectable - and so what that not listed ? ntdl.dll is the same kind of dll as any another . functions is exported from it in absolute the same way as from any another dll. no any difference here at all. so this is win api. if from another side i say - create kernel mode driver, call api from ntoskrnl.exe - this is already not win api but kernel mode
    – RbMm
    Commented Oct 13, 2017 at 18:12
  • 2
    @RbMm: When asked to pick a number from the set {2, 3, 5, 7, 11, 13}, and someone decides to 'pick' 8, then surely, that someone didn't honor the constraints. That someone is going to argue, that 8 is an equally good choice. It's a non-fractional number, positive, falls within the same range, and so on. The problem is, that that someone simply didn't see, what's special about the set of numbers to choose from. Commented Oct 13, 2017 at 18:20
  • @IInspectable - user asked any way for delete file more easy than use linux. he not ask do this strictly by kernel32 api. so what you wrote is unrelated
    – RbMm
    Commented Oct 13, 2017 at 18:50

1 Answer 1

19

Certain users try and make tagging too complicated. It has especially been a problem in the tag, leading to extended discussions in comments and lots of soul-searching. Resist the temptation to read too much into a tag. Tagging your question with a language tag means that you are writing code in that language. In the case of the tag, it means that you are running your code through a C++ compiler.

A tag absolutely does not imply anything about ISO standard C++. It just means you're writing C++. Additional context is provided by the other tags you use on your question. A tag means you intended for that C++ code to run on Windows, so Windows-specific idioms and APIs are acceptable.

For typical Windows programming questions, you would want to use a tag corresponding to the GUI toolkit that you're using, or if you are targeting the Windows API directly, use the tag.

It is a rare case indeed where you would tag a question with the tag, but if you actually are targeting that API, then yes, use the tag. If you're writing the code to run through a C++ compiler, then also tag it with . I think what was confusing in your case is that you generally don't write C++ code when targeting the NT Native API. Many of the C++ language features are inappropriate, so you restrict yourself to what is essentially the subset of C++ that corresponds to C. That still doesn't mean you're writing C, though. If it runs through a C++ compiler, it's C++, even if it's a subset of C++ that looks very much like C.

Note that in your case, you were not targeting the NT Native API, so the tag would not have been appropriate. There's a user-mode solution for your problem, and it was the one you were actually looking for. RbMm's depth of knowledge sometimes leads him to propose killing flies with a bazooka, thinking nothing of the consequences because he understands and knows how to deal with them. Or just doesn't care about the problems with calling intentionally undocumented, non-public APIs. You just wanted a regular solution that would be compiled in .

0

You must log in to answer this question.

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