GetEnvironmentStrings and HeapLock

Started by czerny, March 27, 2013, 06:02:52 PM

Previous topic - Next topic

czerny

Hallo!

I have the following code:

HANDLE hHeap = GlobalHandle(GetEnvironmentStrings());
PROCESS_HEAP_ENTRY Entry;

if (!hHeap) return 0;

if (HeapLock(hHeap) == FALSE) {
        wprintf(L"Failed to lock heap with LastError %d.\n", GetLastError());
        return 1;
}

What are the most likely causes that HeapLock fails?

jj2007

You are mixing global and heap functions here:

GlobalHandle

The global functions have greater overhead and provide fewer features than other memory management functions. New applications should use the heap functions