Back to index

lightning-sunbird  0.9+nobinonly
Static Public Attributes | Private Member Functions | Static Private Member Functions | Static Private Attributes | Friends
nsWinAPIs Class Reference

#include <nsWinAPIs.h>

List of all members.

Static Public Attributes

static nsSHGetPathFromIDList mSHGetPathFromIDList = nsSHGetPathFromIDListW
static nsGetSystemDirectory mGetSystemDirectory = GetSystemDirectoryW
static nsGetWindowsDirectory mGetWindowsDirectory = GetWindowsDirectoryW
static nsGetTempPath mGetTempPath = GetTempPathW
static nsGetEnvironmentVariable mGetEnvironmentVariable = GetEnvironmentVariableW
static nsCreateDirectory mCreateDirectory = CreateDirectoryW
static nsCreateFile mCreateFile = CreateFileW
static nsShellExecute mShellExecute = ShellExecuteW
static nsCopyFile mCopyFile = CopyFileW
static nsMoveFile mMoveFile = MoveFileW
static nsGetFileVersionInfo mGetFileVersionInfo = GetFileVersionInfoW
static nsGetFileVersionInfoSize mGetFileVersionInfoSize = GetFileVersionInfoSizeW
static nsGetFileAttributes mGetFileAttributes = GetFileAttributesW
static nsGetFileAttributesEx mGetFileAttributesEx = nsGetFileAttributesExW
static nsGetFileAttributesExA mGetFileAttributesExA = NULL
static nsGetShortPathName mGetShortPathName = GetShortPathNameW
static nsGetDiskFreeSpace mGetDiskFreeSpace = GetDiskFreeSpaceW
static nsGetDiskFreeSpaceEx mGetDiskFreeSpaceEx = nsGetDiskFreeSpaceExW
static nsGetModuleFileName mGetModuleFileName = GetModuleFileNameW
static nsGetCwd mGetCwd = _wgetcwd
static nsFopen mFopen = _wfopen
static nsGetDCwd mGetDCwd = _wgetdcwd
static nsRemove mRemove = _wremove
static nsRmdir mRmdir = _wrmdir
static nsChmod mChmod = _wchmod

Private Member Functions

 nsWinAPIs ()

Static Private Member Functions

static PRBool GlobalInit ()

Static Private Attributes

static PRBool sUseUnicode = -1
static PRBool sDummy = nsWinAPIs::GlobalInit()


NS_COM PRBool NS_UseUnicode ()
NS_COM void NS_StartupWinAPIs ()

Detailed Description

Definition at line 87 of file nsWinAPIs.h.

Constructor & Destructor Documentation

nsWinAPIs::nsWinAPIs ( ) [inline, private]

Definition at line 119 of file nsWinAPIs.h.


Member Function Documentation

PRBool nsWinAPIs::GlobalInit ( ) [static, private]

Definition at line 668 of file nsWinAPIs.cpp.

