Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
wutil.cpp File Reference
#include "precompiled.h"
#include "lib/sysdep/os/win/wutil.h"
#include <stdio.h>
#include <stdlib.h>
#include "lib/file/file.h"
#include "lib/posix/posix.h"
#include "lib/sysdep/sysdep.h"
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/os/win/wdbg.h"
#include <shlobj.h>
#include <SDL_loadso.h>
#include <SDL_syswm.h>
Include dependency graph for wutil.cpp:

Functions

void * wutil_Allocate (size_t size)
 
void wutil_Free (void *p)
 
void wutil_Lock (WinLockId id)
 
void wutil_Unlock (WinLockId id)
 
bool wutil_IsLocked (WinLockId id)
 
static void InitLocks ()
 
static void ShutdownLocks ()
 
Status StatusFromWin ()
 
static OsPath GetFolderPath (int csidl)
 
OsPath wutil_LocalAppdataPath ()
 
OsPath wutil_RoamingAppdataPath ()
 
OsPath wutil_PersonalPath ()
 
Status wutil_SetPrivilege (const wchar_t *privilege, bool enable)
 
HMODULE wutil_LibModuleHandle ()
 
void wutil_SetAppWindow (SDL_Window *window)
 
void * wutil_GetAppHDC ()
 
void wutil_SetAppWindow (void *hwnd)
 
HWND wutil_AppWindow ()
 
void wutil_EnableHiDPIOnWindows ()
 
Status wutil_Init ()
 
Status wutil_Shutdown ()
 

Variables

static CRITICAL_SECTION cs [NUM_CS]
 
static bool cs_valid
 
static HWND hAppWindow
 

Function Documentation

◆ GetFolderPath()

static OsPath GetFolderPath ( int  csidl)
static

◆ InitLocks()

static void InitLocks ( )
static

◆ ShutdownLocks()

static void ShutdownLocks ( )
static

◆ StatusFromWin()

Status StatusFromWin ( )
Returns
the Status equivalent of GetLastError(), or ERR::FAIL if there's no equivalent. SetLastError(0) should be called before the Windows function to make sure no stale errors are returned.

◆ wutil_Allocate()

void * wutil_Allocate ( size_t  size)

◆ wutil_AppWindow()

HWND wutil_AppWindow ( )
Returns
handle to the first window owned by the current process, or 0 if none exist (e.g. it hasn't yet created one).

enumerates all top-level windows and stops if PID matches. once this function returns a non-NULL handle, it will always return that cached value.

◆ wutil_EnableHiDPIOnWindows()

void wutil_EnableHiDPIOnWindows ( )

◆ wutil_Free()

void wutil_Free ( void *  p)

◆ wutil_GetAppHDC()

void * wutil_GetAppHDC ( )

◆ wutil_Init()

Status wutil_Init ( )

◆ wutil_IsLocked()

bool wutil_IsLocked ( WinLockId  id)

◆ wutil_LibModuleHandle()

HMODULE wutil_LibModuleHandle ( )
Returns
module handle of lib code (that of the main EXE if linked statically, otherwise the DLL). this is necessary for the error dialog.

◆ wutil_LocalAppdataPath()

OsPath wutil_LocalAppdataPath ( )

◆ wutil_Lock()

void wutil_Lock ( WinLockId  id)

◆ wutil_PersonalPath()

OsPath wutil_PersonalPath ( )

◆ wutil_RoamingAppdataPath()

OsPath wutil_RoamingAppdataPath ( )

◆ wutil_SetAppWindow() [1/2]

void wutil_SetAppWindow ( SDL_Window window)

◆ wutil_SetAppWindow() [2/2]

void wutil_SetAppWindow ( void *  hwnd)

◆ wutil_SetPrivilege()

Status wutil_SetPrivilege ( const wchar_t *  privilege,
bool  enable 
)

◆ wutil_Shutdown()

Status wutil_Shutdown ( )

◆ wutil_Unlock()

void wutil_Unlock ( WinLockId  id)

Variable Documentation

◆ cs

CRITICAL_SECTION cs[NUM_CS]
static

◆ cs_valid

bool cs_valid
static

◆ hAppWindow

HWND hAppWindow
static