static BOOL is_elem_name(HTMLElement *elem, LPCWSTR name) { const PRUnichar *str; nsAString nsstr; BOOL ret = FALSE; nsresult nsres; static const PRUnichar nameW[] = {'n','a','m','e',0}; if(!elem->nselem) return FALSE; nsAString_Init(&nsstr, NULL); nsIDOMHTMLElement_GetId(elem->nselem, &nsstr); nsAString_GetData(&nsstr, &str); if(!strcmpiW(str, name)) { nsAString_Finish(&nsstr); return TRUE; } nsres = get_elem_attr_value(elem->nselem, nameW, &nsstr, &str); if(NS_SUCCEEDED(nsres)) { ret = !strcmpiW(str, name); nsAString_Finish(&nsstr); } return ret; }
static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v) { HTMLFrameBase *This = impl_from_IHTMLFrameBase(iface); nsAString nsstr; nsresult nsres; TRACE("(%p)->(%s)\n", This, debugstr_w(v)); if(!(!strcmpiW(v, yesW) || !strcmpiW(v, noW) || !strcmpiW(v, autoW))) return E_INVALIDARG; if(This->nsframe) { nsAString_InitDepend(&nsstr, v); nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr); }else if(This->nsiframe) { nsAString_InitDepend(&nsstr, v); nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr); }else { ERR("No attached ns frame object\n"); return E_UNEXPECTED; } nsAString_Finish(&nsstr); if(NS_FAILED(nsres)) { ERR("SetScrolling failed: 0x%08x\n", nsres); return E_FAIL; } return S_OK; }
static BOOL set_host_properties(const WCHAR *prop) { static const WCHAR nologoW[] = {'n','o','l','o','g','o',0}; static const WCHAR iactive[] = {'i',0}; static const WCHAR batch[] = {'b',0}; if(*prop == '/') { ++prop; if(*prop == '/') ++prop; } else ++prop; if(strcmpiW(prop, iactive) == 0) wshInteractive = VARIANT_TRUE; else if(strcmpiW(prop, batch) == 0) wshInteractive = VARIANT_FALSE; else if(strcmpiW(prop, nologoW) == 0) WINE_FIXME("ignored %s switch\n", debugstr_w(nologoW)); else { WINE_FIXME("unsupported switch %s\n", debugstr_w(prop)); return FALSE; } return TRUE; }
static xml_encoding parse_encoding_name(const WCHAR *encoding) { static const WCHAR utf8W[] = {'U','T','F','-','8',0}; if (!strcmpiW(encoding, utf8W)) return XmlEncoding_UTF8; if (!strcmpiW(encoding, utf16W)) return XmlEncoding_UTF16; return XmlEncoding_Unknown; }
/***************************************************************************** * DRIVER_GetDriverName * */ BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size ) { static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 }; static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 }; static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0}; static const WCHAR empty_strW[] = { 0 }; WCHAR *p; /* display is a special case */ if (!strcmpiW( device, displayW ) || !strcmpiW( device, display1W )) { lstrcpynW( driver, displayW, size ); return TRUE; } size = GetProfileStringW(devicesW, device, empty_strW, driver, size); if(!size) { WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device)); return FALSE; } p = strchrW(driver, ','); if(!p) { WARN("%s entry in [devices] section of win.ini is malformed.\n", debugstr_w(device)); return FALSE; } *p = 0; TRACE("Found %s for %s\n", debugstr_w(driver), debugstr_w(device)); return TRUE; }
static HRESULT navigate_anchor(HTMLAnchorElement *This) { nsAString href_str, target_str; HTMLOuterWindow *window = NULL; nsresult nsres; HRESULT hres = E_FAIL; static const WCHAR _parentW[] = {'p','a','r','e','n','t',0}; static const WCHAR _selfW[] = {'_','s','e','l','f',0}; static const WCHAR _topW[] = {'_','t','o','p',0}; nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *target; nsAString_GetData(&target_str, &target); TRACE("target %s\n", debugstr_w(target)); if(*target && strcmpiW(target, _selfW)) { if(!strcmpiW(target, _topW)) { TRACE("target _top\n"); get_top_window(This->element.node.doc->basedoc.window, &window); }else if(!strcmpiW(target, _parentW)) { FIXME("Navigating to target _parent is not implemented\n"); nsAString_Finish(&target_str); return S_OK; }else { HTMLOuterWindow *top_window; get_top_window(This->element.node.doc->basedoc.window, &top_window); hres = get_frame_by_name(top_window, target, TRUE, &window); if(FAILED(hres) || !window) { hres = navigate_anchor_window(This, target); nsAString_Finish(&target_str); return hres; } } } } nsAString_Finish(&target_str); nsAString_Init(&href_str, NULL); nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *href; nsAString_GetData(&href_str, &href); if(*href) { if(!window) window = This->element.node.doc->basedoc.window; hres = navigate_url(window, href, window->uri_nofrag, BINDING_NAVIGATED); }else { TRACE("empty href\n"); hres = S_OK; } } nsAString_Finish(&href_str); return hres; }
static BOOL GetRootKey (PWCHAR Name) { if (!strcmpiW (Name, HKCR)) { strcpyW (Name, HKCRPath); return TRUE; } if (!strcmpiW (Name, HKCU)) { strcpyW (Name, HKCUPath); return TRUE; } if (!strcmpiW (Name, HKLM)) { strcpyW (Name, HKLMPath); return TRUE; } if (!strcmpiW (Name, HKU)) { strcpyW (Name, HKUPath); return TRUE; } #if 0 if (!strcmpiW (Name, HKR)) return FALSE; #endif return FALSE; }
static BOOL is_local_machine( const WCHAR *server ) { static const WCHAR dotW[] = {'.',0}; static const WCHAR localhostW[] = {'l','o','c','a','l','h','o','s','t',0}; WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1]; DWORD len = sizeof(buffer) / sizeof(buffer[0]); if (!server || !strcmpW( server, dotW ) || !strcmpiW( server, localhostW )) return TRUE; if (GetComputerNameW( buffer, &len ) && !strcmpiW( server, buffer )) return TRUE; return FALSE; }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE prev, WCHAR *cmdline, int show) { static const WCHAR regserverW[] = {'r','e','g','s','e','r','v','e','r',0}; static const WCHAR unregserverW[] = {'u','n','r','e','g','s','e','r','v','e','r',0}; if(*cmdline == '-' || *cmdline == '/') { if(!strcmpiW(cmdline+1, regserverW)) return register_iexplore(TRUE); if(!strcmpiW(cmdline+1, unregserverW)) return register_iexplore(FALSE); } return IEWinMain(cmdline, show); }
static HRESULT WINAPI WshCollection_Item(IWshCollection *iface, VARIANT *index, VARIANT *value) { WshCollection *This = impl_from_IWshCollection(iface); static const WCHAR allusersdesktopW[] = {'A','l','l','U','s','e','r','s','D','e','s','k','t','o','p',0}; static const WCHAR allusersprogramsW[] = {'A','l','l','U','s','e','r','s','P','r','o','g','r','a','m','s',0}; static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; PIDLIST_ABSOLUTE pidl; WCHAR pathW[MAX_PATH]; int kind = 0; BSTR folder; HRESULT hr; TRACE("(%p)->(%s %p)\n", This, debugstr_variant(index), value); if (V_VT(index) != VT_BSTR) { FIXME("only BSTR index supported, got %d\n", V_VT(index)); return E_NOTIMPL; } folder = V_BSTR(index); if (!strcmpiW(folder, desktopW)) kind = CSIDL_DESKTOP; else if (!strcmpiW(folder, allusersdesktopW)) kind = CSIDL_COMMON_DESKTOPDIRECTORY; else if (!strcmpiW(folder, allusersprogramsW)) kind = CSIDL_COMMON_PROGRAMS; else { FIXME("folder kind %s not supported\n", debugstr_w(folder)); return E_NOTIMPL; } hr = SHGetSpecialFolderLocation(NULL, kind, &pidl); if (hr != S_OK) return hr; if (SHGetPathFromIDListW(pidl, pathW)) { V_VT(value) = VT_BSTR; V_BSTR(value) = SysAllocString(pathW); hr = V_BSTR(value) ? S_OK : E_OUTOFMEMORY; } else hr = E_FAIL; CoTaskMemFree(pidl); return hr; }
/********************************************************************** * DRIVER_load_driver */ const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) { HMODULE module; struct graphics_driver *driver; static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 }; static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0}; EnterCriticalSection( &driver_section ); /* display driver is a special case */ if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) { driver = load_display_driver(); LeaveCriticalSection( &driver_section ); return &driver->funcs; } if ((module = GetModuleHandleW( name ))) { for (driver = first_driver; driver; driver = driver->next) { if (driver->module == module) { driver->count++; LeaveCriticalSection( &driver_section ); return &driver->funcs; } } } if (!(module = LoadLibraryW( name ))) { LeaveCriticalSection( &driver_section ); return NULL; } if (!(driver = create_driver( module ))) { FreeLibrary( module ); LeaveCriticalSection( &driver_section ); return NULL; } TRACE( "loaded driver %p for %s\n", driver, debugstr_w(name) ); LeaveCriticalSection( &driver_section ); return &driver->funcs; }
HTMLOuterWindow *get_target_window(HTMLOuterWindow *window, nsAString *target_str, BOOL *use_new_window) { HTMLOuterWindow *top_window, *ret_window; const PRUnichar *target; HRESULT hres; static const WCHAR _parentW[] = {'_','p','a','r','e','n','t',0}; static const WCHAR _selfW[] = {'_','s','e','l','f',0}; static const WCHAR _topW[] = {'_','t','o','p',0}; *use_new_window = FALSE; nsAString_GetData(target_str, &target); TRACE("%s\n", debugstr_w(target)); if(!*target || !strcmpiW(target, _selfW)) { IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); return window; } if(!strcmpiW(target, _topW)) { get_top_window(window, &top_window); IHTMLWindow2_AddRef(&top_window->base.IHTMLWindow2_iface); return top_window; } if(!strcmpiW(target, _parentW)) { if(!window->parent) { WARN("Window has no parent, treat as self\n"); IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); return window; } IHTMLWindow2_AddRef(&window->parent->base.IHTMLWindow2_iface); return window->parent; } get_top_window(window, &top_window); hres = get_frame_by_name(top_window, target, TRUE, &ret_window); if(FAILED(hres) || !ret_window) { *use_new_window = TRUE; return NULL; } IHTMLWindow2_AddRef(&ret_window->base.IHTMLWindow2_iface); return ret_window; }
static HRESULT WINAPI ScriptDisp_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { ScriptDisp *This = ScriptDisp_from_IDispatchEx(iface); dynamic_var_t *var; ident_map_t *ident; function_t *func; TRACE("(%p)->(%s %x %p)\n", This, debugstr_w(bstrName), grfdex, pid); if(!This->ctx) return E_UNEXPECTED; for(ident = This->ident_map; ident < This->ident_map+This->ident_map_cnt; ident++) { if(!strcmpiW(ident->name, bstrName)) { *pid = ident_to_id(This, ident); return S_OK; } } for(var = This->ctx->global_vars; var; var = var->next) { if(!strcmpiW(var->name, bstrName)) { ident = add_ident(This, var->name); if(!ident) return E_OUTOFMEMORY; ident->is_var = TRUE; ident->u.var = var; *pid = ident_to_id(This, ident); return S_OK; } } for(func = This->ctx->global_funcs; func; func = func->next) { if(!strcmpiW(func->name, bstrName)) { ident = add_ident(This, func->name); if(!ident) return E_OUTOFMEMORY; ident->is_var = FALSE; ident->u.func = func; *pid = ident_to_id(This, ident); return S_OK; } } *pid = -1; return DISP_E_UNKNOWNNAME; }
/***************************************************************************** * Main entry point. This is a console application so we have a wmain() not a * winmain(). */ int wmain(int argc, WCHAR *argv[]) { static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0}; WCHAR *url = argv[1]; BSTR display_uri; DWORD scheme; IUri *uri; HRESULT hres; int ret = 1; /* DDE used only if -nohome is specified; avoids delay in printing usage info * when no parameters are passed */ if (url && !strcmpiW( url, nohomeW )) url = argc > 2 ? argv[2] : get_url_from_dde(); if (!url) { WINE_ERR( "Usage: winebrowser URL\n" ); return -1; } hres = CreateUri(url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri); if(FAILED(hres)) { WINE_ERR("Failed to parse URL\n"); ret = open_http_url(url); HeapFree(GetProcessHeap(), 0, ddeString); return ret; } HeapFree(GetProcessHeap(), 0, ddeString); IUri_GetScheme(uri, &scheme); if(scheme == URL_SCHEME_FILE) { IUri *file_uri; file_uri = convert_file_uri(uri); if(file_uri) { IUri_Release(uri); uri = file_uri; }else { WINE_ERR("Failed to convert file URL to unix path\n"); } } hres = IUri_GetDisplayUri(uri, &display_uri); IUri_Release(uri); if(FAILED(hres)) return -1; WINE_TRACE("opening %s\n", wine_dbgstr_w(display_uri)); if(scheme == URL_SCHEME_MAILTO) ret = open_mailto_url(display_uri); else /* let the browser decide how to handle the given url */ ret = open_http_url(display_uri); SysFreeString(display_uri); return ret; }
static void process_meta_element(HTMLDocumentNode *doc, nsIDOMHTMLMetaElement *meta_element) { nsAString http_equiv_str, content_str; nsresult nsres; static const WCHAR x_ua_compatibleW[] = {'x','-','u','a','-','c','o','m','p','a','t','i','b','l','e',0}; nsAString_Init(&http_equiv_str, NULL); nsAString_Init(&content_str, NULL); nsres = nsIDOMHTMLMetaElement_GetHttpEquiv(meta_element, &http_equiv_str); if(NS_SUCCEEDED(nsres)) nsres = nsIDOMHTMLMetaElement_GetContent(meta_element, &content_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *http_equiv, *content; nsAString_GetData(&http_equiv_str, &http_equiv); nsAString_GetData(&content_str, &content); TRACE("%s: %s\n", debugstr_w(http_equiv), debugstr_w(content)); if(!strcmpiW(http_equiv, x_ua_compatibleW)) { compat_mode_t document_mode; if(parse_ua_compatible(content, &document_mode)) set_document_mode(doc, document_mode, TRUE); else FIXME("Unsupported document mode %s\n", debugstr_w(content)); } } nsAString_Finish(&http_equiv_str); nsAString_Finish(&content_str); }
/****************************************************************************** * LookupPrivilegeValueW [ADVAPI32.@] * Retrieves LUID used on a system to represent the privilege name. * * NOTES * lpLuid should be PLUID * * PARAMS * lpSystemName [I] Address of string specifying the system * lpName [I] Address of string specifying the privilege * lpLuid [I] Address of locally unique identifier * * RETURNS STD */ BOOL WINAPI LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ) { int i; TRACE ("(%s, %s, %p)\n", debugstr_w (lpSystemName), debugstr_w (lpName), lpLuid); /* FIXME - check lpSystemName */ if (!lpName) { SetLastError (ERROR_NO_SUCH_PRIVILEGE); return FALSE; } for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i <= SE_MAX_WELL_KNOWN_PRIVILEGE; i++) { if (strcmpiW (SePrivNames[i], lpName)) continue; lpLuid->HighPart = 0; lpLuid->LowPart = i; return TRUE; } SetLastError (ERROR_NO_SUCH_PRIVILEGE); return FALSE; }
static HRESULT get_dynamic_prop(DispatchEx *This, const WCHAR *name, DWORD flags, dynamic_prop_t **ret) { const BOOL alloc = flags & fdexNameEnsure; dispex_dynamic_data_t *data; dynamic_prop_t *prop; data = get_dynamic_data(This, alloc); if(!data) { if(alloc) return E_OUTOFMEMORY; TRACE("not found %s\n", debugstr_w(name)); return DISP_E_UNKNOWNNAME; } for(prop = data->props; prop < data->props+data->prop_cnt; prop++) { if(flags & fdexNameCaseInsensitive ? !strcmpiW(prop->name, name) : !strcmpW(prop->name, name)) { if(prop->flags & DYNPROP_DELETED) { if(!alloc) return DISP_E_UNKNOWNNAME; prop->flags &= ~DYNPROP_DELETED; } *ret = prop; return S_OK; } } if(!alloc) return DISP_E_UNKNOWNNAME; TRACE("creating dynamic prop %s\n", debugstr_w(name)); if(!data->buf_size) { data->props = heap_alloc(sizeof(dynamic_prop_t)*4); if(!data->props) return E_OUTOFMEMORY; data->buf_size = 4; }else if(data->buf_size == data->prop_cnt) { dynamic_prop_t *new_props; new_props = heap_realloc(data->props, sizeof(dynamic_prop_t)*(data->buf_size<<1)); if(!new_props) return E_OUTOFMEMORY; data->props = new_props; data->buf_size <<= 1; } prop = data->props + data->prop_cnt; prop->name = heap_strdupW(name); if(!prop->name) return E_OUTOFMEMORY; VariantInit(&prop->var); prop->flags = 0; data->prop_cnt++; *ret = prop; return S_OK; }
/* retrieve the desktop name to use if not specified on the command line */ static const WCHAR *get_default_desktop_name(void) { static const WCHAR desktopW[] = {'D','e','s','k','t','o','p',0}; static const WCHAR defaultW[] = {'D','e','f','a','u','l','t',0}; static const WCHAR explorer_keyW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', 'E','x','p','l','o','r','e','r',0}; static WCHAR buffer[MAX_PATH]; DWORD size = sizeof(buffer); HDESK desk = GetThreadDesktop( GetCurrentThreadId() ); WCHAR *ret = NULL; HKEY hkey; if (desk && GetUserObjectInformationW( desk, UOI_NAME, buffer, sizeof(buffer)/sizeof(WCHAR), NULL )) { if (strcmpiW( buffer, defaultW )) return buffer; } /* @@ Wine registry key: HKCU\Software\Wine\Explorer */ if (!RegOpenKeyW( HKEY_CURRENT_USER, explorer_keyW, &hkey )) { if (!RegQueryValueExW( hkey, desktopW, 0, NULL, (LPBYTE)buffer, &size )) ret = buffer; RegCloseKey( hkey ); } return ret; }
static INT CALLBACK add_font_proc(const LOGFONTW *lfw, const TEXTMETRICW *ntm, DWORD type, LPARAM lParam) { GpFontCollection* fonts = (GpFontCollection*)lParam; int i; /* skip duplicates */ for (i=0; i<fonts->count; i++) if (strcmpiW(lfw->lfFaceName, fonts->FontFamilies[i]->FamilyName) == 0) return 1; if (fonts->allocated == fonts->count) { INT new_alloc_count = fonts->allocated+50; GpFontFamily** new_family_list = HeapAlloc(GetProcessHeap(), 0, new_alloc_count*sizeof(void*)); if (!new_family_list) return 0; memcpy(new_family_list, fonts->FontFamilies, fonts->count*sizeof(void*)); HeapFree(GetProcessHeap(), 0, fonts->FontFamilies); fonts->FontFamilies = new_family_list; fonts->allocated = new_alloc_count; } if (GdipCreateFontFamilyFromName(lfw->lfFaceName, NULL, &fonts->FontFamilies[fonts->count]) == Ok) fonts->count++; else return 0; return 1; }
INFSTATUS InfpFindNextMatchLine(PINFCONTEXT ContextIn, PCWSTR Key, PINFCONTEXT ContextOut) { PINFCACHELINE CacheLine; if (ContextIn == NULL || ContextOut == NULL || Key == NULL || *Key == 0) return INF_STATUS_INVALID_PARAMETER; if (ContextIn->Inf == NULL || ContextIn->Section == NULL || ContextIn->Line == NULL) return INF_STATUS_INVALID_PARAMETER; CacheLine = (PINFCACHELINE)ContextIn->Line; while (CacheLine != NULL) { if (CacheLine->Key != NULL && strcmpiW (CacheLine->Key, Key) == 0) { if (ContextIn != ContextOut) { ContextOut->Inf = ContextIn->Inf; ContextOut->Section = ContextIn->Section; } ContextOut->Line = (PVOID)CacheLine; return INF_STATUS_SUCCESS; } CacheLine = CacheLine->Next; } return INF_STATUS_NOT_FOUND; }
static const struct dbproperty *get_known_dprop_descr(BSTR name) { int min, max, n; min = 0; max = sizeof(dbproperties)/sizeof(struct dbproperty) - 1; while (min <= max) { int r; n = (min+max)/2; r = strcmpiW(dbproperties[n].name, name); if (!r) break; if (r < 0) min = n+1; else max = n-1; } return (min <= max) ? &dbproperties[n] : NULL; }
PINFCACHESECTION InfpFindSection(PINFCACHE Cache, PCWSTR Name) { PINFCACHESECTION Section = NULL; if (Cache == NULL || Name == NULL) { return NULL; } /* iterate through list of sections */ Section = Cache->FirstSection; while (Section != NULL) { if (strcmpiW(Section->Name, Name) == 0) { return Section; } /* get the next section*/ Section = Section->Next; } return NULL; }
static HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) { int i, rgb = -1; static const WCHAR formatW[] = {'#','%','0','2','x','%','0','2','x','%','0','2','x',0}; if(!color || !*color) { *ret = NULL; return S_OK; } if(*color != '#') { for(i=0; i < sizeof(keyword_table)/sizeof(keyword_table[0]); i++) { if(!strcmpiW(color, keyword_table[i].keyword)) rgb = keyword_table[i].rgb; } } if(rgb == -1) rgb = loose_hex_to_rgb(color); *ret = SysAllocStringLen(NULL, 7); if(!*ret) return E_OUTOFMEMORY; sprintfW(*ret, formatW, rgb>>16, (rgb>>8)&0xff, rgb&0xff); TRACE("%s -> %s\n", debugstr_w(color), debugstr_w(*ret)); return S_OK; }
HRESULT vbdisp_get_id(vbdisp_t *This, BSTR name, vbdisp_invoke_type_t invoke_type, BOOL search_private, DISPID *id) { unsigned i; if(get_func_id(This, name, invoke_type, search_private, id)) return S_OK; for(i=0; i < This->desc->prop_cnt; i++) { if(!search_private && !This->desc->props[i].is_public) continue; if(!strcmpiW(This->desc->props[i].name, name)) { *id = i + This->desc->func_cnt; return S_OK; } } if(This->desc->typeinfo) { HRESULT hres; hres = ITypeInfo_GetIDsOfNames(This->desc->typeinfo, &name, 1, id); if(SUCCEEDED(hres)) return S_OK; } *id = -1; return DISP_E_UNKNOWNNAME; }
LONG InfpGetLineCount(HINF InfHandle, PCWSTR Section) { PINFCACHE Cache; PINFCACHESECTION CacheSection; if (InfHandle == NULL || Section == NULL) { DPRINT("Invalid parameter\n"); return -1; } Cache = (PINFCACHE)InfHandle; /* Iterate through list of sections */ CacheSection = Cache->FirstSection; while (CacheSection != NULL) { /* Are the section names the same? */ if (strcmpiW(CacheSection->Name, Section) == 0) { return CacheSection->LineCount; } /* Get the next section */ CacheSection = CacheSection->Next; } DPRINT("Section not found\n"); return -1; }
static void delete_multi_sz_value( HKEY hkey, const WCHAR *value, const WCHAR *string ) { DWORD size, type; WCHAR *buffer, *src, *dst; if (RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )) return; if (type != REG_MULTI_SZ) return; /* allocate double the size, one for value before and one for after */ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size * 2 * sizeof(WCHAR) ))) return; if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)buffer, &size )) goto done; src = buffer; dst = buffer + size; while (*src) { int len = strlenW(src) + 1; if (strcmpiW( src, string )) { memcpy( dst, src, len * sizeof(WCHAR) ); dst += len; } src += len; } *dst++ = 0; if (dst != buffer + 2*size) /* did we remove something? */ { TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(buffer + size) ); RegSetValueExW( hkey, value, 0, REG_MULTI_SZ, (BYTE *)(buffer + size), dst - (buffer + size) ); } done: HeapFree( GetProcessHeap(), 0, buffer ); }
static void get_font_size(HTMLDocument *This, WCHAR *ret) { nsISelection *nsselection = get_ns_selection(This); nsIDOMHTMLElement *elem = NULL; nsIDOMNode *node = NULL, *tmp_node; nsAString tag_str; LPCWSTR tag; UINT16 node_type; nsresult nsres; *ret = 0; if(!nsselection) return; nsISelection_GetFocusNode(nsselection, &node); nsISelection_Release(nsselection); while(node) { nsres = nsIDOMNode_GetNodeType(node, &node_type); if(NS_FAILED(nsres) || node_type == DOCUMENT_NODE) break; if(node_type == ELEMENT_NODE) { nsIDOMNode_QueryInterface(node, &IID_nsIDOMHTMLElement, (void**)&elem); nsAString_Init(&tag_str, NULL); nsIDOMHTMLElement_GetTagName(elem, &tag_str); nsAString_GetData(&tag_str, &tag); if(!strcmpiW(tag, fontW)) { nsAString val_str; const PRUnichar *val; TRACE("found font tag %p\n", elem); get_elem_attr_value(elem, sizeW, &val_str, &val); if(*val) { TRACE("found size %s\n", debugstr_w(val)); strcpyW(ret, val); } nsAString_Finish(&val_str); } nsAString_Finish(&tag_str); nsIDOMHTMLElement_Release(elem); } if(*ret) break; tmp_node = node; nsIDOMNode_GetParentNode(node, &node); nsIDOMNode_Release(tmp_node); } if(node) nsIDOMNode_Release(node); }
static int fontcmp(const GdiFont *font, FONT_DESC *fd) { if(font->font_desc.hash != fd->hash) return 1; if(memcmp(&font->font_desc.lf, &fd->lf, __builtin_offsetof (LOGFONTW, lfFaceName))) return 1; if(!font->font_desc.can_use_bitmap != !fd->can_use_bitmap) return 1; return strcmpiW(font->font_desc.lf.lfFaceName, fd->lf.lfFaceName); }
/* should be used only when both keys are of string type, it's not checked */ static inline int strcmp_key(const dictionary *dict, const VARIANT *key1, const VARIANT *key2) { const WCHAR *str1, *str2; str1 = get_key_strptr(key1); str2 = get_key_strptr(key2); return dict->method == BinaryCompare ? strcmpW(str1, str2) : strcmpiW(str1, str2); }
/* create devices for mapped drives */ static void create_drive_devices(void) { char *path, *p, *link, *device; struct dos_drive *drive; struct volume *volume; unsigned int i; HKEY drives_key; enum device_type drive_type; WCHAR driveW[] = {'a',':',0}; if (!(path = get_dosdevices_path( &p ))) return; if (RegOpenKeyW( HKEY_LOCAL_MACHINE, drives_keyW, &drives_key )) drives_key = 0; for (i = 0; i < MAX_DOS_DRIVES; i++) { p[0] = 'a' + i; p[2] = 0; if (!(link = read_symlink( path ))) continue; p[2] = ':'; device = read_symlink( path ); drive_type = i < 2 ? DEVICE_FLOPPY : DEVICE_HARDDISK_VOL; if (drives_key) { WCHAR buffer[32]; DWORD j, type, size = sizeof(buffer); driveW[0] = 'a' + i; if (!RegQueryValueExW( drives_key, driveW, NULL, &type, (BYTE *)buffer, &size ) && type == REG_SZ) { for (j = 0; j < sizeof(drive_types)/sizeof(drive_types[0]); j++) if (drive_types[j][0] && !strcmpiW( buffer, drive_types[j] )) { drive_type = j; break; } if (drive_type == DEVICE_FLOPPY && i >= 2) drive_type = DEVICE_HARDDISK; } } volume = find_matching_volume( NULL, device, link, drive_type ); if (!create_dos_device( volume, NULL, i, drive_type, &drive )) { /* don't reset uuid if we used an existing volume */ const GUID *guid = volume ? NULL : get_default_uuid(i); set_volume_info( drive->volume, drive, device, link, drive_type, guid ); } else { RtlFreeHeap( GetProcessHeap(), 0, link ); RtlFreeHeap( GetProcessHeap(), 0, device ); } if (volume) release_volume( volume ); } RegCloseKey( drives_key ); RtlFreeHeap( GetProcessHeap(), 0, path ); }