#ifndef WINCE
    // Find out if we are running on a unicode enabled version of Windows
    OSVERSIONINFOA osvi = {0};
    osvi.dwOSVersionInfoSize = sizeof(osvi);
    if (!GetVersionExA(&osvi)) {
      sUseUnicode = PR_FALSE;
    } else {
      sUseUnicode = (osvi.dwPlatformId >= VER_PLATFORM_WIN32_NT);

#ifdef DEBUG
  // In debug builds, allow explicit use of ANSI methods for testing purposes.
   if (getenv("WINAPI_USE_ANSI"))
       sUseUnicode = PR_FALSE;

    HINSTANCE kernel32 = ::GetModuleHandle("kernel32.dll");

    // on Win 9x/ME, use our own implementations of 'W' APIs
    // which eventually calls 'A' APIs
    if (!sUseUnicode) {
        NS_WARNING("Windows 'A' APIs will be used !!");
        mGetSystemDirectory = nsGetSystemDirectoryW;
        mGetWindowsDirectory = nsGetWindowsDirectoryW;
        mGetTempPath = nsGetTempPathW;
        mGetEnvironmentVariable = nsGetEnvironmentVariableW;
        mCreateFile = nsCreateFileW;
        mCreateDirectory = nsCreateDirectoryW;
        mShellExecute = nsShellExecuteW;
        mCopyFile = nsCopyFileW;
        mMoveFile = nsMoveFileW;
        mGetFileVersionInfo = nsGetFileVersionInfoW;
        mGetFileVersionInfoSize = nsGetFileVersionInfoSizeW;
        mGetFileAttributes = nsGetFileAttributesW;
        mGetShortPathName = nsGetShortPathNameW;
        mGetDiskFreeSpace = nsGetDiskFreeSpaceW;
        mGetModuleFileName = nsGetModuleFileNameW;
        mGetCwd = nsGetCwdW;
        mGetDCwd = nsGetDCwdW;
        mFopen  = nsFopenW;
        mRemove  = nsRemoveW;
        mRmdir  = nsRmdirW;
        mChmod  = nsChmodW;

        // absent on Win 95. 
        mGetFileAttributesExA = (nsGetFileAttributesExA)
            GetProcAddress(kernel32, "GetFileAttributesExA");
    else {
        HINSTANCE shell32 = LoadLibrary("Shell32.dll");
        if (shell32) 
            mSHGetPathFromIDList = (nsSHGetPathFromIDList)
                GetProcAddress(shell32, "SHGetPathFromIDListW");
        NS_ASSERTION(mSHGetPathFromIDList, "failed to get proc. address");
        mGetDiskFreeSpaceEx = (nsGetDiskFreeSpaceEx)
            GetProcAddress(kernel32, "GetDiskFreeSpaceExW");
        mGetFileAttributesEx = (nsGetFileAttributesEx)
            GetProcAddress(kernel32, "GetFileAttributesExW");
        if (!mGetFileAttributesEx)
            mGetFileAttributesEx = nsGetFileAttributesExW351;

#endif // WINCE
    return PR_TRUE;

Here is the call graph for this function:

Friends And Related Function Documentation

NS_COM PRBool NS_UseUnicode ( ) [friend]

Definition at line 738 of file nsWinAPIs.cpp.

Member Data Documentation

nsChmod nsWinAPIs::mChmod = _wchmod [static]

Definition at line 116 of file nsWinAPIs.h.

nsCopyFile nsWinAPIs::mCopyFile = CopyFileW [static]

Definition at line 98 of file nsWinAPIs.h.

nsCreateDirectory nsWinAPIs::mCreateDirectory = CreateDirectoryW [static]

Definition at line 95 of file nsWinAPIs.h.

nsCreateFile nsWinAPIs::mCreateFile = CreateFileW [static]

Definition at line 96 of file nsWinAPIs.h.

nsFopen nsWinAPIs::mFopen = _wfopen [static]

Definition at line 112 of file nsWinAPIs.h.

nsGetCwd nsWinAPIs::mGetCwd = _wgetcwd [static]

Definition at line 111 of file nsWinAPIs.h.

nsGetDCwd nsWinAPIs::mGetDCwd = _wgetdcwd [static]

Definition at line 113 of file nsWinAPIs.h.

nsGetDiskFreeSpace nsWinAPIs::mGetDiskFreeSpace = GetDiskFreeSpaceW [static]

Definition at line 106 of file nsWinAPIs.h.

nsGetDiskFreeSpaceEx nsWinAPIs::mGetDiskFreeSpaceEx = nsGetDiskFreeSpaceExW [static]

Definition at line 107 of file nsWinAPIs.h.

nsGetEnvironmentVariable nsWinAPIs::mGetEnvironmentVariable = GetEnvironmentVariableW [static]

Definition at line 94 of file nsWinAPIs.h.

nsGetFileAttributes nsWinAPIs::mGetFileAttributes = GetFileAttributesW [static]

Definition at line 102 of file nsWinAPIs.h.

nsGetFileAttributesEx nsWinAPIs::mGetFileAttributesEx = nsGetFileAttributesExW [static]

Definition at line 103 of file nsWinAPIs.h.

nsGetFileAttributesExA nsWinAPIs::mGetFileAttributesExA = NULL [static]

Definition at line 104 of file nsWinAPIs.h.

nsGetFileVersionInfo nsWinAPIs::mGetFileVersionInfo = GetFileVersionInfoW [static]

Definition at line 100 of file nsWinAPIs.h.

nsGetFileVersionInfoSize nsWinAPIs::mGetFileVersionInfoSize = GetFileVersionInfoSizeW [static]

Definition at line 101 of file nsWinAPIs.h.

nsGetModuleFileName nsWinAPIs::mGetModuleFileName = GetModuleFileNameW [static]

Definition at line 108 of file nsWinAPIs.h.

nsGetShortPathName nsWinAPIs::mGetShortPathName = GetShortPathNameW [static]

Definition at line 105 of file nsWinAPIs.h.

nsGetSystemDirectory nsWinAPIs::mGetSystemDirectory = GetSystemDirectoryW [static]

Definition at line 91 of file nsWinAPIs.h.

nsGetTempPath nsWinAPIs::mGetTempPath = GetTempPathW [static]

Definition at line 93 of file nsWinAPIs.h.

nsGetWindowsDirectory nsWinAPIs::mGetWindowsDirectory = GetWindowsDirectoryW [static]

Definition at line 92 of file nsWinAPIs.h.

nsMoveFile nsWinAPIs::mMoveFile = MoveFileW [static]

Definition at line 99 of file nsWinAPIs.h.

nsRemove nsWinAPIs::mRemove = _wremove [static]

Definition at line 114 of file nsWinAPIs.h.

nsRmdir nsWinAPIs::mRmdir = _wrmdir [static]

Definition at line 115 of file nsWinAPIs.h.

nsShellExecute nsWinAPIs::mShellExecute = ShellExecuteW [static]

Definition at line 97 of file nsWinAPIs.h.

Definition at line 90 of file nsWinAPIs.h.

Definition at line 128 of file nsWinAPIs.h.

PRBool nsWinAPIs::sUseUnicode = -1 [static, private]

Definition at line 121 of file nsWinAPIs.h.

The documentation for this class was generated from the following files: