Back to index

lightning-sunbird  0.9+nobinonly
Typedefs | Functions
nsWinAPIs.cpp File Reference
#include "nscore.h"
#include "nsString.h"
#include "nsNativeCharsetUtils.h"
#include "nsWinAPIs.h"
#include <windows.h>
#include <winerror.h>
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#include <direct.h>

Go to the source code of this file.

Typedefs

typedef BOOL(WINAPI * fpGetDiskFreeSpaceExA )(LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes)

Functions

static void ConvertArg (LPCWSTR str, nsCAutoString &cstr, const char *(&ptr))
template<class T >
static PRBool SetLengthAndCheck (T &aStr, DWORD aLen)
BOOL WINAPI nsSHGetPathFromIDListW (LPCITEMIDLIST aIdList, LPWSTR aPathW)
UINT WINAPI nsGetSystemDirectoryW (LPWSTR aPathW, UINT aSize)
UINT WINAPI nsGetWindowsDirectoryW (LPWSTR aPathW, UINT aSize)
DWORD WINAPI nsGetTempPathW (DWORD aLen, LPWSTR aPathW)
DWORD WINAPI nsGetEnvironmentVariableW (LPCWSTR aName, LPWSTR aValue, DWORD aSize)
BOOL WINAPI nsCreateDirectoryW (LPCWSTR aPath, LPSECURITY_ATTRIBUTES aSecAttr)
HANDLE WINAPI nsCreateFileW (LPCWSTR aPath, DWORD aAccess, DWORD aMode, LPSECURITY_ATTRIBUTES aSecAttr, DWORD aCreat, DWORD aFlags, HANDLE aTemplate)
HINSTANCE WINAPI nsShellExecuteW (HWND aWin, LPCWSTR aOp, LPCWSTR aFile, LPCWSTR aParam, LPCWSTR aDir, INT aShowCmd)
BOOL WINAPI nsCopyFileW (LPCWSTR aSrc, LPCWSTR aDest, BOOL aNoOverwrite)
BOOL WINAPI nsMoveFileW (LPCWSTR aSrc, LPCWSTR aDest)
BOOL WINAPI nsGetFileVersionInfoW (LPCWSTR aPath, DWORD aHandle, DWORD aLen, LPVOID aData)
DWORD WINAPI nsGetFileVersionInfoSizeW (LPCWSTR aPath, LPDWORD aHandle)
DWORD WINAPI nsGetFileAttributesW (LPCWSTR aPath)
BOOL WINAPI nsGetFileAttributesExW (LPCWSTR aPath, GET_FILEEX_INFO_LEVELS aLevel, LPVOID aInfo)
BOOL WINAPI nsGetFileAttributesExW351 (LPCWSTR aPath, GET_FILEEX_INFO_LEVELS aLevel, LPVOID aInfo)
DWORD WINAPI nsGetShortPathNameW (LPCWSTR aLPath, LPWSTR aSPath, DWORD aLen)
BOOL WINAPI nsGetDiskFreeSpaceW (LPCWSTR aDir, LPDWORD aSpC, LPDWORD aBpS, LPDWORD aNFC, LPDWORD aTNC)
BOOL WINAPI nsGetDiskFreeSpaceExW (LPCWSTR aDir, PULARGE_INTEGER aFBA, PULARGE_INTEGER aTNB, PULARGE_INTEGER aTNFB)
DWORD WINAPI nsGetModuleFileNameW (HMODULE aModule, LPWSTR aName, DWORD aSize)
wchar_t * nsGetCwdW (wchar_t *aBuf, int aMaxLen)
wchar_t * nsGetDCwdW (int aDrive, wchar_t *aBuf, int aMaxLen)
FILEnsFopenW (const wchar_t *aPath, const wchar_t *aMode)
int nsRemoveW (const wchar_t *aPath)
int nsRmdirW (const wchar_t *aPath)
int nsChmodW (const wchar_t *aPath, int aMode)
NS_COM PRBool NS_UseUnicode ()

Typedef Documentation

typedef BOOL(WINAPI * fpGetDiskFreeSpaceExA)(LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes)

Definition at line 429 of file nsWinAPIs.cpp.


Function Documentation

static void ConvertArg ( LPCWSTR  str,
nsCAutoString cstr,
const char *&  ptr 
) [inline, static]

