static void test_domain_password(DWORD cred_type) { BOOL ret; DWORD count, i; PCREDENTIALA *creds; CREDENTIALA new_cred; PCREDENTIALA cred; BOOL found = FALSE; new_cred.Flags = 0; new_cred.Type = cred_type; new_cred.TargetName = (char *)TEST_TARGET_NAME; new_cred.Comment = (char *)"Comment"; new_cred.CredentialBlobSize = sizeof(TEST_PASSWORD); new_cred.CredentialBlob = (LPBYTE)TEST_PASSWORD; new_cred.Persist = CRED_PERSIST_ENTERPRISE; new_cred.AttributeCount = 0; new_cred.Attributes = NULL; new_cred.TargetAlias = NULL; new_cred.UserName = (char *)"test\\winetest"; ret = pCredWriteA(&new_cred, 0); if (!ret && GetLastError() == ERROR_NO_SUCH_LOGON_SESSION) { skip("CRED_TYPE_DOMAIN_PASSWORD credentials are not supported " "or are disabled. Skipping\n"); return; } ok(ret, "CredWriteA failed with error %d\n", GetLastError()); ret = pCredEnumerateA(NULL, 0, &count, &creds); ok(ret, "CredEnumerateA failed with error %d\n", GetLastError()); for (i = 0; i < count; i++) { if (!strcmp(creds[i]->TargetName, TEST_TARGET_NAME)) { ok(creds[i]->Type == cred_type, "expected creds[%d]->Type CRED_TYPE_DOMAIN_PASSWORD but got %d\n", i, creds[i]->Type); ok(!creds[i]->Flags, "expected creds[%d]->Flags 0 but got 0x%x\n", i, creds[i]->Flags); ok(!strcmp(creds[i]->Comment, "Comment"), "expected creds[%d]->Comment \"Comment\" but got \"%s\"\n", i, creds[i]->Comment); check_blob(__LINE__, cred_type, creds[i]); ok(creds[i]->Persist, "expected creds[%d]->Persist CRED_PERSIST_ENTERPRISE but got %d\n", i, creds[i]->Persist); ok(!strcmp(creds[i]->UserName, "test\\winetest"), "expected creds[%d]->UserName \"winetest\" but got \"%s\"\n", i, creds[i]->UserName); found = TRUE; } } pCredFree(creds); ok(found, "credentials not found\n"); ret = pCredReadA(TEST_TARGET_NAME, cred_type, 0, &cred); ok(ret, "CredReadA failed with error %d\n", GetLastError()); if (ret) /* don't check the values of cred, if CredReadA failed. */ { check_blob(__LINE__, cred_type, cred); pCredFree(cred); } ret = pCredDeleteA(TEST_TARGET_NAME, cred_type, 0); ok(ret, "CredDeleteA failed with error %d\n", GetLastError()); }
/* version_is_less(verstr1, verstr2) returns whether version is '<' */ static int Pversion_is_less(lua_State *L) { apk_blob_t a, b; a = check_blob(L, 1); b = check_blob(L, 2); lua_pushboolean(L, apk_version_compare_blob(a, b) == APK_VERSION_LESS); return 1; }
/* version_compare(verstr1, verstr2) returns either '<', '=' or '>' */ static int Pversion_compare(lua_State *L) { apk_blob_t a, b; a = check_blob(L, 1); b = check_blob(L, 2); lua_pushstring(L, apk_version_op_string(apk_version_compare_blob(a, b))); return 1; }
// Helper runs all the checks on a seam to make sure it is valid. // Returns the seam if OK, otherwise deletes the seam and returns NULL. static SEAM* CheckSeam(int debug_level, inT32 blob_number, TWERD* word, TBLOB* blob, TBLOB* other_blob, const GenericVector<SEAM*>& seams, SEAM* seam) { if (seam == NULL || blob->outlines == NULL || other_blob->outlines == NULL || total_containment(blob, other_blob) || check_blob(other_blob) || !(check_seam_order(blob, seam) && check_seam_order(other_blob, seam)) || any_shared_split_points(seams, seam) || !test_insert_seam(seams, word, blob_number)) { word->blobs.remove(blob_number + 1); if (seam) { undo_seam(blob, other_blob, seam); delete seam; seam = NULL; #ifndef GRAPHICS_DISABLED if (debug_level) { if (debug_level >2) display_blob(blob, Red); tprintf("\n** seam being removed ** \n"); } #endif } else { delete other_blob; } return NULL; } return seam; }
// Helper runs all the checks on a seam to make sure it is valid. // Returns the seam if OK, otherwise deletes the seam and returns nullptr. static SEAM* CheckSeam(int debug_level, int32_t blob_number, TWERD* word, TBLOB* blob, TBLOB* other_blob, const GenericVector<SEAM*>& seams, SEAM* seam) { if (seam == nullptr || blob->outlines == nullptr || other_blob->outlines == nullptr || total_containment(blob, other_blob) || check_blob(other_blob) || !seam->ContainedByBlob(*blob) || !seam->ContainedByBlob(*other_blob) || any_shared_split_points(seams, seam) || !seam->PrepareToInsertSeam(seams, word->blobs, blob_number, false)) { word->blobs.remove(blob_number + 1); if (seam) { seam->UndoSeam(blob, other_blob); delete seam; seam = nullptr; #ifndef GRAPHICS_DISABLED if (debug_level) { if (debug_level >2) display_blob(blob, Red); tprintf("\n** seam being removed ** \n"); } #endif } else { delete other_blob; } return nullptr; } return seam; }
static void test_generic(void) { BOOL ret; DWORD count, i; PCREDENTIALA *creds; CREDENTIALA new_cred; PCREDENTIALA cred; BOOL found = FALSE; new_cred.Flags = 0; new_cred.Type = CRED_TYPE_GENERIC; new_cred.TargetName = (char *)TEST_TARGET_NAME; new_cred.Comment = (char *)"Comment"; new_cred.CredentialBlobSize = sizeof(TEST_PASSWORD); new_cred.CredentialBlob = (LPBYTE)TEST_PASSWORD; new_cred.Persist = CRED_PERSIST_ENTERPRISE; new_cred.AttributeCount = 0; new_cred.Attributes = NULL; new_cred.TargetAlias = NULL; new_cred.UserName = (char *)"winetest"; ret = pCredWriteA(&new_cred, 0); ok(ret || broken(GetLastError() == ERROR_NO_SUCH_LOGON_SESSION), "CredWriteA failed with error %d\n", GetLastError()); if (!ret) { skip("couldn't write generic credentials, skipping tests\n"); return; } ret = pCredEnumerateA(NULL, 0, &count, &creds); ok(ret, "CredEnumerateA failed with error %d\n", GetLastError()); for (i = 0; i < count; i++) { if (!strcmp(creds[i]->TargetName, TEST_TARGET_NAME)) { ok(creds[i]->Type == CRED_TYPE_GENERIC || creds[i]->Type == CRED_TYPE_DOMAIN_PASSWORD, /* Vista */ "expected creds[%d]->Type CRED_TYPE_GENERIC or CRED_TYPE_DOMAIN_PASSWORD but got %d\n", i, creds[i]->Type); ok(!creds[i]->Flags, "expected creds[%d]->Flags 0 but got 0x%x\n", i, creds[i]->Flags); ok(!strcmp(creds[i]->Comment, "Comment"), "expected creds[%d]->Comment \"Comment\" but got \"%s\"\n", i, creds[i]->Comment); check_blob(__LINE__, creds[i]->Type, creds[i]); ok(creds[i]->Persist, "expected creds[%d]->Persist CRED_PERSIST_ENTERPRISE but got %d\n", i, creds[i]->Persist); ok(!strcmp(creds[i]->UserName, "winetest"), "expected creds[%d]->UserName \"winetest\" but got \"%s\"\n", i, creds[i]->UserName); found = TRUE; } } pCredFree(creds); ok(found, "credentials not found\n"); ret = pCredReadA(TEST_TARGET_NAME, CRED_TYPE_GENERIC, 0, &cred); ok(ret, "CredReadA failed with error %d\n", GetLastError()); pCredFree(cred); ret = pCredDeleteA(TEST_TARGET_NAME, CRED_TYPE_GENERIC, 0); ok(ret, "CredDeleteA failed with error %d\n", GetLastError()); }
/* returns boolean */ static int Pversion_validate(lua_State *L) { apk_blob_t ver = check_blob(L, 1); lua_pushboolean(L, apk_version_validate(ver)); return 1; }
/********************************************************************** * attempt_blob_chop * * Try to split the this blob after this one. Check to make sure that * it was successful. **********************************************************************/ SEAM *attempt_blob_chop(TWERD *word, INT32 blob_number, SEAMS seam_list) { TBLOB *blob; TBLOB *other_blob; SEAM *seam; TBLOB *last_blob; TBLOB *next_blob; INT16 x; if (first_pass) chops_attempted1++; else chops_attempted2++; last_blob = NULL; blob = word->blobs; for (x = 0; x < blob_number; x++) { last_blob = blob; blob = blob->next; } next_blob = blob->next; if (repair_unchopped_blobs) preserve_outline_tree (blob->outlines); other_blob = newblob (); /* Make new blob */ other_blob->next = blob->next; other_blob->outlines = NULL; blob->next = other_blob; seam = pick_good_seam (blob); if (chop_debug) { if (seam != NULL) { print_seam ("Good seam picked=", seam); } else cprintf ("\n** no seam picked *** \n"); } if (seam) { apply_seam(blob, other_blob, seam); } if ((seam == NULL) || (blob->outlines == NULL) || (other_blob->outlines == NULL) || total_containment (blob, other_blob) || check_blob (other_blob) || !(check_seam_order (blob, seam) && check_seam_order (other_blob, seam)) || any_shared_split_points (seam_list, seam) || !test_insert_seam(seam_list, blob_number, blob, word->blobs)) { blob->next = next_blob; if (seam) { undo_seam(blob, other_blob, seam); delete_seam(seam); #ifndef GRAPHICS_DISABLED if (chop_debug) { display_blob(blob, Red); cprintf ("\n** seam being removed ** \n"); } #endif } else { oldblob(other_blob); } if (repair_unchopped_blobs) restore_outline_tree (blob->outlines); return (NULL); } return (seam); }
SEAM *Wordrec::attempt_blob_chop(TWERD *word, inT32 blob_number, bool italic_blob, SEAMS seam_list) { TBLOB *blob; TBLOB *other_blob; SEAM *seam; TBLOB *last_blob; TBLOB *next_blob; inT16 x; last_blob = NULL; blob = word->blobs; for (x = 0; x < blob_number; x++) { last_blob = blob; blob = blob->next; } next_blob = blob->next; if (repair_unchopped_blobs) preserve_outline_tree (blob->outlines); other_blob = new TBLOB; /* Make new blob */ other_blob->next = blob->next; other_blob->outlines = NULL; blob->next = other_blob; seam = pick_good_seam(blob); if (seam == NULL && word->latin_script) { // If the blob can simply be divided into outlines, then do that. TPOINT location; if (divisible_blob(blob, italic_blob, &location)) { seam = new_seam(0.0f, location, NULL, NULL, NULL); } } if (chop_debug) { if (seam != NULL) { print_seam ("Good seam picked=", seam); } else cprintf ("\n** no seam picked *** \n"); } if (seam) { apply_seam(blob, other_blob, italic_blob, seam); } if ((seam == NULL) || (blob->outlines == NULL) || (other_blob->outlines == NULL) || total_containment (blob, other_blob) || check_blob (other_blob) || !(check_seam_order (blob, seam) && check_seam_order (other_blob, seam)) || any_shared_split_points (seam_list, seam) || !test_insert_seam(seam_list, blob_number, blob, word->blobs)) { blob->next = next_blob; if (seam) { undo_seam(blob, other_blob, seam); delete_seam(seam); #ifndef GRAPHICS_DISABLED if (chop_debug) { if (chop_debug >2) display_blob(blob, Red); cprintf ("\n** seam being removed ** \n"); } #endif } else { delete other_blob; } if (repair_unchopped_blobs) restore_outline_tree (blob->outlines); return (NULL); } return (seam); }