您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strlenW函数代码示例

51自学网 2021-06-03 08:31:05
  C++
这篇教程C++ strlenW函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中strlenW函数的典型用法代码示例。如果您正苦于以下问题:C++ strlenW函数的具体用法?C++ strlenW怎么用?C++ strlenW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了strlenW函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sc_FNNOTIFY_W

static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin){  FILE_IN_CABINET_INFO_W fici;  PSC_HSC_W phsc;  CABINET_INFO_W ci;  FILEPATHS_W fp;  UINT err;  int len;  WCHAR mysterio[SIZEOF_MYSTERIO]; /* how big? undocumented! */  WCHAR buf[MAX_PATH], buf2[MAX_PATH];  CHAR charbuf[MAX_PATH];  memset(&(mysterio[0]), 0, SIZEOF_MYSTERIO * sizeof(WCHAR));  memset(&(buf[0]), 0, MAX_PATH * sizeof(WCHAR));  memset(&(buf2[0]), 0, MAX_PATH * sizeof(WCHAR));  memset(&(charbuf[0]), 0, MAX_PATH);  TRACE("(fdint == %d, pfdin == ^%p)/n", fdint, pfdin);  if (pfdin && pfdin->pv && (*((void **) pfdin->pv) == (void *)SC_HSC_W_MAGIC))    phsc = pfdin->pv;  else {    ERR("pv %p is not an SC_HSC_W./n", (pfdin) ? pfdin->pv : NULL);    return -1;  }  switch (fdint) {  case fdintCABINET_INFO:    TRACE("Cabinet info notification/n");    /* TRACE("  Cabinet name: %s/n", debugstr_a(pfdin->psz1));    TRACE("  Cabinet disk: %s/n", debugstr_a(pfdin->psz2));    TRACE("  Cabinet path: %s/n", debugstr_a(pfdin->psz3));    TRACE("  Cabinet Set#: %d/n", pfdin->setID);    TRACE("  Cabinet Cab#: %d/n", pfdin->iCabinet); */    WARN("SPFILENOTIFY_CABINETINFO undocumented: guess implementation./n");    ci.CabinetFile = &(phsc->most_recent_cabinet_name[0]);    len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz3, -1, &(buf[0]), MAX_PATH);    if ((len > MAX_PATH) || (len <= 1))      buf[0] = '/0';    ci.CabinetPath = &(buf[0]);    len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz2, -1, &(buf2[0]), MAX_PATH);    if ((len > MAX_PATH) || (len <= 1))      buf2[0] = '/0';    ci.DiskName = &(buf2[0]);    ci.SetId = pfdin->setID;    ci.CabinetNumber = pfdin->iCabinet;    phsc->msghandler(phsc->context, SPFILENOTIFY_CABINETINFO, (UINT_PTR)&ci, 0);    return 0;  case fdintPARTIAL_FILE:    TRACE("Partial file notification/n");    /* TRACE("  Partial file name: %s/n", debugstr_a(pfdin->psz1)); */    return 0;  case fdintCOPY_FILE:    TRACE("Copy file notification/n");    TRACE("  File name: %s/n", debugstr_a(pfdin->psz1));    /* TRACE("  File size: %ld/n", pfdin->cb);    TRACE("  File date: %u/n", pfdin->date);    TRACE("  File time: %u/n", pfdin->time);    TRACE("  File attr: %u/n", pfdin->attribs); */    len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz1, -1, &(buf2[0]), MAX_PATH);    if ((len > MAX_PATH) || (len <= 1))      buf2[0] = '/0';    fici.NameInCabinet = &(buf2[0]);    fici.FileSize = pfdin->cb;    fici.Win32Error = 0;    fici.DosDate = pfdin->date;    fici.DosTime = pfdin->time;    fici.DosAttribs = pfdin->attribs;    memset(&(fici.FullTargetName[0]), 0, MAX_PATH * sizeof(WCHAR));    err = phsc->msghandler(phsc->context, SPFILENOTIFY_FILEINCABINET,                           (UINT_PTR)&fici, (UINT_PTR)pfdin->psz1);    if (err == FILEOP_DOIT) {      TRACE("  Callback specified filename: %s/n", debugstr_w(&(fici.FullTargetName[0])));      if (fici.FullTargetName[0]) {        len = strlenW(&(fici.FullTargetName[0])) + 1;        if ((len > MAX_PATH ) || (len <= 1))          return 0;        if (!WideCharToMultiByte(CP_ACP, 0, &(fici.FullTargetName[0]), len, &(charbuf[0]), MAX_PATH, 0, 0))          return 0;      } else {        WARN("Empty buffer string caused abort./n");        SetLastError(ERROR_PATH_NOT_FOUND);        return -1;      }      return sc_cb_open(&(charbuf[0]), _O_BINARY | _O_CREAT | _O_WRONLY,  _S_IREAD | _S_IWRITE);    } else {      TRACE("  Callback skipped file./n");      return 0;    }  case fdintCLOSE_FILE_INFO:    TRACE("Close file notification/n");    /* TRACE("  File name: %s/n", debugstr_a(pfdin->psz1));    TRACE("  Exec file? %s/n", (pfdin->cb) ? "Yes" : "No");    TRACE("  File hndl: %d/n", pfdin->hf); */    fp.Source = &(phsc->most_recent_cabinet_name[0]);    len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz1, -1, &(buf[0]), MAX_PATH);    if ((len > MAX_PATH) || (len <= 1))      buf[0] = '/0';    fp.Target = &(buf[0]);//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,


示例2: reg_set_string_value

static DWORD reg_set_string_value(HKEY hKey, LPCWSTR value_name, LPCWSTR string){    if (!string)    {        DWORD err;        err = RegDeleteValueW(hKey, value_name);        if (err != ERROR_FILE_NOT_FOUND)            return err;        return ERROR_SUCCESS;    }    return RegSetValueExW(hKey, value_name, 0, REG_SZ, (const BYTE*)string, sizeof(WCHAR)*(strlenW(string) + 1));}
开发者ID:zapot,项目名称:vinassa,代码行数:14,


示例3: service_send_start_message

/****************************************************************************** * service_send_start_message */static BOOL service_send_start_message(struct service_entry *service, HANDLE process_handle,                                       LPCWSTR *argv, DWORD argc){    OVERLAPPED overlapped;    DWORD i, len, result;    service_start_info *ssi;    LPWSTR p;    BOOL r;    WINE_TRACE("%s %p %d/n", wine_dbgstr_w(service->name), argv, argc);    overlapped.hEvent = service->overlapped_event;    if (!ConnectNamedPipe(service->control_pipe, &overlapped))    {        if (GetLastError() == ERROR_IO_PENDING)        {            HANDLE handles[2];            handles[0] = service->overlapped_event;            handles[1] = process_handle;            if (WaitForMultipleObjects( 2, handles, FALSE, service_pipe_timeout ) != WAIT_OBJECT_0)                CancelIo( service->control_pipe );            if (!HasOverlappedCompleted( &overlapped ))            {                WINE_ERR( "service %s failed to start/n", wine_dbgstr_w( service->name ));                return FALSE;            }        }        else if (GetLastError() != ERROR_PIPE_CONNECTED)        {            WINE_ERR("pipe connect failed/n");            return FALSE;        }    }    /* calculate how much space do we need to send the startup info */    len = strlenW(service->name) + 1;    for (i=0; i<argc; i++)        len += strlenW(argv[i])+1;    len++;    ssi = HeapAlloc(GetProcessHeap(),0,FIELD_OFFSET(service_start_info, data[len]));    ssi->cmd = WINESERV_STARTINFO;    ssi->control = 0;    ssi->total_size = FIELD_OFFSET(service_start_info, data[len]);    ssi->name_size = strlenW(service->name) + 1;    strcpyW( ssi->data, service->name );    /* copy service args into a single buffer*/    p = &ssi->data[ssi->name_size];    for (i=0; i<argc; i++)    {        strcpyW(p, argv[i]);        p += strlenW(p) + 1;    }    *p=0;    r = service_send_command( service, service->control_pipe, ssi, ssi->total_size, &result );    if (r && result)    {        SetLastError(result);        r = FALSE;    }    HeapFree(GetProcessHeap(),0,ssi);    return r;}
开发者ID:zapot,项目名称:vinassa,代码行数:70,


示例4: STATUSBAR_SetTextT

static BOOLSTATUSBAR_SetTextT (STATUS_INFO *infoPtr, INT nPart, WORD style,		    LPWSTR text, BOOL isW){    STATUSWINDOWPART *part=NULL;    BOOL changed = FALSE;    INT  oldStyle;    if (style & SBT_OWNERDRAW) {         TRACE("part %d, text %p/n",nPart,text);    }    else TRACE("part %d, text %s/n", nPart, debugstr_t(text, isW));    /* MSDN says: "If the parameter is set to SB_SIMPLEID (255), the status     * window is assumed to be a simple window */    if (nPart == 0x00ff) {	part = &infoPtr->part0;    } else {	if (infoPtr->parts && nPart >= 0 && nPart < infoPtr->numParts) {	    part = &infoPtr->parts[nPart];	}    }    if (!part) return FALSE;    if (part->style != style)	changed = TRUE;    oldStyle = part->style;    part->style = style;    if (style & SBT_OWNERDRAW) {        if (!(oldStyle & SBT_OWNERDRAW))            Free (part->text);        part->text = text;    } else {	LPWSTR ntext;	WCHAR  *idx;	if (text && !isW) {	    LPCSTR atxt = (LPCSTR)text;            DWORD len = MultiByteToWideChar( CP_ACP, 0, atxt, -1, NULL, 0 );	    ntext = Alloc( (len + 1)*sizeof(WCHAR) );	    if (!ntext) return FALSE;            MultiByteToWideChar( CP_ACP, 0, atxt, -1, ntext, len );	} else if (text) {	    ntext = Alloc( (strlenW(text) + 1)*sizeof(WCHAR) );	    if (!ntext) return FALSE;	    strcpyW (ntext, text);	} else ntext = 0;	/* replace nonprintable characters with spaces */	if (ntext) {	    idx = ntext;	    while (*idx) {	        if(!isprintW(*idx))	            *idx = ' ';	        idx++;	    }	}	/* check if text is unchanged -> no need to redraw */	if (text) {	    if (!changed && part->text && !lstrcmpW(ntext, part->text)) {		Free(ntext);		return TRUE;	    }	} else {	    if (!changed && !part->text)		return TRUE;	}	if (!(oldStyle & SBT_OWNERDRAW))	    Free (part->text);	part->text = ntext;    }    InvalidateRect(infoPtr->Self, &part->bound, FALSE);    UpdateWindow(infoPtr->Self);    return TRUE;}
开发者ID:amaneureka,项目名称:reactos,代码行数:80,


示例5: GetAddress

BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort,	struct sockaddr *psa, socklen_t *sa_len){    WCHAR *found;    char *name;    int len, sz;#ifdef HAVE_GETADDRINFO    struct addrinfo *res, hints;    int ret;#else    struct hostent *phe;    struct sockaddr_in *sin = (struct sockaddr_in *)psa;#endif    TRACE("%s/n", debugstr_w(lpszServerName));    /* Validate server name first     * Check if there is sth. like     * pinger.macromedia.com:80     * if yes, eliminate the :80....     */    found = strchrW(lpszServerName, ':');    if (found)        len = found - lpszServerName;    else        len = strlenW(lpszServerName);    sz = WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, NULL, 0, NULL, NULL );    if (!(name = heap_alloc(sz + 1))) return FALSE;    WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL );    name[sz] = 0;#ifdef HAVE_GETADDRINFO    memset( &hints, 0, sizeof(struct addrinfo) );    /* Prefer IPv4 to IPv6 addresses, since some servers do not listen on     * their IPv6 addresses even though they have IPv6 addresses in the DNS.     */    hints.ai_family = AF_INET;    ret = getaddrinfo( name, NULL, &hints, &res );    HeapFree( GetProcessHeap(), 0, name );    if (ret != 0)    {        TRACE("failed to get IPv4 address of %s (%s), retrying with IPv6/n", debugstr_w(lpszServerName), gai_strerror(ret));        hints.ai_family = AF_INET6;        ret = getaddrinfo( name, NULL, &hints, &res );        if (ret != 0)        {            TRACE("failed to get address of %s (%s)/n", debugstr_w(lpszServerName), gai_strerror(ret));            return FALSE;        }    }    if (*sa_len < res->ai_addrlen)    {        WARN("address too small/n");        freeaddrinfo( res );        return FALSE;    }    *sa_len = res->ai_addrlen;    memcpy( psa, res->ai_addr, res->ai_addrlen );    /* Copy port */    switch (res->ai_family)    {    case AF_INET:        ((struct sockaddr_in *)psa)->sin_port = htons(nServerPort);        break;    case AF_INET6:        ((struct sockaddr_in6 *)psa)->sin6_port = htons(nServerPort);        break;    }    freeaddrinfo( res );#else    EnterCriticalSection( &cs_gethostbyname );    phe = gethostbyname(name);    HeapFree( GetProcessHeap(), 0, name );    if (NULL == phe)    {        TRACE("failed to get address of %s (%d)/n", debugstr_w(lpszServerName), h_errno);        LeaveCriticalSection( &cs_gethostbyname );        return FALSE;    }    if (*sa_len < sizeof(struct sockaddr_in))    {        WARN("address too small/n");        LeaveCriticalSection( &cs_gethostbyname );        return FALSE;    }    *sa_len = sizeof(struct sockaddr_in);    memset(sin,0,sizeof(struct sockaddr_in));    memcpy((char *)&sin->sin_addr, phe->h_addr, phe->h_length);    sin->sin_family = phe->h_addrtype;    sin->sin_port = htons(nServerPort);    LeaveCriticalSection( &cs_gethostbyname );#endif    return TRUE;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:99,


示例6: set_windows_hook

/*********************************************************************** *		set_windows_hook * * Implementation of SetWindowsHookExA and SetWindowsHookExW. */static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid, BOOL unicode ){    HHOOK handle = 0;    WCHAR module[MAX_PATH];    DWORD len;    if (!proc)    {        SetLastError( ERROR_INVALID_FILTER_PROC );        return 0;    }    if (tid)  /* thread-local hook */    {        if (id == WH_JOURNALRECORD ||            id == WH_JOURNALPLAYBACK ||            id == WH_KEYBOARD_LL ||            id == WH_MOUSE_LL ||            id == WH_SYSMSGFILTER)        {            /* these can only be global */            SetLastError( ERROR_INVALID_PARAMETER );            return 0;        }    }    else  /* system-global hook */    {        if (id == WH_KEYBOARD_LL || id == WH_MOUSE_LL) inst = 0;        else if (!inst)        {            SetLastError( ERROR_HOOK_NEEDS_HMOD );            return 0;        }    }    if (inst && (!(len = GetModuleFileNameW( inst, module, MAX_PATH )) || len >= MAX_PATH))    {        SetLastError( ERROR_INVALID_PARAMETER );        return 0;    }    SERVER_START_REQ( set_hook )    {        req->id        = id;        req->pid       = 0;        req->tid       = tid;        req->event_min = EVENT_MIN;        req->event_max = EVENT_MAX;        req->flags     = WINEVENT_INCONTEXT;        req->unicode   = unicode;        if (inst) /* make proc relative to the module base */        {            req->proc = wine_server_client_ptr( (void *)((char *)proc - (char *)inst) );            wine_server_add_data( req, module, strlenW(module) * sizeof(WCHAR) );        }        else req->proc = wine_server_client_ptr( proc );        if (!wine_server_call_err( req ))        {            handle = wine_server_ptr_handle( reply->handle );            get_user_thread_info()->active_hooks = reply->active_hooks;        }    }    SERVER_END_REQ;    TRACE( "%s %p %x -> %p/n", hook_names[id-WH_MINHOOK], proc, tid, handle );    return handle;}
开发者ID:VOID001,项目名称:wine-void,代码行数:73,


示例7: WINE_TRACE

static LPWSTR *get_extrac_args(LPWSTR cmdline, int *pargc){    enum {OUTSIDE_ARG, INSIDE_ARG, INSIDE_QUOTED_ARG} state;    LPWSTR str;    int argc;    LPWSTR *argv;    int max_argc = 16;    BOOL new_arg;    WINE_TRACE("cmdline: %s/n", wine_dbgstr_w(cmdline));    str = HeapAlloc(GetProcessHeap(), 0, (strlenW(cmdline) + 1) * sizeof(WCHAR));    if(!str) return NULL;    strcpyW(str, cmdline);    argv = HeapAlloc(GetProcessHeap(), 0, (max_argc + 1) * sizeof(LPWSTR));    if(!argv)    {        HeapFree(GetProcessHeap(), 0, str);        return NULL;    }    /* Split command line to separate arg-strings and fill argv */    state = OUTSIDE_ARG;    argc = 0;    while(*str)    {        new_arg = FALSE;        /* Check character */        if(isspaceW(*str))          /* white space */        {            if(state == INSIDE_ARG)            {                state = OUTSIDE_ARG;                *str = 0;            }        }        else if(*str == '"')        /* double quote */            switch(state)            {                case INSIDE_QUOTED_ARG:                    state = OUTSIDE_ARG;                    *str = 0;                    break;                case INSIDE_ARG:                    *str = 0;                    /* Fall through */                case OUTSIDE_ARG:                    if(!*++str) continue;                    state = INSIDE_QUOTED_ARG;                    new_arg = TRUE;                    break;            }        else                        /* regular character */            if(state == OUTSIDE_ARG)            {                state = INSIDE_ARG;                new_arg = TRUE;            }        /* Add new argv entry, if need */        if(new_arg)        {            if(argc >= max_argc - 1)            {                /* Realloc argv here because there always should be                   at least one reserved cell for terminating NULL */                max_argc *= 2;                argv = HeapReAlloc(GetProcessHeap(), 0, argv,                        (max_argc + 1) * sizeof(LPWSTR));                if(!argv)                {                    HeapFree(GetProcessHeap(), 0, str);                    return NULL;                }            }            argv[argc++] = str;        }        str++;    }    argv[argc] = NULL;    *pargc = argc;    if(TRACE_ON(extrac32))    {        int i;        for(i = 0; i < argc; i++)            WINE_TRACE("arg %d: %s/n", i, wine_dbgstr_w(argv[i]));    }    return argv;}
开发者ID:AmineKhaldi,项目名称:reactos,代码行数:91,


示例8: DrawTextExW

INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count,                        LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp ){    SIZE size;    const WCHAR *strPtr;    WCHAR *retstr, *p_retstr;    size_t size_retstr;    WCHAR line[MAX_BUFFER];    int len, lh, count=i_count;    TEXTMETRICW tm;    int lmargin = 0, rmargin = 0;    int x = rect->left, y = rect->top;    int width = rect->right - rect->left;    int max_width = 0;    int last_line;    int tabwidth /* to keep gcc happy */ = 0;    int prefix_offset;    ellipsis_data ellip;    TRACE("%s, %d, [%s] %08x/n", debugstr_wn (str, count), count,        wine_dbgstr_rect(rect), flags);   if (dtp) TRACE("Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d/n",          dtp->iTabLength, dtp->iLeftMargin, dtp->iRightMargin);    if (!str || count == 0) return 0;    if (count == -1)    {        count = strlenW(str);        if (count == 0)        {            if( flags & DT_CALCRECT)            {                rect->right = rect->left;                rect->bottom = rect->top;            }            return 0;        }    }    strPtr = str;    if (flags & DT_SINGLELINE)        flags &= ~DT_WORDBREAK;    GetTextMetricsW(hdc, &tm);    if (flags & DT_EXTERNALLEADING)	lh = tm.tmHeight + tm.tmExternalLeading;    else	lh = tm.tmHeight;    if (dtp)    {        lmargin = dtp->iLeftMargin * tm.tmAveCharWidth;        rmargin = dtp->iRightMargin * tm.tmAveCharWidth;        if (!(flags & (DT_CENTER | DT_RIGHT)))            x += lmargin;        dtp->uiLengthDrawn = 0;     /* This param RECEIVES number of chars processed */    }    if (flags & DT_EXPANDTABS)    {        int tabstop = ((flags & DT_TABSTOP) && dtp) ? dtp->iTabLength : 8;	tabwidth = tm.tmAveCharWidth * tabstop;    }    if (flags & DT_CALCRECT) flags |= DT_NOCLIP;    if (flags & DT_MODIFYSTRING)    {        size_retstr = (count + 4) * sizeof (WCHAR);        retstr = HeapAlloc(GetProcessHeap(), 0, size_retstr);        if (!retstr) return 0;        memcpy (retstr, str, size_retstr);    }    else    {        size_retstr = 0;        retstr = NULL;    }    p_retstr = retstr;    do    {	len = sizeof(line)/sizeof(line[0]);        last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom;	strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip);	if (flags & DT_CENTER) x = (rect->left + rect->right -				    size.cx) / 2;	else if (flags & DT_RIGHT) x = rect->right - size.cx;	if (flags & DT_SINGLELINE)	{	    if (flags & DT_VCENTER) y = rect->top +	    	(rect->bottom - rect->top) / 2 - size.cy / 2;	    else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;        }	if (!(flags & DT_CALCRECT))	{//.........这里部分代码省略.........
开发者ID:WASSUM,项目名称:longene_travel,代码行数:101,


示例9: SYSLINK_ParseText

//.........这里部分代码省略.........                    Last = SYSLINK_AppendDocItem(infoPtr, textstart, firsttag - textstart, slText, Last);                    if(Last == NULL)                    {                        ERR("Unable to create new document item!/n");                        return docitems;                    }                    docitems++;                    textstart = NULL;                    textlen = 0;                }                                /* now it's time to add the link to the document */                current += 4;                if(linktext != NULL && linklen > 0)                {                    Last = SYSLINK_AppendDocItem(infoPtr, linktext, linklen, slLink, Last);                    if(Last == NULL)                    {                        ERR("Unable to create new document item!/n");                        return docitems;                    }                    docitems++;                    if(CurrentType == slLink)                    {                        int nc;                        if(!(infoPtr->Style & WS_DISABLED))                        {                            Last->u.Link.state |= LIS_ENABLED;                        }                        /* Copy the tag parameters */                        if(lpID != NULL)                        {                            nc = min(lenId, strlenW(lpID));                            nc = min(nc, MAX_LINKID_TEXT - 1);                            Last->u.Link.szID = Alloc((nc + 1) * sizeof(WCHAR));                            if(Last->u.Link.szID != NULL)                            {                                lstrcpynW(Last->u.Link.szID, lpID, nc + 1);                            }                        }                        else                            Last->u.Link.szID = NULL;                        if(lpUrl != NULL)                        {                            nc = min(lenUrl, strlenW(lpUrl));                            nc = min(nc, L_MAX_URL_LENGTH - 1);                            Last->u.Link.szUrl = Alloc((nc + 1) * sizeof(WCHAR));                            if(Last->u.Link.szUrl != NULL)                            {                                lstrcpynW(Last->u.Link.szUrl, lpUrl, nc + 1);                            }                        }                        else                            Last->u.Link.szUrl = NULL;                    }                    linktext = NULL;                }                CurrentType = slText;                firsttag = NULL;                textstart = NULL;                continue;            }            else            {                /* we don't know what tag it is, so just continue */
开发者ID:bpon,项目名称:wine,代码行数:67,


示例10: BrsFolder_NewFolder

static HRESULT BrsFolder_NewFolder(browse_info *info){    DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);    IShellFolder *desktop, *cur;    ISFHelper *sfhelper;    WCHAR name[MAX_PATH];    HTREEITEM parent, added;    LPTV_ITEMDATA item_data;    LPITEMIDLIST new_item;    TVITEMW item;    HRESULT hr;    int len;    if(!info->pidlRet) {        ERR("Make new folder button should be disabled/n");        return E_FAIL;    }    /* Create new directory */    hr = SHGetDesktopFolder(&desktop);    if(FAILED(hr))        return hr;    hr = IShellFolder_BindToObject(desktop, info->pidlRet, 0, &IID_IShellFolder, (void**)&cur);    IShellFolder_Release(desktop);    if(FAILED(hr))        return hr;    hr = IShellFolder_QueryInterface(cur, &IID_ISFHelper, (void**)&sfhelper);    if(FAILED(hr))        return hr;    hr = SHGetPathFromIDListW(info->pidlRet, name);    if(FAILED(hr))        goto cleanup;    len = strlenW(name);    if(len<MAX_PATH)        name[len++] = '//';    hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);    ISFHelper_Release(sfhelper);    if(FAILED(hr))        goto cleanup;    hr = E_FAIL;    if(!CreateDirectoryW(name, NULL))        goto cleanup;    /* Update parent of newly created directory */    parent = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);    if(!parent)        goto cleanup;    SendMessageW(info->hwndTreeView, TVM_EXPAND, TVE_EXPAND, (LPARAM)parent);    memset(&item, 0, sizeof(TVITEMW));    item.mask = TVIF_PARAM|TVIF_STATE;    item.hItem = parent;    SendMessageW(info->hwndTreeView, TVM_GETITEMW, 0, (LPARAM)&item);    item_data = (LPTV_ITEMDATA)item.lParam;    if(!item_data)        goto cleanup;    if(item_data->pEnumIL)        IEnumIDList_Release(item_data->pEnumIL);    hr = IShellFolder_EnumObjects(cur, info->hwndTreeView, flags, &item_data->pEnumIL);    if(FAILED(hr))        goto cleanup;    /* Update treeview */    if(!(item.state&TVIS_EXPANDEDONCE)) {        item.mask = TVIF_STATE;        item.state = TVIS_EXPANDEDONCE;        item.stateMask = TVIS_EXPANDEDONCE;        SendMessageW(info->hwndTreeView, TVM_SETITEMW, 0, (LPARAM)&item);    }    hr = IShellFolder_ParseDisplayName(cur, NULL, NULL, name+len, NULL, &new_item, NULL);    if(FAILED(hr))        goto cleanup;    added = InsertTreeViewItem(info, cur, new_item, item_data->lpifq, NULL, parent);    IShellFolder_Release(cur);    SHFree(new_item);    SendMessageW(info->hwndTreeView, TVM_SORTCHILDREN, FALSE, (LPARAM)parent);    return BrsFolder_Rename(info, added);cleanup:    return hr;}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:90,


示例11: TEXT_PathEllipsify

