csutil/win32/wintools.h File Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Classes | Enumerations | Functions
csutil/win32/wintools.h File Reference

Win32 tool functions. More...

`#include "csextern.h"`
`#include "csutil/csunicode.h"`
`#include "csutil/util.h"`
`#include <winnls.h>`
`#include "sanity.inc"`

Go to the source code of this file.

## Classes
struct | cswinCtoA
| Small helper to convert an UTF-8 to an ANSI string, useful when passing arguments to a function. More...
struct | cswinWtoA
| Small helper to convert a wide to an ANSI string, useful when passing arguments to a function. More...
## Enumerations
enum | cswinWindowsVersion { cswinWin9x = 30, cswinWinNT = 40, cswinWin2K = 50, cswinWinXP = 51, cswinWin2003 = 52, cswinWinVista = 60 }
| Windows versions cswinIsWinNT() can identify. More...
## Functions
static wchar_t * | cswinAnsiToWide (const char *ansi, UINT codePage=CP_ACP)
| Convert an ANSI string to a wide string.
char * | cswinGetErrorMessage (HRESULT code)
| Retrieve the system's description for an error code.
wchar_t * | cswinGetErrorMessageW (HRESULT code)
| Retrieve the system's description for an error code.
bool | cswinIsWinNT (cswinWindowsVersion *version=0)
| Returns 'true' if the current Windows is from the NT strain, 'false' if from the 9x strain.
static char * | cswinWideToAnsi (const wchar_t *wide, UINT codePage=CP_ACP)
| Convert a wide string to an ANSI string.

## Detailed Description

Win32 tool functions.

Definition in file wintools.h.

## Enumeration Type Documentation

enum cswinWindowsVersion

Windows versions cswinIsWinNT() can identify.

Enumerator:

  cswinWin9x | Windows 95/98/ME.
  cswinWinNT | Windows NT 4.0.
  cswinWin2K | Windows 2000.
  cswinWinXP | Windows XP.
  cswinWin2003 | Windows Server 2003.
  cswinWinVista | Windows Vista (or newer)

Definition at line 161 of file wintools.h.

## Function Documentation

static wchar_t* cswinAnsiToWide | ( | const char * | ansi,
|  | UINT | codePage = `CP_ACP`
| ) |  | `[inline, static]`

Convert an ANSI string to a wide string.

Remarks:
  Free the returned pointer with delete[].
  This function provides functionality specific to the Win32 platform. To ensure that code using this functionality compiles properly on all other platforms, the use of the function and inclusion of the header file should be surrounded by appropriate '#if defined(CS_PLATFORM_WIN32) ... #endif' statements.

Definition at line 41 of file wintools.h.

char* cswinGetErrorMessage | ( | HRESULT | code | ) |

Retrieve the system's description for an error code.

Parameters:

  code | The error code, usually retrieved through GetLastError().

Remarks:
  Returns an UTF-8 encoded string.
  Free the returned pointer with delete[].
  This function provides functionality specific to the Win32 platform. To ensure that code using this functionality compiles properly on all other platforms, the use of the function and inclusion of the header file should be surrounded by appropriate ' '#if defined(CS_PLATFORM_WIN32) ... #endif' statements.

wchar_t* cswinGetErrorMessageW | ( | HRESULT | code | ) |

Retrieve the system's description for an error code.

Parameters:

  code | The error code, usually retrieved through GetLastError().

Remarks:
  Free the returned pointer with delete[].
  This function provides functionality specific to the Win32 platform. To ensure that code using this functionality compiles properly on all other platforms, the use of the function and inclusion of the header file should be surrounded by appropriate ' '#if defined(CS_PLATFORM_WIN32) ... #endif' statements.

bool cswinIsWinNT | ( | cswinWindowsVersion * | version = `0` | ) |

Returns 'true' if the current Windows is from the NT strain, 'false' if from the 9x strain.

Parameters:

  version | Optionally returns more specifically what Windows is used.

Returns:
  Whether the current OS is an Windows NT derivate.

Remarks:
  This function provides functionality specific to the Win32 platform. To ensure that code using this functionality compiles properly on all other platforms, the use of the function and inclusion of the header file should be surrounded by appropriate ' '#if defined(CS_PLATFORM_WIN32) ... #endif' statements.

static char* cswinWideToAnsi | ( | const wchar_t * | wide,
|  | UINT | codePage = `CP_ACP`
| ) |  | `[inline, static]`

Convert a wide string to an ANSI string.

Remarks:
  Free the returned pointer with delete[].
  This function provides functionality specific to the Win32 platform. To ensure that code using this functionality compiles properly on all other platforms, the use of the function and inclusion of the header file should be surrounded by appropriate ' '#if defined(CS_PLATFORM_WIN32) ... #endif' statements.

Definition at line 65 of file wintools.h.