int ESCP_BadParamCheck() { int NumErrors = 0; // error count - to be returned int rc; // return code // // Invalid Function. // // Variation 1 - function = invalid CodePageCtr = 0; rc = EnumSystemCodePagesW( NULL, CP_INSTALLED ); CheckReturnBadParamEnum( rc, FALSE, ERROR_INVALID_PARAMETER, "Function invalid", &NumErrors, CodePageCtr, 0 ); // // Invalid Flag. // // Variation 1 - dwFlags = invalid CodePageCtr = 0; rc = EnumSystemCodePagesW( MyFuncCP, ESCP_INVALID_FLAGS ); CheckReturnBadParamEnum( rc, FALSE, ERROR_INVALID_FLAGS, "Flag invalid", &NumErrors, CodePageCtr, 0 ); // Variation 2 - dwFlags = both invalid CodePageCtr = 0; rc = EnumSystemCodePagesW( MyFuncCP, CP_INSTALLED | CP_SUPPORTED ); CheckReturnBadParamEnum( rc, FALSE, ERROR_INVALID_FLAGS, "Flag both invalid", &NumErrors, CodePageCtr, 0 ); // // Return total number of errors found. // return (NumErrors); }
int ustring_EnumSystemCodePages(lua_State *L) { DWORD flags = lua_toboolean(L,1) ? CP_SUPPORTED : CP_INSTALLED; lua_newtable(L); EnumCP.L = L; EnumCP.N = 0; if(EnumSystemCodePagesW(EnumCodePagesProc, flags)) return 1; return SysErrorReturn(L); }
int ESCP_NormalCase() { int NumErrors = 0; // error count - to be returned int rc; // return code if (Verbose) { printf("\n---- W version ----\n\n"); } // Variation 1 - installed CodePageCtr = 0; rc = EnumSystemCodePagesW( MyFuncCP, CP_INSTALLED ); CheckReturnValidEnum( rc, TRUE, CodePageCtr, NUM_INSTALLED_CPS, "Flag installed", &NumErrors ); // Variation 2 - Supported CodePageCtr = 0; rc = EnumSystemCodePagesW( MyFuncCP, CP_SUPPORTED ); CheckReturnValidEnum( rc, TRUE, CodePageCtr, NUM_SUPPORTED_CPS, "Flag supported", &NumErrors ); // // Return total number of errors found. // return (NumErrors); }