/********************************************************************* *                      TEXT_PathEllipsify (static) * * Add an ellipsis to the provided string in order to make it fit within * the width.  The ellipsis is added as specified for the DT_PATH_ELLIPSIS * flag. * * See Also TEXT_Ellipsify * * Arguments *   hdc        [in] The handle to the DC that defines the font. *   str        [in/out] The string that needs to be modified *   max_str    [in] The dimension of str (number of WCHAR). *   len_str    [in/out] The number of characters in str *   width      [in] The maximum width permitted (in logical coordinates) *   size       [out] The dimensions of the text *   modstr     [out] The modified form of the string, to be returned to the *                    calling program.  It is assumed that the caller has *                    made sufficient space available so we don't need to *                    know the size of the space.  This pointer may be NULL if *                    the modified string is not required. *   pellip     [out] The ellipsification results * * For now we will simply use three dots rather than worrying about whether * the font contains an explicit ellipsis character. * * The following applies, I think to Win95.  We will need to extend it for * Win98 which can have both path and end ellipsis at the same time (e.g. *  C:/MyLongFileName.Txt becomes .../MyLongFileN...) * * The resulting string consists of as much as possible of the following: * 1. The ellipsis itself * 2. The last / or / of the string (if any) * 3. Everything after the last / or / of the string (if any) or the whole *    string if there is no / or /.  I believe that under Win95 this would *    include everything even though some might be clipped off the end whereas *    under Win98 that might be ellipsified too. *    Yet to be investigated is whether this would include wordbreaking if the *    filename is more than 1 word and splitting if DT_EDITCONTROL was in *    effect.  (If DT_EDITCONTROL is in effect then on occasions text will be *    broken within words). * 4. All the stuff before the / or /, which is placed before the ellipsis. */static void TEXT_PathEllipsify (HDC hdc, WCHAR *str, unsigned int max_len,                                unsigned int *len_str, int width, SIZE *size,                                WCHAR *modstr, ellipsis_data *pellip){    int len_ellipsis;    int len_trailing;    int len_under;    WCHAR *lastBkSlash, *lastFwdSlash, *lastSlash;    len_ellipsis = strlenW (ELLIPSISW);    if (!max_len) return;    if (len_ellipsis >= max_len) len_ellipsis = max_len - 1;    if (*len_str + len_ellipsis >= max_len)        *len_str = max_len - len_ellipsis-1;        /* Hopefully this will never happen, otherwise it would probably lose         * the wrong character         */    str[*len_str] = '/0'; /* to simplify things */    lastBkSlash  = strrchrW (str, BACK_SLASH);    lastFwdSlash = strrchrW (str, FORWARD_SLASH);    lastSlash = lastBkSlash > lastFwdSlash ? lastBkSlash : lastFwdSlash;    if (!lastSlash) lastSlash = str;    len_trailing = *len_str - (lastSlash - str);    /* overlap-safe movement to the right */    memmove (lastSlash+len_ellipsis, lastSlash, len_trailing * sizeof(WCHAR));    memcpy (lastSlash, ELLIPSISW, len_ellipsis*sizeof(WCHAR));    len_trailing += len_ellipsis;    /* From this point on lastSlash actually points to the ellipsis in front     * of the last slash and len_trailing includes the ellipsis     */    len_under = 0;    for ( ; ; )    {        if (!GetTextExtentExPointW (hdc, str, *len_str + len_ellipsis, width,                                    NULL, NULL, size)) break;        if (lastSlash == str || size->cx <= width) break;        /* overlap-safe movement to the left */        memmove (lastSlash-1, lastSlash, len_trailing * sizeof(WCHAR));        lastSlash--;        len_under++;        assert (*len_str);        (*len_str)--;    }    pellip->before = lastSlash-str;    pellip->len = len_ellipsis;    pellip->under = len_under;    pellip->after = len_trailing - len_ellipsis;    *len_str += len_ellipsis;    if (modstr)    {//.........这里部分代码省略.........
开发者ID:WASSUM,项目名称:longene_travel,代码行数:101,


示例12: ITSProtocol_Start

static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,        IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,        DWORD grfPI, HANDLE_PTR dwReserved){    ITSProtocol *This = impl_from_IInternetProtocol(iface);    BINDINFO bindinfo;    DWORD bindf = 0, len;    LPWSTR file_name, mime, object_name, p;    LPCWSTR ptr;    struct chmFile *chm_file;    struct chmUnitInfo chm_object;    int res;    HRESULT hres;    static const WCHAR separator[] = {':',':',0};    TRACE("(%p)->(%s %p %p %08x %lx)/n", This, debugstr_w(szUrl), pOIProtSink,            pOIBindInfo, grfPI, dwReserved);    ptr = skip_schema(szUrl);    if(!ptr)        return INET_E_USE_DEFAULT_PROTOCOLHANDLER;    memset(&bindinfo, 0, sizeof(bindinfo));    bindinfo.cbSize = sizeof(BINDINFO);    hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &bindf, &bindinfo);    if(FAILED(hres)) {        WARN("GetBindInfo failed: %08x/n", hres);        return hres;    }    ReleaseBindInfo(&bindinfo);    len = strlenW(ptr)+3;    file_name = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));    memcpy(file_name, ptr, len*sizeof(WCHAR));    hres = UrlUnescapeW(file_name, NULL, &len, URL_UNESCAPE_INPLACE);    if(FAILED(hres)) {        WARN("UrlUnescape failed: %08x/n", hres);        HeapFree(GetProcessHeap(), 0, file_name);        return hres;    }    p = strstrW(file_name, separator);    if(!p) {        WARN("invalid url/n");        HeapFree(GetProcessHeap(), 0, file_name);        return report_result(pOIProtSink, STG_E_FILENOTFOUND);    }    *p = 0;    chm_file = chm_openW(file_name);    if(!chm_file) {        WARN("Could not open chm file/n");        HeapFree(GetProcessHeap(), 0, file_name);        return report_result(pOIProtSink, STG_E_FILENOTFOUND);    }    object_name = p+2;    len = strlenW(object_name);    if(*object_name != '/' && *object_name != '//') {        memmove(object_name+1, object_name, (len+1)*sizeof(WCHAR));        *object_name = '/';        len++;    }    if(object_name[len-1] == '/')        object_name[--len] = 0;    for(p=object_name; *p; p++) {        if(*p == '//')            *p = '/';    }    remove_dot_segments(object_name);    TRACE("Resolving %s/n", debugstr_w(object_name));    memset(&chm_object, 0, sizeof(chm_object));    res = chm_resolve_object(chm_file, object_name, &chm_object);    if(res != CHM_RESOLVE_SUCCESS) {        WARN("Could not resolve chm object/n");        HeapFree(GetProcessHeap(), 0, file_name);        chm_close(chm_file);        return report_result(pOIProtSink, STG_E_FILENOTFOUND);    }    IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST,                                         strrchrW(object_name, '/')+1);    /* FIXME: Native doesn't use FindMimeFromData */    hres = FindMimeFromData(NULL, object_name, NULL, 0, NULL, 0, &mime, 0);    HeapFree(GetProcessHeap(), 0, file_name);    if(SUCCEEDED(hres)) {        IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, mime);        CoTaskMemFree(mime);    }    release_chm(This); /* Native leaks handle here *///.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,


示例13: processRegLinesW

