ULONG findStackBase() { // EBP points to the previous value of ebp on the stack PULONG baseptr; __asm { mov baseptr, ebp } // Traverse the list until we get to the end. while (NULL != *baseptr) { baseptr = (PULONG)*baseptr; } return (ULONG)baseptr; }