Definition at line 57 of file nsWinAPIs.cpp.

{
    if (str) {                                                
        NS_CopyUnicodeToNative(nsDependentString(str), cstr);
        ptr = cstr.get();
    }                                                        
    else                                                     
        ptr = NULL;                                          
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 738 of file nsWinAPIs.cpp.

Here is the caller graph for this function:

int nsChmodW ( const wchar_t *  aPath,
int  aMode 
)

Definition at line 582 of file nsWinAPIs.cpp.

{
    if (!aPath) return -1;

    nsCAutoString pathA;
    NS_CopyUnicodeToNative(nsDependentString(aPath), pathA);

    return _chmod(pathA.get(), aMode);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL WINAPI nsCopyFileW ( LPCWSTR  aSrc,
LPCWSTR  aDest,
BOOL  aNoOverwrite 
)

Definition at line 219 of file nsWinAPIs.cpp.

{
    nsCAutoString src, dest;
    const char *pSrc, *pDest;

    ConvertArg(aSrc, src, pSrc);
    ConvertArg(aDest, dest, pDest);

    return CopyFileA(pSrc, pDest, aNoOverwrite);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL WINAPI nsCreateDirectoryW ( LPCWSTR  aPath,
LPSECURITY_ATTRIBUTES  aSecAttr 
)

Definition at line 178 of file nsWinAPIs.cpp.

{
    if (!aPath) {
        SetLastError(ERROR_BAD_ARGUMENTS);
        return FALSE;
    }

    nsCAutoString pathA;
    NS_CopyUnicodeToNative(nsDependentString(aPath), pathA);
    return CreateDirectoryA(pathA.get(), aSecAttr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

HANDLE WINAPI nsCreateFileW ( LPCWSTR  aPath,
DWORD  aAccess,
DWORD  aMode,
LPSECURITY_ATTRIBUTES  aSecAttr,
DWORD  aCreat,
DWORD  aFlags,
HANDLE  aTemplate 
)

Definition at line 190 of file nsWinAPIs.cpp.

{
    if (!aPath) {
        SetLastError(ERROR_BAD_ARGUMENTS);
        return INVALID_HANDLE_VALUE;
    }

    nsCAutoString pathA;
    NS_CopyUnicodeToNative(nsDependentString(aPath), pathA);
    return CreateFileA(pathA.get(), aAccess, aMode, aSecAttr, aCreat, 
                       aFlags, aTemplate);
}

Here is the call graph for this function:

Here is the caller graph for this function:

FILE* nsFopenW ( const wchar_t *  aPath,
const wchar_t *  aMode 
)

Definition at line 551 of file nsWinAPIs.cpp.

{
    if (!aPath) return NULL;

    nsCAutoString pathA;
    NS_CopyUnicodeToNative(nsDependentString(aPath), pathA);

    return fopen(pathA.get(),
                 NS_LossyConvertUTF16toASCII(aMode).get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

wchar_t* nsGetCwdW ( wchar_t *  aBuf,
int  aMaxLen 
)

Definition at line 485 of file nsWinAPIs.cpp.

{
    if (aMaxLen <= 0)
        return NULL;

    // One 16-bit unit in UTF-16 can take as many as 2 bytes in legacy Windows 
    // codepage used on Windows 9x/ME (note that we don't have to worry about
    // UTF-8 and GB18030 because they're not used on Windows 9x/ME)
    char *cwdA = _getcwd(NULL, aMaxLen * 2);
    if (!cwdA)
        return NULL;

    // see if we're given a buffer large enough to hold the result
    int len = NS_ConvertAtoW(cwdA, 0, aBuf);
    if ((len  > aMaxLen && aBuf) || len == 0) {
        free(cwdA);
        return NULL;
    }

    if (!aBuf)
        // errno = ENOMEM;
        aBuf = (wchar_t *) malloc(len * sizeof(wchar_t));

    if (!aBuf) {
        free(cwdA);
        return NULL;
    }

    len = NS_ConvertAtoW(cwdA, NS_MAX(len, aMaxLen), aBuf); 
    free(cwdA);
    return len ? aBuf : NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

wchar_t* nsGetDCwdW ( int  aDrive,
wchar_t *  aBuf,
int  aMaxLen 
)

Definition at line 518 of file nsWinAPIs.cpp.

{
    if (aMaxLen <= 0)
        return NULL;

    // One 16-bit unit in UTF-16 can take as many as 2 bytes in legacy Windows codepage
    // used on Windows 9x/ME (note that we don't have to worry about 
    // UTF-8 and GB18030 because they're not used on Windows 9x/ME)
    char *cwdA = _getdcwd(aDrive, NULL, aMaxLen * 2);
    if (!cwdA)
        return NULL;

    // see if we're given a buffer large enough to hold the result
    int len = NS_ConvertAtoW(cwdA, 0, aBuf);
    if ((len  > aMaxLen && aBuf) || len == 0) {
        //errno = ERANGE;
        free(cwdA);
        return NULL;
    }

    if (!aBuf)
        aBuf = (wchar_t *) malloc(len * sizeof(wchar_t));

    if (!aBuf) {
        free(cwdA);
        return NULL;
    }

    len = NS_ConvertAtoW(cwdA, NS_MAX(len, aMaxLen), aBuf); 
    free(cwdA);
    return len ? aBuf : NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL WINAPI nsGetDiskFreeSpaceExW ( LPCWSTR  aDir,
PULARGE_INTEGER  aFBA,
PULARGE_INTEGER  aTNB,
PULARGE_INTEGER  aTNFB 
)

Definition at line 434 of file nsWinAPIs.cpp.

{
    // Attempt to check disk space using the GetDiskFreeSpaceExA function. 
    // --- FROM MSDN ---
    // The GetDiskFreeSpaceEx function is available beginning with Windows 95 OEM Service 
    // Release 2 (OSR2). To determine whether GetDiskFreeSpaceEx is available, call 
    // GetModuleHandle to get the handle to Kernel32.dll. Then you can call GetProcAddress. 
    // It is not necessary to call LoadLibrary on Kernel32.dll because it is already loaded 
    // into every process address space.
    fpGetDiskFreeSpaceExA pGetDiskFreeSpaceExA = (fpGetDiskFreeSpaceExA)
        GetProcAddress(GetModuleHandle("kernel32.dll"), "GetDiskFreeSpaceExA");
    if (!pGetDiskFreeSpaceExA)
        return 0;

    nsCAutoString dir;
    const char *pDir;
    ConvertArg(aDir, dir, pDir);
    return pGetDiskFreeSpaceExA(pDir, aFBA, aTNB, aTNFB);
}

Here is the call graph for this function:

BOOL WINAPI nsGetDiskFreeSpaceW ( LPCWSTR  aDir,
LPDWORD  aSpC,
LPDWORD  aBpS,
LPDWORD  aNFC,
LPDWORD  aTNC 
)

Definition at line 420 of file nsWinAPIs.cpp.

{
    nsCAutoString dir;
    const char *pDir;
    ConvertArg(aDir, dir, pDir);
    return GetDiskFreeSpaceA(pDir, aSpC, aBpS, aNFC, aTNC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD WINAPI nsGetEnvironmentVariableW ( LPCWSTR  aName,
LPWSTR  aValue,
DWORD  aSize 
)

Definition at line 143 of file nsWinAPIs.cpp.

{

    if (!aName || !aValue || aSize <= 0)
        return 0;

    nsCAutoString nameA;
    NS_CopyUnicodeToNative(nsDependentString(aName), nameA); 

    const DWORD maxValueLen = 32767; // the maximum length of an env. variable
    nsCAutoString value;
    DWORD sizeA = NS_MIN(maxValueLen, aSize * 2);
    if (!SetLengthAndCheck(value, sizeA))
        return 0;
    char *buf = value.BeginWriting();
    DWORD len;
    if (!(len = GetEnvironmentVariableA((char*)nameA.get(), buf, sizeA)))
        return 0;

    if (len > sizeA) {
        if (sizeA < maxValueLen) {
            if (!SetLengthAndCheck(value, len))
                return 0;
            buf = value.BeginWriting();
            len = GetEnvironmentVariableA((char*)nameA.get(), buf, len);
        }
        else 
            // sizeA >= maxValueLen and still failed. 
            return 0;
    }

    // terminating null is not included in the length
    return (len = NS_ConvertAtoW(buf, aSize, aValue)) ? len - 1 : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL WINAPI nsGetFileAttributesExW ( LPCWSTR  aPath,
GET_FILEEX_INFO_LEVELS  aLevel,
LPVOID  aInfo 
)

Definition at line 279 of file nsWinAPIs.cpp.

{
    NS_ASSERTION(aLevel == GetFileExInfoStandard, "invalid level specified");
#ifndef WINCE
    NS_ASSERTION(nsWinAPIs::mCopyFile != CopyFileW, 
                 "Win APIs pointers are reset to the stubs of 'W' APIs");
#endif
    nsCAutoString path;
    const char *pPath;
    ConvertArg(aPath, path, pPath);

    // present on Win 98/ME
    if (nsWinAPIs::mGetFileAttributesExA)
#ifdef DEBUG_jungshik
    {
        BOOL rv = nsWinAPIs::mGetFileAttributesExA(pPath, aLevel, aInfo);
        if (!rv) {
            printf("nsGetFileAttributesExW with file=%s failed\n", pPath);
            printf("Last error is %d\n", GetLastError());
        }
        return rv;
    }
#else
        return nsWinAPIs::mGetFileAttributesExA(pPath, aLevel, aInfo);
#endif
    // fallback for Win95 without IE4 or later where GetFileAttributesEx 
    // is missing. 
    
    if (aLevel != GetFileExInfoStandard) {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    // FindFirstFile expands wildcard characters so that we need to make
    // sure that the path contains no wildcard.
    if (NULL != wcspbrk(aPath, L"?*")) 
        return FALSE;

    WIN32_FIND_DATAA fdata;
    HANDLE handle = FindFirstFileA(pPath, &fdata);
    if (handle == INVALID_HANDLE_VALUE)
        return FALSE;
    // XXX : FindFirstFile doesn't work with a root directory
    // or a path ending with a slash/back slash.
    // We can work around it as in NSPR (w95io.c), but don't bother
    // because Windows 95 without IE4 or later is a rare beast so that
    // it's not worth duplicating ~40 lines of the NSPR code here to 
    // support a path ending with a slash/back slash or a root path. 
    // Note that even MS's emulation of GetFileAttributesEx for Win95
    // (included in Visual C++) doesn't, either.

    WIN32_FILE_ATTRIBUTE_DATA *fadata= 
        (WIN32_FILE_ATTRIBUTE_DATA *) aInfo;

    fadata->dwFileAttributes = fdata.dwFileAttributes;
    fadata->ftCreationTime = fdata.ftCreationTime;
    fadata->ftLastAccessTime = fdata.ftLastAccessTime;
    fadata->ftLastWriteTime = fdata.ftLastWriteTime;
    fadata->nFileSizeHigh = fdata.nFileSizeHigh;
    fadata->nFileSizeLow = fdata.nFileSizeLow;

    FindClose(handle);
    return TRUE;
}   

Here is the call graph for this function:

BOOL WINAPI nsGetFileAttributesExW351 ( LPCWSTR  aPath,
GET_FILEEX_INFO_LEVELS  aLevel,
LPVOID  aInfo 
)

Definition at line 345 of file nsWinAPIs.cpp.

{
    NS_ASSERTION(aLevel == GetFileExInfoStandard, "invalid level specified");
    if (aLevel != GetFileExInfoStandard) {
        SetLastError(ERROR_INVALID_PARAMETER);
        return FALSE;
    }

    // FindFirstFile expands wildcard characters so that we need to make
    // sure that the path contains no wildcard.
    if (NULL != wcspbrk(aPath, L"?*")) 
        return FALSE;

    WIN32_FIND_DATAW fdata;
    HANDLE handle = FindFirstFileW(aPath, &fdata);
    if (handle == INVALID_HANDLE_VALUE)
        return FALSE;

    WIN32_FILE_ATTRIBUTE_DATA *fadata = 
        (WIN32_FILE_ATTRIBUTE_DATA *) aInfo;

    fadata->dwFileAttributes = fdata.dwFileAttributes;
    fadata->ftCreationTime = fdata.ftCreationTime;
    fadata->ftLastAccessTime = fdata.ftLastAccessTime;
    fadata->ftLastWriteTime = fdata.ftLastWriteTime;
    fadata->nFileSizeHigh = fdata.nFileSizeHigh;
    fadata->nFileSizeLow = fdata.nFileSizeLow;

    FindClose(handle);
    return TRUE;
}   

Here is the caller graph for this function:

DWORD WINAPI nsGetFileAttributesW ( LPCWSTR  aPath)

Definition at line 271 of file nsWinAPIs.cpp.

{
    nsCAutoString path;
    const char *pPath;
    ConvertArg(aPath, path, pPath);
    return GetFileAttributesA(pPath);
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD WINAPI nsGetFileVersionInfoSizeW ( LPCWSTR  aPath,
LPDWORD  aHandle 
)

Definition at line 263 of file nsWinAPIs.cpp.

{
    nsCAutoString path;
    const char *pPath;
    ConvertArg(aPath, path, pPath);
    return GetFileVersionInfoSizeA(pPath, aHandle);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL WINAPI nsGetFileVersionInfoW ( LPCWSTR  aPath,
DWORD  aHandle,
DWORD  aLen,
LPVOID  aData 
)

Definition at line 254 of file nsWinAPIs.cpp.

{
    nsCAutoString path;
    const char *pPath;
    ConvertArg(aPath, path, pPath);
    return GetFileVersionInfoA(pPath, aHandle, aLen, aData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD WINAPI nsGetModuleFileNameW ( HMODULE  aModule,
LPWSTR  aName,
DWORD  aSize 
)

Definition at line 455 of file nsWinAPIs.cpp.

{
    if (!aName || aSize <= 0) {
        SetLastError(ERROR_BAD_ARGUMENTS);
        return 0;
    }

    DWORD len;
    char buf[MAX_PATH + 1];
    if (!(len = GetModuleFileNameA(aModule, buf, MAX_PATH)))
        return 0;
    // just in case, null-terminate
    buf[MAX_PATH] = '\0';

    len = NS_ConvertAtoW(buf, 0, aName);
    if (len <= aSize) 
        return (len = NS_ConvertAtoW(buf, aSize, aName)) ? len - 1 : 0;

    // buffer is not large enough. just truncate the result to the first
    // |aSize| characters.
    nsAutoString temp;
    if (!SetLengthAndCheck(temp, len))
        return 0;
    PRUnichar *pTmp = temp.BeginWriting();
    NS_ConvertAtoW(buf, len, pTmp);
    memcpy(aName, pTmp, aSize * 2);
    SetLastError(ERROR_INSUFFICIENT_BUFFER);
    return aSize;
}

Here is the call graph for this function:

Here is the caller graph for this function:

DWORD WINAPI nsGetShortPathNameW ( LPCWSTR  aLPath,
LPWSTR  aSPath,
DWORD  aLen 
)

Definition at line 379 of file nsWinAPIs.cpp.

{
    if (!aLPath || !aSPath) {
        SetLastError(ERROR_BAD_ARGUMENTS);
        return 0;
    }

    nsCAutoString lPath;
    NS_CopyUnicodeToNative(nsDependentString(aLPath), lPath);

    // MAX_PATH is the max path length including the terminating null.
    if (lPath.Length() >= MAX_PATH) {
        SetLastError(ERROR_BAD_ARGUMENTS);
        return 0;
    }

    nsCAutoString sPath;
    if (!SetLengthAndCheck(sPath, aLen))
        return 0;
    char *pSpath = sPath.BeginWriting();
    DWORD lenA = GetShortPathNameA(lPath.get(), pSpath, aLen);
    if (lenA > aLen) {
        if (!SetLengthAndCheck(sPath, lenA))
            return 0;
        pSpath = sPath.BeginWriting();
        lenA = GetShortPathNameA(lPath.get(), pSpath, lenA);
    }

    if (!lenA) 
        return 0;

    // see if |aSPath| is large enough to hold the result
    DWORD lenW = NS_ConvertAtoW(pSpath, 0, aSPath);
    if (lenW > aLen)
        // aSPath is too small. just return the required size.
        return lenW; 

    // terminating null is not included in the return value
    return (lenW = NS_ConvertAtoW(pSpath, aLen, aSPath)) ? lenW - 1 : 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

UINT WINAPI nsGetSystemDirectoryW ( LPWSTR  aPathW,
UINT  aSize 
)

Definition at line 102 of file nsWinAPIs.cpp.

{
    char pathA[MAX_PATH];
    int len;

    if (aPathW && GetSystemDirectoryA(pathA, MAX_PATH) < MAX_PATH && 
        (len = NS_ConvertAtoW(pathA, aSize, aPathW)))
        return len - 1; // terminating null is not included
    else 
        return 0;
}

Here is the caller graph for this function:

DWORD WINAPI nsGetTempPathW ( DWORD  aLen,
LPWSTR  aPathW 
)

Definition at line 126 of file nsWinAPIs.cpp.

{
#ifdef WINCE
    char *pathA = "\\temp";
    DWORD len = NS_ConvertAtoW(pathA, aLen, aPathW);
    return len-1;
#else
    char pathA[MAX_PATH];
    DWORD len;
    if (aPathW && GetTempPathA(MAX_PATH, pathA) < MAX_PATH &&
        (len = NS_ConvertAtoW(pathA, aLen, aPathW)))
        return len - 1; // terminating null is not included
    return 0;
#endif
}

Here is the caller graph for this function:

UINT WINAPI nsGetWindowsDirectoryW ( LPWSTR  aPathW,
UINT  aSize 
)

Definition at line 114 of file nsWinAPIs.cpp.

{
    char pathA[MAX_PATH];
    int len;

    if (aPathW && GetWindowsDirectoryA(pathA, MAX_PATH) < MAX_PATH && 
        (len = NS_ConvertAtoW(pathA, aSize, aPathW)))
        return len - 1; // terminating null is not included
    else 
        return 0;
}

Here is the caller graph for this function:

BOOL WINAPI nsMoveFileW ( LPCWSTR  aSrc,
LPCWSTR  aDest 
)

Definition at line 230 of file nsWinAPIs.cpp.

{
    nsCAutoString src, dest;
    const char *pSrc, *pDest;

    ConvertArg(aSrc, src, pSrc);
    ConvertArg(aDest, dest, pDest);

    return MoveFileA(pSrc, pDest);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsRemoveW ( const wchar_t *  aPath)

Definition at line 562 of file nsWinAPIs.cpp.

{
    if (!aPath) return -1;

    nsCAutoString pathA;
    NS_CopyUnicodeToNative(nsDependentString(aPath), pathA);

    return remove(pathA.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsRmdirW ( const wchar_t *  aPath)

Definition at line 572 of file nsWinAPIs.cpp.

{
    if (!aPath) return -1;

    nsCAutoString pathA;
    NS_CopyUnicodeToNative(nsDependentString(aPath), pathA);

    return _rmdir(pathA.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

HINSTANCE WINAPI nsShellExecuteW ( HWND  aWin,
LPCWSTR  aOp,
LPCWSTR  aFile,
LPCWSTR  aParam,
LPCWSTR  aDir,
INT  aShowCmd 
)

Definition at line 205 of file nsWinAPIs.cpp.

{
    nsCAutoString op, file, param, dir;
    const char  *pOp, *pFile, *pParam, *pDir;

    ConvertArg(aOp, op, pOp);
    ConvertArg(aFile, file, pFile);
    ConvertArg(aParam, param, pParam);
    ConvertArg(aDir, dir, pDir);

    return ShellExecuteA(aWin, pOp, pFile, pParam, pDir, aShowCmd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL WINAPI nsSHGetPathFromIDListW ( LPCITEMIDLIST  aIdList,
LPWSTR  aPathW 
)

Definition at line 82 of file nsWinAPIs.cpp.

{
    if (aPathW)  {
        char pathA[MAX_PATH];
        if (SHGetPathFromIDListA(aIdList, pathA)) {
            NS_ConvertAtoW(pathA, MAX_PATH, aPathW);
            return TRUE;
        }
    }

    return FALSE;
}
template<class T >
static PRBool SetLengthAndCheck ( T aStr,
DWORD  aLen 
) [inline, static]

Definition at line 69 of file nsWinAPIs.cpp.

{
    aStr.SetLength(aLen);
    if (aStr.Length() != aLen) {
        SetLastError(ERROR_OUTOFMEMORY);
        return PR_FALSE;
    }
    return PR_TRUE;
}

Here is the caller graph for this function: