/* This function computes the qualified name of an object. */ void ComputeQualifiedName( TPM_HANDLE parentHandle, // IN: parent's handle TPM_ALG_ID nameAlg, // IN: name hash TPM2B_NAME *name, // IN: name of the object TPM2B_NAME *qualifiedName // OUT: qualified name of the object ) { HASH_STATE hashState; // hash state TPM2B_NAME parentName; if(parentHandle == TPM_RH_UNASSIGNED) { MemoryCopy2B(&qualifiedName->b, &name->b, sizeof(qualifiedName->t.name)); *qualifiedName = *name; } else { GetQualifiedName(parentHandle, &parentName); // QN_A = hash_A (QN of parent || NAME_A) // Start hash qualifiedName->t.size = CryptHashStart(&hashState, nameAlg); // Add parent's qualified name CryptDigestUpdate2B(&hashState, &parentName.b); // Add self name CryptDigestUpdate2B(&hashState, &name->b); // Complete hash leaving room for the name algorithm CryptHashEnd(&hashState, qualifiedName->t.size, &qualifiedName->t.name[2]); UINT16_TO_BYTE_ARRAY(nameAlg, qualifiedName->t.name); qualifiedName->t.size += 2; } return; }
void functionbp(void) { char *name = (char *)DialogBox(hInstance, "FUNCTIONBPDIALOG", hwndFrame, (DLGPROC) FunctionBPProc); if (name) { char buf[2048]; GetQualifiedName(buf, &name, FALSE, TRUE); // we aren't handling cast operators for now... if (*name) { name = NULL; } else { int count = 0; FUNCTIONLIST *list, *selected = NULL; DEBUG_INFO *dbg = findDebug(activeScope->address); list = GetFunctionList(dbg, activeScope, buf); if (list && list->next) { selected = (FUNCTIONLIST *)DialogBoxParam(hInstance, "FUNCTIONBPSELECTDIALOG", hwndFrame, (DLGPROC) FunctionBPSelectProc, (LPARAM)list); } else { selected = list; } if (selected) { int line; char module[MAX_PATH]; if (GetBreakpointLine(selected->address, module, &line, FALSE)) { Tag(TAG_BP, module, line, 0,0,0,0); } } if (list) { while (list) { FUNCTIONLIST *l = list; list = list->next; free(l); } } } } }
void FdoPropertyDefinition::Set( FdoPropertyDefinition* pProperty, FdoSchemaMergeContext* pContext ) { if ( GetPropertyType() != pProperty->GetPropertyType() ) { pContext->AddError( FdoSchemaExceptionP( FdoSchemaException::Create( FdoException::NLSGetMessage( FDO_NLSID(SCHEMA_25_PROPERTYTYPECONFLICT), (FdoString*) GetQualifiedName() ) ) ) ); return; } FdoSchemaElement::Set(pProperty, pContext); }
static void CreateUsageList(void) { HWND hwnd = (HWND)SendMessage(hwndClient, WM_MDIGETACTIVE, 0, 0); PROJECTITEM *pj; sqlite3 *db = BrowseOpenDBByHWND(hwnd, &pj); if (db) { char mangled[2048], *srcName = brsName; BROWSELIST *rv = NULL, **scan; FreeUsageList(); GetQualifiedName(mangled, &srcName, FALSE, FALSE); if (!strrchr(mangled+1, '@')) { DEBUG_INFO *inf; int id; mangled[0] = '_'; if (id = LookupSymbolBrowse(db, mangled)) { BROWSELIST *next = calloc(sizeof(BROWSELIST), 1); next->next = rv ; rv = next; strcpy(next->name, mangled+1); next->id = id; } rv = LookupCPPNamesBrowse(db, mangled , rv); mangled[0] = '@'; } rv = LookupCPPNamesBrowse(db, mangled, rv); LookupLineInfo(db, rv); LookupUsageInfo(db, rv); while (rv) { BROWSELIST *next = rv->next; free(rv); rv = next; } PostMessage(hwndBrowse, WM_USER, 0, 0); DBClose(db); } }
void FdoPropertyDefinition::InitFromXml(FdoSchemaXmlContext* pContext, FdoXmlAttributeCollection* attrs) { FdoSchemaXmlContext* fdoContext = (FdoSchemaXmlContext*) pContext; FdoSchemaElement::InitFromXml(pContext, attrs ); // If property already exists, make sure type change is not attempted. if (FdoSchemaElementP (GetParent())) { FdoClassDefinitionP pOldClass = fdoContext->GetMergeContext()->FindClass( FdoFeatureSchemasP( fdoContext->GetMergeContext()->GetSchemas() ), FdoFeatureSchemaP(GetFeatureSchema())->GetName(), FdoSchemaElementP(GetParent())->GetName() ); if ( pOldClass != NULL ) { FdoPropertyP pOldProp = FdoPropertiesP( pOldClass->GetProperties() )->FindItem( GetName() ); if ( pOldProp && (pOldProp->GetPropertyType() != GetPropertyType()) ) { pContext->AddError( FdoSchemaExceptionP( FdoSchemaException::Create( FdoException::NLSGetMessage( FDO_NLSID(SCHEMA_25_PROPERTYTYPECONFLICT), (FdoString*) GetQualifiedName() ) ) ) ); return; } } } }
void showFunction(HWND hwnd, EDITDATA *p, int ch) { sqlite3_int64 id, baseid; CCFUNCDATA *functionData = NULL; char name[2046], *q = name; int end = p->selstartcharpos; int pos = p->selstartcharpos - 1; POINT cpos; SIZE size; int curArg = 0; if (instring(p->cd->text, &p->cd->text[p->selstartcharpos])) return; p->cd->selecting = FALSE; if (pos <= 0 || PropGetInt(NULL, "CODE_COMPLETION") == 0) return ; if (ch == '(' || ch == ',' && !IsWindowVisible(hwndShowFunc)) { char name[512], *p1; int pos; int i; int commaCount = 0; DWINFO *info = (DWINFO *)GetWindowLong(GetParent(hwnd), 0); int lineno = SendMessage(hwnd, EM_EXLINEFROMCHAR, 0, p->selstartcharpos)+1; CCFUNCDATA * functionData = NULL; BOOL parsed = FALSE; CHARRANGE range; if (ch == ',') { int nesting =1 ; pos = p->selendcharpos-1; while (nesting > 0 && pos> 0 && p->cd->text[pos].ch != '{' && p->cd->text[pos].ch != '}') { if (p->cd->text[pos].ch == ')') nesting++; else if (p->cd->text[pos].ch == '(') nesting --; else if (p->cd->text[pos].ch == ',' && nesting == 1) commaCount++; pos--; } if (nesting) return; if (!pos || !isalnum(p->cd->text[pos-1].ch) && p->cd->text[pos-1].ch != '_') return; range.cpMin = pos; range.cpMax = pos; } else { range.cpMin = p->selendcharpos-1; range.cpMax = p->selendcharpos-1; } GetWordSpan(p, &range); if (range.cpMin == range.cpMax) return; pos = range.cpMin; while (pos && isspace(p->cd->text[pos-1].ch)) { pos--; } if (pos && p->cd->text[pos-1].ch == ':') { pos = CPPScanBackward(p, range.cpMax, TRUE); } else { pos = range.cpMin; } for (i=pos; i < range.cpMax; i++) name[i-pos] = p->cd->text[i].ch; name[i-pos] = 0; p1 = name; GetQualifiedName(name + i-pos + 1, &p1, FALSE, FALSE); strcpy(name, name +i-pos + 1); while (pos && isspace(p->cd->text[pos-1].ch)) { pos--; } if (pos && (p->cd->text[pos-1].ch == '.' || p->cd->text[pos-1].ch == '>')) { int start = 0; start = CPPScanBackward(p, p->selendcharpos, TRUE); if (start != pos) { char qual[2048]; for (i=start; i < pos; i++) qual[i-start] = p->cd->text[i].ch; qual[i-start] = 0; parsed = TRUE; sprintf(qual + strlen(qual), "@%s", name); functionData = ccLookupFunctionList(lineno, info->dwName, qual); } } if (!parsed) { CCFUNCDATA **scan; char funcbase[2048], nsbase[512], abase[512]; abase[0] = 0; GetContainerData(lineno, info->dwName, nsbase, funcbase); if (strrchr(name, '@') != name) { char *p = strrchr(name, '@'); strncpy(abase, name, p - name); abase[p-name] = 0; strcpy(name, p); *p = 0; } functionData = ccLookupFunctionList(lineno, info->dwName, name); if (!functionData) { name[0] = '_'; functionData = ccLookupFunctionList(lineno, info->dwName, name); name[0] = '@'; } scan = &functionData; while (*scan) { char nsbase2[2048]; if ((*scan)->args->member) { if (!funcbase[0] || strncmp(funcbase, (*scan)->fullname, strlen(funcbase))) { CCFUNCDATA *remove = *scan; *scan = (*scan)->next; remove->next = NULL; ccFreeFunctionList(remove); } else { scan = &(*scan)->next; } } else { char *last, *p ; int nesting = 0; p = last = (*scan)->fullname; while (*p) { switch(*p) { case '@': if (!nesting) last = p; break; case '#': nesting++; break; case '~': if (nesting) nesting--; break; } p++; } if (last != (*scan)->fullname && (strncmp((*scan)->fullname, funcbase, last - (*scan)->fullname) || funcbase[last - (*scan)->fullname] != '@' && funcbase[last - (*scan)->fullname] != 0)) { BOOL found = FALSE; char *p = nsbase; while (*p) { char *q = nsbase2; while (*p && *p != ';') *q++ = *p++; if (*p) p++; *q = 0; if (!strncmp((*scan)->fullname, nsbase2, last - (*scan)->fullname) &&( nsbase2[last - (*scan)->fullname] == '@' || nsbase2[last - (*scan)->fullname] == 0)) { found = TRUE; break; } } if (!found) { strcpy(nsbase2, abase); if (!strncmp((*scan)->fullname, nsbase2, last - (*scan)->fullname) && nsbase2[last - (*scan)->fullname] == 0) { found = TRUE; } } if (!found) { CCFUNCDATA *remove = *scan; *scan = (*scan)->next; remove->next = NULL; ccFreeFunctionList(remove); } else scan = &(*scan)->next; } else { BOOL found = abase[0] == '\0'; strcpy(nsbase2, abase); if (!strncmp((*scan)->fullname, nsbase2, last - (*scan)->fullname) && nsbase2[last - (*scan)->fullname] == 0) { found = TRUE; } if (!found) { CCFUNCDATA *remove = *scan; *scan = (*scan)->next; remove->next = NULL; ccFreeFunctionList(remove); } else { scan = &(*scan)->next; } } } } } if (functionData) { if (!hwndShowFunc) { hwndShowFunc = CreateWindowEx(0 | /*WS_EX_TOPMOST | WS_EX_LAYERED |*/ WS_EX_NOACTIVATE, "xccfuncclass", "", (WS_CHILD), CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndFrame, 0, GetModuleHandle(0), 0); // done this way to associate the popup with the application rather than the desktop SetWindowLong(hwndShowFunc, GWL_STYLE, (GetWindowLong(hwndShowFunc, GWL_STYLE) & ~WS_CHILD ) | WS_POPUP); } SendMessage(hwndShowFunc, WM_USER, 0, (LPARAM)functionData); SendMessage(hwndShowFunc, WM_USER+1, (WPARAM)hwnd, (LPARAM)p); SendMessage(hwndShowFunc, WM_USER+2, commaCount, 0); ShowWindow(hwndShowFunc, SW_SHOW); SetFocus(hwnd); } } }