ReactOS 0.4.17-dev-357-ga8f14ff
url.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wininet.h"
#include "winreg.h"
#include "winternl.h"
#include "shlwapi.h"
#include "intshcut.h"
#include "wine/debug.h"
Include dependency graph for url.c:

Go to the source code of this file.

Macros

#define NO_SHLWAPI_STREAM
 

Functions

HMODULE WINAPI MLLoadLibraryW (LPCWSTR, HMODULE, DWORD)
 
BOOL WINAPI MLFreeLibrary (HMODULE)
 
HRESULT WINAPI MLBuildResURLW (LPCWSTR, HMODULE, DWORD, LPCWSTR, LPWSTR, DWORD)
 
 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
HRESULT WINAPI SHAutoComplete (HWND hwndEdit, DWORD dwFlags)
 
HRESULT WINAPI MLBuildResURLA (LPCSTR lpszLibName, HMODULE hMod, DWORD dwFlags, LPCSTR lpszRes, LPSTR lpszDest, DWORD dwDestLen)
 

Macro Definition Documentation

◆ NO_SHLWAPI_STREAM

#define NO_SHLWAPI_STREAM

Definition at line 31 of file url.c.

Function Documentation

◆ MLBuildResURLA()

HRESULT WINAPI MLBuildResURLA ( LPCSTR  lpszLibName,
HMODULE  hMod,
DWORD  dwFlags,
LPCSTR  lpszRes,
LPSTR  lpszDest,
DWORD  dwDestLen 
)

Definition at line 81 of file url.c.

83{
84 WCHAR szLibName[MAX_PATH], szRes[MAX_PATH], szDest[MAX_PATH];
85 HRESULT hRet;
86
87 if (lpszLibName)
88 MultiByteToWideChar(CP_ACP, 0, lpszLibName, -1, szLibName, ARRAY_SIZE(szLibName));
89
90 if (lpszRes)
91 MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, szRes, ARRAY_SIZE(szRes));
92
93 if (dwDestLen > ARRAY_SIZE(szLibName))
94 dwDestLen = ARRAY_SIZE(szLibName);
95
96 hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags,
97 lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen);
98 if (SUCCEEDED(hRet) && lpszDest)
99 WideCharToMultiByte(CP_ACP, 0, szDest, -1, lpszDest, dwDestLen, NULL, NULL);
100
101 return hRet;
102}
WCHAR lpszDest[260]
#define ARRAY_SIZE(A)
Definition: main.h:20
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MAX_PATH
Definition: compat.h:34
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
HRESULT WINAPI MLBuildResURLW(LPCWSTR, HMODULE, DWORD, LPCWSTR, LPWSTR, DWORD)
Definition: url.c:109
#define SUCCEEDED(hr)
Definition: intsafe.h:50
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
short WCHAR
Definition: pedump.c:58

◆ MLBuildResURLW()

HRESULT WINAPI MLBuildResURLW ( LPCWSTR  lpszLibName,
HMODULE  hMod,
DWORD  dwFlags,
LPCWSTR  lpszRes,
LPWSTR  lpszDest,
DWORD  dwDestLen 
)

Definition at line 109 of file url.c.

111{
112 static const WCHAR szRes[] = { 'r','e','s',':','/','/','\0' };
113 static const unsigned int szResLen = ARRAY_SIZE(szRes) - 1;
114 HRESULT hRet = E_FAIL;
115
116 TRACE("(%s,%p,0x%08lx,%s,%p,%ld)\n", debugstr_w(lpszLibName), hMod, dwFlags,
117 debugstr_w(lpszRes), lpszDest, dwDestLen);
118
119 if (!lpszLibName || !hMod || hMod == INVALID_HANDLE_VALUE || !lpszRes ||
120 !lpszDest || (dwFlags && dwFlags != 2))
121 return E_INVALIDARG;
122
123 if (dwDestLen >= szResLen + 1)
124 {
125 dwDestLen -= (szResLen + 1);
126 memcpy(lpszDest, szRes, sizeof(szRes));
127
128 hMod = MLLoadLibraryW(lpszLibName, hMod, dwFlags);
129
130 if (hMod)
131 {
132 WCHAR szBuff[MAX_PATH];
133 DWORD len;
134
135 len = GetModuleFileNameW(hMod, szBuff, ARRAY_SIZE(szBuff));
136 if (len && len < ARRAY_SIZE(szBuff))
137 {
138 DWORD dwPathLen = lstrlenW(szBuff) + 1;
139
140 if (dwDestLen >= dwPathLen)
141 {
142 DWORD dwResLen;
143
144 dwDestLen -= dwPathLen;
145 memcpy(lpszDest + szResLen, szBuff, dwPathLen * sizeof(WCHAR));
146
147 dwResLen = lstrlenW(lpszRes) + 1;
148 if (dwDestLen >= dwResLen + 1)
149 {
150 lpszDest[szResLen + dwPathLen-1] = '/';
151 memcpy(lpszDest + szResLen + dwPathLen, lpszRes, dwResLen * sizeof(WCHAR));
152 hRet = S_OK;
153 }
154 }
155 }
156 MLFreeLibrary(hMod);
157 }
158 }
159 return hRet;
160}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define lstrlenW
Definition: compat.h:750
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
HMODULE WINAPI MLLoadLibraryW(LPCWSTR, HMODULE, DWORD)
Definition: ordinal.c:3298
BOOL WINAPI MLFreeLibrary(HMODULE)
Definition: ordinal.c:3555
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by MLBuildResURLA().

◆ MLFreeLibrary()

BOOL WINAPI MLFreeLibrary ( HMODULE  hModule)

Definition at line 3555 of file ordinal.c.

3556{
3557 FIXME("(%p) semi-stub\n", hModule);
3558 return FreeLibrary(hModule);
3559}
#define FIXME(fmt,...)
Definition: precomp.h:53
HMODULE hModule
Definition: animate.c:44
#define FreeLibrary(x)
Definition: compat.h:748

Referenced by MLBuildResURLW().

◆ MLLoadLibraryW()

HMODULE WINAPI MLLoadLibraryW ( LPCWSTR  new_mod,
HMODULE  inst_hwnd,
DWORD  dwCrossCodePage 
)

Definition at line 3298 of file ordinal.c.

3299{
3300 WCHAR mod_path[2*MAX_PATH];
3301 LPWSTR ptr;
3302 DWORD len;
3303
3304 FIXME("(%s,%p,%ld) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage);
3305 len = GetModuleFileNameW(inst_hwnd, mod_path, ARRAY_SIZE(mod_path));
3306 if (!len || len >= ARRAY_SIZE(mod_path)) return NULL;
3307
3308 ptr = wcsrchr(mod_path, '\\');
3309 if (ptr) {
3310 lstrcpyW(ptr+1, new_mod);
3311 TRACE("loading %s\n", debugstr_w(mod_path));
3312 return LoadLibraryW(mod_path);
3313 }
3314 return NULL;
3315}
#define wcsrchr
Definition: compat.h:16
#define lstrcpyW
Definition: compat.h:749
#define LoadLibraryW(x)
Definition: compat.h:747
static PVOID ptr
Definition: dispmode.c:27
uint16_t * LPWSTR
Definition: typedefs.h:56

Referenced by MLBuildResURLW().

◆ SHAutoComplete()

HRESULT WINAPI SHAutoComplete ( HWND  hwndEdit,
DWORD  dwFlags 
)

Definition at line 56 of file url.c.

57{
58 FIXME("stub\n");
59 return S_FALSE;
60}
#define S_FALSE
Definition: winerror.h:3451

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )