CreditsBased on code written by Regan Heath
sysErrorString(DWORDerrCode, intlangId = LANG_NEUTRAL, intsubLangId = SUBLANG_DEFAULT);WindowsException:object.Exception;code();wenforce(T, S)(Tvalue, lazy Smsg = null, stringfile = __FILE__, size_tline = __LINE__)value is true,value is returned. Otherwise,new WindowsException(GetLastError(), msg) is thrown.WindowsException assumes that the last operation setGetLastError() appropriately.Example
wenforce(DeleteFileA("junk.tmp"),"DeleteFile failed");