Exemplo n.º 1
0
PVOID
APIENTRY
EngMapFile(
    _In_ LPWSTR pwsz,
    _In_ ULONG cjSize,
    _Out_ ULONG_PTR *piFile)
{
    HANDLE hModule;
    PVOID pvBase;

    /* Load the file */
    hModule = EngLoadModuleEx(pwsz, 0, 0);
    if (!hModule)
    {
        *piFile = 0;
        return NULL;
    }

    /* Map the file */
    pvBase = EngMapModule(hModule, &cjSize);
    if (!pvBase)
    {
        EngFreeModule(hModule);
        hModule = NULL;
    }

    /* Set iFile and return mapped base */
    *piFile = (ULONG_PTR)hModule;
    return pvBase;
}
Exemplo n.º 2
0
HANDLE
OpenPlotFile(
    LPWSTR  pFileName
    )

/*++

Routine Description:




Arguments:




Return Value:




Author:

    24-Oct-1995 Tue 14:16:46 created  -by-  Daniel Chou (danielc)


Revision History:


--*/

{
    PPLOTFILE   pPF;
    DWORD       cbSize;


    if ((pPF = (PPLOTFILE)EngAllocMem(FL_ZERO_MEMORY,
                                      sizeof(PLOTFILE),
                                      'tolp'))                          &&
        (pPF->hModule = EngLoadModule((LPWSTR)pFileName))               &&
        (pPF->pbBeg = EngMapModule(pPF->hModule, &cbSize))) {

        pPF->pbEnd = (pPF->pbCur = pPF->pbBeg) + cbSize;

        return((HANDLE)pPF);
    }

    if (pPF) {

        EngFreeMem((PVOID)pPF);
    }

    return((HANDLE)INVALID_HANDLE_VALUE);
}