static void processRegLinesW(FILE *in){    WCHAR* buf           = NULL;  /* line read from input stream */    ULONG lineSize       = REG_VAL_BUF_SIZE;    size_t CharsInBuf = -1;    WCHAR* s; /* The pointer into buf for where the current fgets should read */    WCHAR* line; /* The start of the current line */    buf = HeapAlloc(GetProcessHeap(), 0, lineSize * sizeof(WCHAR));    CHECK_ENOUGH_MEMORY(buf);    s = buf;    line = buf;    while(!feof(in)) {        size_t size_remaining;        int size_to_get;        WCHAR *s_eol = NULL; /* various local uses */        /* Do we need to expand the buffer ? */        assert (s >= buf && s <= buf + lineSize);        size_remaining = lineSize - (s-buf);        if (size_remaining < 2) /* room for 1 character and the /0 */        {            WCHAR *new_buffer;            size_t new_size = lineSize + (REG_VAL_BUF_SIZE / sizeof(WCHAR));            if (new_size > lineSize) /* no arithmetic overflow */                new_buffer = HeapReAlloc (GetProcessHeap(), 0, buf, new_size * sizeof(WCHAR));            else                new_buffer = NULL;            CHECK_ENOUGH_MEMORY(new_buffer);            buf = new_buffer;            line = buf;            s = buf + lineSize - size_remaining;            lineSize = new_size;            size_remaining = lineSize - (s-buf);        }        /* Get as much as possible into the buffer, terminated either by        * eof, error or getting the maximum amount.  Abort on error.        */        size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining);        CharsInBuf = fread(s, sizeof(WCHAR), size_to_get - 1, in);        s[CharsInBuf] = 0;        if (CharsInBuf == 0) {            if (ferror(in)) {                perror ("While reading input");                exit (IO_ERROR);            } else {                assert (feof(in));                *s = '/0';                /* It is not clear to me from the definition that the                * contents of the buffer are well defined on detecting                * an eof without managing to read anything.                */            }        }        /* If we didn't read the eol nor the eof go around for the rest */        while(1)        {            const WCHAR line_endings[] = {'/r','/n',0};            s_eol = strpbrkW(line, line_endings);            if(!s_eol) {                /* Move the stub of the line to the start of the buffer so                 * we get the maximum space to read into, and so we don't                 * have to recalculate 'line' if the buffer expands */                MoveMemory(buf, line, (strlenW(line)+1) * sizeof(WCHAR));                line = buf;                s = strchrW(line, '/0');                break;            }            /* If it is a comment line then discard it and go around again */            if (*line == '#' || *line == ';') {                if (*s_eol == '/r' && *(s_eol+1) == '/n')                    line = s_eol + 2;                else                    line = s_eol + 1;                continue;            }            /* If there is a concatenating // then go around again */            if (*(s_eol-1) == '//') {                WCHAR* NextLine = s_eol + 1;                if(*s_eol == '/r' && *(s_eol+1) == '/n')                    NextLine++;                while(*(NextLine+1) == ' ' || *(NextLine+1) == '/t')                    NextLine++;                MoveMemory(s_eol - 1, NextLine, (CharsInBuf - (NextLine - s) + 1)*sizeof(WCHAR));                CharsInBuf -= NextLine - s_eol + 1;                s_eol = 0;                continue;//.........这里部分代码省略.........
开发者ID:bdidemus,项目名称:wine,代码行数:101,


示例14: DEVENUM_ReadPins

static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2){    HKEY hkeyPins = NULL;    DWORD dwPinsSubkeys, i;    REGFILTERPINS *rgPins = NULL;    if (RegOpenKeyExW(hkeyFilterClass, wszPins, 0, KEY_READ, &hkeyPins) != ERROR_SUCCESS)        return ;    if (RegQueryInfoKeyW(hkeyPins, NULL, NULL, NULL, &dwPinsSubkeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL)                != ERROR_SUCCESS)    {        RegCloseKey(hkeyPins);        return ;    }    if (dwPinsSubkeys)    {        rgPins = CoTaskMemAlloc(sizeof(REGFILTERPINS) * dwPinsSubkeys);        if (!rgPins)        {            RegCloseKey(hkeyPins);            return ;        }    }    for (i = 0; i < dwPinsSubkeys; i++)    {        HKEY hkeyPinKey = NULL;        WCHAR wszPinName[MAX_PATH];        DWORD cName = sizeof(wszPinName) / sizeof(WCHAR);        DWORD Type, cbData;        REGFILTERPINS *rgPin = &rgPins[rgf2->u.s1.cPins];        LONG lRet;        rgPin->strName = NULL;        rgPin->clsConnectsToFilter = &GUID_NULL;        rgPin->strConnectsToPin = NULL;        rgPin->nMediaTypes = 0;        rgPin->lpMediaType = NULL;        if (RegEnumKeyExW(hkeyPins, i, wszPinName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue;        if (RegOpenKeyExW(hkeyPins, wszPinName, 0, KEY_READ, &hkeyPinKey) != ERROR_SUCCESS) continue;        rgPin->strName = CoTaskMemAlloc((strlenW(wszPinName) + 1) * sizeof(WCHAR));        if (!rgPin->strName) goto error_cleanup;        strcpyW(rgPin->strName, wszPinName);        cbData = sizeof(rgPin->bMany);        lRet = RegQueryValueExW(hkeyPinKey, wszAllowedMany, NULL, &Type, (LPBYTE)&rgPin->bMany, &cbData);        if (lRet != ERROR_SUCCESS || Type != REG_DWORD)            goto error_cleanup;        cbData = sizeof(rgPin->bZero);        lRet = RegQueryValueExW(hkeyPinKey, wszAllowedZero, NULL, &Type, (LPBYTE)&rgPin->bZero, &cbData);        if (lRet != ERROR_SUCCESS || Type != REG_DWORD)            goto error_cleanup;        cbData = sizeof(rgPin->bOutput);        lRet = RegQueryValueExW(hkeyPinKey, wszDirection, NULL, &Type, (LPBYTE)&rgPin->bOutput, &cbData);        if (lRet != ERROR_SUCCESS || Type != REG_DWORD)            goto error_cleanup;        cbData = sizeof(rgPin->bRendered);        lRet = RegQueryValueExW(hkeyPinKey, wszIsRendered, NULL, &Type, (LPBYTE)&rgPin->bRendered, &cbData);        if (lRet != ERROR_SUCCESS || Type != REG_DWORD)            goto error_cleanup;        DEVENUM_ReadPinTypes(hkeyPinKey, rgPin);        ++rgf2->u.s1.cPins;        continue;        error_cleanup:        RegCloseKey(hkeyPinKey);        CoTaskMemFree(rgPin->strName);    }    RegCloseKey(hkeyPins);    if (rgPins && !rgf2->u.s1.cPins)    {        CoTaskMemFree(rgPins);        rgPins = NULL;    }    rgf2->u.s1.rgPins = rgPins;}
开发者ID:amaneureka,项目名称:reactos,代码行数:91,


示例15: CommandLineToArgvW

//.........这里部分代码省略.........        {            /* space */            argc++;            /* skip the remaining spaces */            while (*cs==0x0009 || *cs==0x0020) {                cs++;            }            if (*cs==0)                break;            bcount=0;            continue;        }        else if (*cs==0x005c)        {            /* '/', count them */            bcount++;        }        else if ((*cs==0x0022) && ((bcount & 1)==0))        {            /* unescaped '"' */            in_quotes=!in_quotes;            bcount=0;        }        else        {            /* a regular character */            bcount=0;        }        cs++;    }    /* Allocate in a single lump, the string array, and the strings that go with it.     * This way the caller can make a single GlobalFree call to free both, as per MSDN.     */    argv=LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));    if (!argv)        return NULL;    cmdline=(LPWSTR)(argv+argc);    strcpyW(cmdline, lpCmdline);    argc=0;    bcount=0;    in_quotes=0;    arg=d=s=cmdline;    while (*s)    {        if ((*s==0x0009 || *s==0x0020) && !in_quotes)        {            /* Close the argument and copy it */            *d=0;            argv[argc++]=arg;            /* skip the remaining spaces */            do {                s++;            } while (*s==0x0009 || *s==0x0020);            /* Start with a new argument */            arg=d=s;            bcount=0;        }        else if (*s==0x005c)        {            /* '//' */            *d++=*s++;            bcount++;        }
开发者ID:r6144,项目名称:wine,代码行数:67,


示例16: IAssemblyNameImpl_GetDisplayName

static HRESULT WINAPI IAssemblyNameImpl_GetDisplayName(IAssemblyName *iface,                                                       LPOLESTR szDisplayName,                                                       LPDWORD pccDisplayName,                                                       DWORD dwDisplayFlags){    static const WCHAR equals[] = {'=',0};    IAssemblyNameImpl *name = impl_from_IAssemblyName(iface);    WCHAR verstr[30], *cultureval = NULL;    DWORD size;    TRACE("(%p, %p, %p, %d)/n", iface, szDisplayName,          pccDisplayName, dwDisplayFlags);    if (dwDisplayFlags == 0)    {        if (!name->displayname || !*name->displayname)            return FUSION_E_INVALID_NAME;        size = strlenW(name->displayname) + 1;        if (*pccDisplayName < size)        {            *pccDisplayName = size;            return E_NOT_SUFFICIENT_BUFFER;        }        if (szDisplayName) strcpyW(szDisplayName, name->displayname);        *pccDisplayName = size;        return S_OK;    }    if (!name->name || !*name->name)        return FUSION_E_INVALID_NAME;    /* Verify buffer size is sufficient */    size = lstrlenW(name->name) + 1;    if ((dwDisplayFlags & ASM_DISPLAYF_VERSION) && (name->versize > 0))    {        static const WCHAR spec[] = {'%','d',0};        static const WCHAR period[] = {'.',0};        DWORD i;        wsprintfW(verstr, spec, name->version[0]);        for (i = 1; i < name->versize; i++)        {            WCHAR value[6];            wsprintfW(value, spec, name->version[i]);            lstrcatW(verstr, period);            lstrcatW(verstr, value);        }        size += lstrlenW(separator) + lstrlenW(version) + lstrlenW(equals) + lstrlenW(verstr);    }    if ((dwDisplayFlags & ASM_DISPLAYF_CULTURE) && (name->culture))    {        static const WCHAR neutral[] = {'n','e','u','t','r','a','l', 0};        cultureval = (lstrlenW(name->culture) == 2) ? name->culture : (LPWSTR) neutral;        size += lstrlenW(separator) + lstrlenW(culture) + lstrlenW(equals) + lstrlenW(cultureval);    }    if ((dwDisplayFlags & ASM_DISPLAYF_PUBLIC_KEY_TOKEN) && (name->haspubkey))        size += lstrlenW(separator) + lstrlenW(pubkey) + lstrlenW(equals) + CHARS_PER_PUBKEY;    if ((dwDisplayFlags & ASM_DISPLAYF_PROCESSORARCHITECTURE) && (name->procarch))        size += lstrlenW(separator) + lstrlenW(procarch) + lstrlenW(equals) + lstrlenW(name->procarch);    if (size > *pccDisplayName)    {        *pccDisplayName = size;        return E_NOT_SUFFICIENT_BUFFER;    }    /* Construct the string */    lstrcpyW(szDisplayName, name->name);    if ((dwDisplayFlags & ASM_DISPLAYF_VERSION) && (name->versize > 0))    {        lstrcatW(szDisplayName, separator);        lstrcatW(szDisplayName, version);        lstrcatW(szDisplayName, equals);        lstrcatW(szDisplayName, verstr);    }    if ((dwDisplayFlags & ASM_DISPLAYF_CULTURE) && (name->culture))    {        lstrcatW(szDisplayName, separator);        lstrcatW(szDisplayName, culture);        lstrcatW(szDisplayName, equals);        lstrcatW(szDisplayName, cultureval);    }    if ((dwDisplayFlags & ASM_DISPLAYF_PUBLIC_KEY_TOKEN) && (name->haspubkey))//.........这里部分代码省略.........
开发者ID:amaneureka,项目名称:reactos,代码行数:101,


示例17: AddOrUpdateHwnd

static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung){    LPAPPLICATION_PAGE_LIST_ITEM    pAPLI = NULL;    HIMAGELIST                      hImageListLarge;    HIMAGELIST                      hImageListSmall;    LV_ITEMW                        item;    int                             i, count;    BOOL                            bAlreadyInList = FALSE;    BOOL                            bItemRemoved = FALSE;    memset(&item, 0, sizeof(LV_ITEMW));    /* Get the image lists */    hImageListLarge = (HIMAGELIST)SendMessageW(hApplicationPageListCtrl, LVM_GETIMAGELIST, LVSIL_NORMAL, 0);    hImageListSmall = (HIMAGELIST)SendMessageW(hApplicationPageListCtrl, LVM_GETIMAGELIST, LVSIL_SMALL, 0);    count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);    /* Check to see if it's already in our list */    for (i=0; i<count; i++)    {        memset(&item, 0, sizeof(LV_ITEMW));        item.mask = LVIF_IMAGE|LVIF_PARAM;        item.iItem = i;        SendMessageW(hApplicationPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &item);        pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;        if (pAPLI->hWnd == hWnd)        {            bAlreadyInList = TRUE;            break;        }    }    /* If it is already in the list then update it if necessary */    if (bAlreadyInList)    {        /* Check to see if anything needs updating */        if ((pAPLI->hIcon != hIcon) ||            (strcmpW(pAPLI->wszTitle, wszTitle) != 0) ||            (pAPLI->bHung != bHung))        {            /* Update the structure */            pAPLI->hIcon = hIcon;            pAPLI->bHung = bHung;            strcpyW(pAPLI->wszTitle, wszTitle);            /* Update the image list */            ImageList_ReplaceIcon(hImageListLarge, item.iItem, hIcon);            ImageList_ReplaceIcon(hImageListSmall, item.iItem, hIcon);            /* Update the list view */            count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);            SendMessageW(hApplicationPageListCtrl, LVM_REDRAWITEMS, 0, count);            /* UpdateWindow(hApplicationPageListCtrl); */            InvalidateRect(hApplicationPageListCtrl, NULL, 0);        }    }    /* It is not already in the list so add it */    else    {        pAPLI = HeapAlloc(GetProcessHeap(), 0, sizeof(APPLICATION_PAGE_LIST_ITEM));        pAPLI->hWnd = hWnd;        pAPLI->hIcon = hIcon;        pAPLI->bHung = bHung;        strcpyW(pAPLI->wszTitle, wszTitle);        /* Add the item to the list */        memset(&item, 0, sizeof(LV_ITEMW));        item.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;        ImageList_AddIcon(hImageListLarge, hIcon);        item.iImage = ImageList_AddIcon(hImageListSmall, hIcon);        item.pszText = LPSTR_TEXTCALLBACKW;        item.iItem = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);        item.lParam = (LPARAM)pAPLI;        SendMessageW(hApplicationPageListCtrl, LVM_INSERTITEMW, 0, (LPARAM) &item);    }    /* Check to see if we need to remove any items from the list */    for (i=SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0)-1; i>=0; i--)    {        memset(&item, 0, sizeof(LV_ITEMW));        item.mask = LVIF_IMAGE|LVIF_PARAM;        item.iItem = i;        SendMessageW(hApplicationPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &item);        pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;        if (!IsWindow(pAPLI->hWnd)||            (strlenW(pAPLI->wszTitle) <= 0) ||            !IsWindowVisible(pAPLI->hWnd) ||            (GetParent(pAPLI->hWnd) != NULL) ||            (GetWindow(pAPLI->hWnd, GW_OWNER) != NULL) ||            (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))        {            ImageList_Remove(hImageListLarge, item.iItem);            ImageList_Remove(hImageListSmall, item.iItem);            SendMessageW(hApplicationPageListCtrl, LVM_DELETEITEM, item.iItem, 0);            HeapFree(GetProcessHeap(), 0, pAPLI);//.........这里部分代码省略.........
开发者ID:klickverbot,项目名称:wine,代码行数:101,


示例18: ResProtocol_Start

static HRESULT WINAPI ResProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,        IInternetProtocolSink* pOIProtSink, IInternetBindInfo* pOIBindInfo,        DWORD grfPI, HANDLE_PTR dwReserved){    ResProtocol *This = PROTOCOL_THIS(iface);    DWORD grfBINDF = 0, len;    BINDINFO bindinfo;    LPWSTR url_dll, url_file, url, mime, res_type = (LPWSTR)RT_HTML;    HMODULE hdll;    HRSRC src;    HRESULT hres;    static const WCHAR wszRes[] = {'r','e','s',':','/','/'};    TRACE("(%p)->(%s %p %p %08x %lx)/n", This, debugstr_w(szUrl), pOIProtSink,            pOIBindInfo, grfPI, dwReserved);    memset(&bindinfo, 0, sizeof(bindinfo));    bindinfo.cbSize = sizeof(BINDINFO);    IInternetBindInfo_GetBindInfo(pOIBindInfo, &grfBINDF, &bindinfo);    ReleaseBindInfo(&bindinfo);    len = strlenW(szUrl)+16;    url = heap_alloc(len*sizeof(WCHAR));    hres = CoInternetParseUrl(szUrl, PARSE_ENCODE, 0, url, len, &len, 0);    if(FAILED(hres)) {        WARN("CoInternetParseUrl failed: %08x/n", hres);        heap_free(url);        IInternetProtocolSink_ReportResult(pOIProtSink, hres, 0, NULL);        return hres;    }    if(len < sizeof(wszRes)/sizeof(wszRes[0]) || memcmp(url, wszRes, sizeof(wszRes))) {        WARN("Wrong protocol of url: %s/n", debugstr_w(url));        IInternetProtocolSink_ReportResult(pOIProtSink, E_INVALIDARG, 0, NULL);        heap_free(url);        return E_INVALIDARG;    }    url_dll = url + sizeof(wszRes)/sizeof(wszRes[0]);    if(!(url_file = strrchrW(url_dll, '/'))) {        WARN("wrong url: %s/n", debugstr_w(url));        IInternetProtocolSink_ReportResult(pOIProtSink, MK_E_SYNTAX, 0, NULL);        heap_free(url);        return MK_E_SYNTAX;    }    *url_file++ = 0;    hdll = LoadLibraryExW(url_dll, NULL, LOAD_LIBRARY_AS_DATAFILE);    if(!hdll) {        if (!(res_type = strrchrW(url_dll, '/'))) {            WARN("Could not open dll: %s/n", debugstr_w(url_dll));            IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);            heap_free(url);            return HRESULT_FROM_WIN32(GetLastError());        }        *res_type++ = 0;        hdll = LoadLibraryExW(url_dll, NULL, LOAD_LIBRARY_AS_DATAFILE);        if(!hdll) {            WARN("Could not open dll: %s/n", debugstr_w(url_dll));            IInternetProtocolSink_ReportResult(pOIProtSink, HRESULT_FROM_WIN32(GetLastError()), 0, NULL);            heap_free(url);            return HRESULT_FROM_WIN32(GetLastError());        }    }    TRACE("trying to find resource type %s, name %s/n", debugstr_w(res_type), debugstr_w(url_file));    src = FindResourceW(hdll, url_file, res_type);    if(!src) {        LPWSTR endpoint = NULL;        DWORD file_id = strtolW(url_file, &endpoint, 10);        if(endpoint == url_file+strlenW(url_file))            src = FindResourceW(hdll, MAKEINTRESOURCEW(file_id), MAKEINTRESOURCEW(RT_HTML));        if(!src) {            WARN("Could not find resource/n");            IInternetProtocolSink_ReportResult(pOIProtSink,                    HRESULT_FROM_WIN32(GetLastError()), 0, NULL);            heap_free(url);            return HRESULT_FROM_WIN32(GetLastError());        }    }    if(This->data) {        WARN("data already loaded/n");        heap_free(This->data);    }    This->data_len = SizeofResource(hdll, src);    This->data = heap_alloc(This->data_len);    memcpy(This->data, LoadResource(hdll, src), This->data_len);    This->cur = 0;    FreeLibrary(hdll);    hres = FindMimeFromData(NULL, url_file, NULL, 0, NULL, 0, &mime, 0);    heap_free(url);    if(SUCCEEDED(hres)) {//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,


示例19: FindMimeFromData

/*********************************************************************** *           FindMimeFromData ([email
C++ strlen_P函数代码示例
C++ strlcpy函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。