3

I am more experienced on the POSIX side and I am currently struggling with the Windows API.

I would like to find a single entry point for the documentation and I have yet not found the documentation for <wincon.h>. I also can't figure out how much of the standard headers (C99/C11) are available.

For exemple I can find winreg.h but not wincon.h (Error 404). On the RegDeleteKeyA documentation I can see the LSTATUS type but it is not documented.

What is the method to navigate through this API? Where is entry-point?

I agree that my question is somehow unclear, but my point is that I am looking for an equivalent of the man pages on Linux, but for the Windows API. The format is not important, I just need a manual.

More concrete examples:

  • Can I use int32_t on Windows? Where is it documented?
  • What is the definition of LSTATUS?
  • Where can I find some examples to read the registry using winreg? ...
nowox
  • 25,978
  • 39
  • 143
  • 293
  • There's a search button at the top right. It looks like LSTATUS isn't documented but you can look it up in the Windows headers. The important thing about the return value is that the possible codes are documented under "Return Value" in the page you linked, the type doesn't matter – M.M Jul 19 '19 at 11:05
  • 1
    googling the function name (with "winapi" if needed) is the fastest "entry point" in my experience :) this question covers LSTATUS, https://stackoverflow.com/questions/19547419/errors-in-windows-dword-getlasterror-vs-hresult-vs-lstatus – M.M Jul 19 '19 at 11:06
  • @M.M I also noticed `LSTATUS` is not available from the search box. I could indeed look at the headers, but I have not installed Visual Studio yet :( – nowox Jul 19 '19 at 11:06
  • Not sure what you are asking about regarding C99/C11 headers. That is completely separate to the Windows API. A C11-conforming compiler will come with C11 standard headers, etc. `int32_t` is provided by the major compilers that I'm aware of; it's an optional type in C11 and implementation-defined whether it exists but I would expect it exists for all compilers that support WinAPI programming – M.M Jul 19 '19 at 11:07
  • @M.M Well, I am confused too. I know that GLIBC or POSIX include C99 headers plus extra headers. I am expecting to find a single entry point of all I can use on Windows, so something like Windows Library = C11 headers + Windows.h + ... – nowox Jul 19 '19 at 11:10
  • 1
    Windows API is completely separate from C standard library. `#include ` gets you almost all of it – M.M Jul 19 '19 at 11:10
  • I agree, but the best documentation I found about `` is from [Wikipedia](https://en.wikipedia.org/wiki/Windows.h), I am expecting an equivalent on the Microsoft side... – nowox Jul 19 '19 at 11:18

2 Answers2

4

The entry point to Microsoft’s platform documentation is the MSDN library. It is (relatively; see comments) comprehensive.

  • Can I use int32_t on Windows? Where is it documented?

int32_t is not a platform type, it’s defined by the C and C++ core language. It’s probably documented somewhere in the MSDN library but I wouldn’t look it up there (that said, this is where you’d look up Microsoft C++ language extensions).

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
  • It is not defined neither by C or C++, but by the standard ISO/IEC which require a revision date and so `int32_t` was introduced with `ISO/IEC 9899:1999`. I could not find with which standard Windows is compliant to – nowox Jul 19 '19 at 11:13
  • @nowox “It is not defined neither by C or C++” — yes it is, you’re trying to split hairs but C *is* [defined by] ISO/IEC 9899:1999 in common parlance (and equivalent for C++). Your point about language compliance of the Microsoft compiler is valid, but this is in fact documented on the MSDN. – Konrad Rudolph Jul 19 '19 at 11:15
  • I looked at your MSDN library link but I could not find any information about `wincon.h` or `LSTATUS` :( – nowox Jul 19 '19 at 11:15
  • Do you have a link? – nowox Jul 19 '19 at 11:16
  • There is a search box at the top right of the page linked. Type in `LSTATUS` and `Enter` which returns lots of results to follow up. – Weather Vane Jul 19 '19 at 11:19
  • @nowox [Language definition](https://learn.microsoft.com/en-us/cpp/overview/languages-cpp?view=vs-2019), [`wincon.h`](https://learn.microsoft.com/en-us/windows/console/console-reference); `LSTATUS` I can’t find myself, I suspect the documentation might be missing. – Konrad Rudolph Jul 19 '19 at 11:19
  • 1
    @WeatherVane To be fair all these results are useless. – Konrad Rudolph Jul 19 '19 at 11:19
  • 3
    @nowox: As far as I know the MSVC compiler is not, and probably never will be, fully C99 compliant, let alone C11 compliant. C support has no priority for Microsoft (their own words). – DevSolar Jul 19 '19 at 11:20
  • Microsoft's documentation is sometimes incomplete or outdated. IMO, get the gist from the docs, but verify the details in the headers. – Eryk Sun Jul 21 '19 at 03:17
2

Second question:

What is the definition of LSTATUS?

Edit:

The Windows header file WinReg.h has this line

typedef __success(return==ERROR_SUCCESS) LONG LSTATUS;


A list of Windows type definitions can be found in Windows Data Types. The type LSTATUS is not listed. The nearest to be found is

LRESULT

Signed result of message processing.

This type is declared in WinDef.h as follows:

 typedef LONG_PTR LRESULT;
Weather Vane
  • 33,872
  • 7
  • 36
  • 56
  • LRESULT might be nearest in terms of the name but it is not close in usage (nor basic type!). – Anders Jul 20 '19 at 14:29
  • @Anders that is because I originally thought I found `LSTATUS` as a documented type and when I noticed my mistake I edited the answer and searched for `LSTATUS` definition. – Weather Vane Jul 20 '19 at 17:47