/** * @internal * @brief Displays error message when * either debug print or memory * allocation may be not available. * @param[in] msg the error message. * @param[in] Status the NT status code. * @note Intended to be used after winx_exit, * winx_shutdown and winx_reboot failures. */ static void print_post_scriptum(char *msg,NTSTATUS Status) { char buffer[256]; _snprintf(buffer,sizeof(buffer),"\n%s: %x: %s\n\n", msg,(UINT)Status,winx_get_status_description(Status)); buffer[sizeof(buffer) - 1] = 0; /* winx_printf cannot be used here */ winx_print(buffer); }
/** * @internal * @brief Creates global memory heap. * @return Zero for success, negative value otherwise. */ int winx_create_global_heap(void) { /* create growable heap with initial size of 100 KB */ if(hGlobalHeap == NULL){ hGlobalHeap = RtlCreateHeap(HEAP_GROWABLE,NULL,0,100 * 1024,NULL,NULL); } if(hGlobalHeap == NULL){ /* trace macro cannot be used here */ /* winx_printf cannot be used here */ winx_print("\nCannot create global memory heap!\n"); return (-1); } /* reserve 1 MB of memory for the out of memory condition handling */ reserved_memory = (char *)winx_tmalloc(1024 * 1024); return 0; }