Wine-Devel
Threads by month
- ----- 2026 -----
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- 5 participants
- 84534 discussions
Nov. 29, 2020
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
programs/cmd/batch.c | 20 +++++------
programs/cmd/builtins.c | 72 +++++++++++++++++-----------------------
programs/cmd/directory.c | 34 +++++++++----------
programs/cmd/wcmd.h | 8 -----
programs/cmd/wcmdmain.c | 21 +++++-------
5 files changed, 66 insertions(+), 89 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index a08648d8c26..37cdff42188 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -516,13 +516,13 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
doneModifier = TRUE;
if (exists) {
- if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
+ if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
/* Format the time */
FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
NULL, thisoutput, MAX_PATH);
- lstrcatW(thisoutput, spaceW);
+ lstrcatW(thisoutput, L" ");
datelen = lstrlenW(thisoutput);
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
NULL, (thisoutput+datelen), MAX_PATH-datelen);
@@ -538,7 +538,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
doneModifier = TRUE;
if (exists) {
- if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
+ if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
wsprintfW(thisoutput, L"%u", fullsize);
lstrcatW(finaloutput, thisoutput);
}
@@ -546,7 +546,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 4. Handle 's' : Use short paths (File doesn't have to exist) */
if (wmemchr(firstModifier, 's', modifierLen) != NULL) {
- if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
+ if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
/* Convert fullfilename's path to a short path - Save filename away as
only path is valid, name may not exist which causes GetShortPathName
@@ -563,7 +563,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* Note this overrides d,p,n,x */
if (wmemchr(firstModifier, 'f', modifierLen) != NULL) {
doneModifier = TRUE;
- if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
+ if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
lstrcatW(finaloutput, fullfilename);
} else {
@@ -580,7 +580,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 5. Handle 'd' : Drive Letter */
if (wmemchr(firstModifier, 'd', modifierLen) != NULL) {
if (addSpace) {
- lstrcatW(finaloutput, spaceW);
+ lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
@@ -592,7 +592,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 6. Handle 'p' : Path */
if (wmemchr(firstModifier, 'p', modifierLen) != NULL) {
if (addSpace) {
- lstrcatW(finaloutput, spaceW);
+ lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
@@ -604,7 +604,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 7. Handle 'n' : Name */
if (wmemchr(firstModifier, 'n', modifierLen) != NULL) {
if (addSpace) {
- lstrcatW(finaloutput, spaceW);
+ lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
@@ -616,7 +616,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 8. Handle 'x' : Ext */
if (wmemchr(firstModifier, 'x', modifierLen) != NULL) {
if (addSpace) {
- lstrcatW(finaloutput, spaceW);
+ lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
@@ -629,7 +629,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
if (!doneFileModifier &&
wmemchr(firstModifier, 's', modifierLen) != NULL) {
doneModifier = TRUE;
- if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
+ if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
lstrcatW(finaloutput, fullfilename);
}
}
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index c6dce091c69..e4b1fed613f 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -39,12 +39,6 @@ extern BOOL echo_mode;
extern BOOL interactive;
struct env_stack *pushd_directories;
-const WCHAR dotW[] = {'.','\0'};
-const WCHAR dotdotW[] = {'.','.','\0'};
-const WCHAR nullW[] = {'\0'};
-const WCHAR starW[] = {'*','\0'};
-const WCHAR slashW[] = {'\\','\0'};
-const WCHAR equalW[] = {'=','\0'};
const WCHAR wildcardsW[] = {'*','?','\0'};
const WCHAR slashstarW[] = {'\\','*','\0'};
const WCHAR deviceW[] = {'\\','\\','.','\\','\0'};
@@ -410,7 +404,7 @@ void WCMD_choice (const WCHAR * args) {
ptr = wcschr(opt_c, answer[0]);
if (ptr) {
WCMD_output_asis(answer);
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
if (have_console)
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), oldmode);
@@ -807,8 +801,8 @@ void WCMD_copy(WCHAR * args) {
if (destination == NULL) {
WINE_TRACE("No destination supplied, so need to calculate it\n");
- lstrcpyW(destname, dotW);
- lstrcatW(destname, slashW);
+ lstrcpyW(destname, L".");
+ lstrcatW(destname, L"\\");
destination = heap_xalloc(sizeof(COPY_FILES));
if (destination == NULL) goto exitreturn;
@@ -835,7 +829,7 @@ void WCMD_copy(WCHAR * args) {
(attributes & FILE_ATTRIBUTE_DIRECTORY))) {
destisdirectory = TRUE;
- if (!ends_with_backslash( destname )) lstrcatW(destname, slashW);
+ if (!ends_with_backslash(destname)) lstrcatW(destname, L"\\");
WINE_TRACE("Directory, so full name is now '%s'\n", wine_dbgstr_w(destname));
}
}
@@ -916,7 +910,7 @@ void WCMD_copy(WCHAR * args) {
/* We need to know where the filename part starts, so append * and
recalculate the full resulting path */
- lstrcatW(thiscopy->name, starW);
+ lstrcatW(thiscopy->name, L"*");
GetFullPathNameW(thiscopy->name, ARRAY_SIZE(srcpath), srcpath, &filenamepart);
WINE_TRACE("Directory, so full name is now '%s'\n", wine_dbgstr_w(srcpath));
@@ -1208,7 +1202,6 @@ static BOOL WCMD_delete_confirm_wildcard(const WCHAR *filename, BOOL *pPrompted)
static const WCHAR parmQ[] = {'/','Q','\0'};
if ((wcsstr(quals, parmQ) == NULL) && (wcsstr(quals, parmP) == NULL)) {
- static const WCHAR anyExt[]= {'.','*','\0'};
WCHAR drive[10];
WCHAR dir[MAX_PATH];
WCHAR fname[MAX_PATH];
@@ -1220,8 +1213,7 @@ static BOOL WCMD_delete_confirm_wildcard(const WCHAR *filename, BOOL *pPrompted)
_wsplitpath(fpath, drive, dir, fname, ext);
/* Only prompt for * and *.*, not *a, a*, *.a* etc */
- if ((lstrcmpW(fname, starW) == 0) &&
- (*ext == 0x00 || (lstrcmpW(ext, anyExt) == 0))) {
+ if ((lstrcmpW(fname, L"*") == 0) && (*ext == 0x00 || (lstrcmpW(ext, L".*") == 0))) {
WCHAR question[MAXSTRING];
static const WCHAR fmt[] = {'%','s',' ','\0'};
@@ -1375,8 +1367,7 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) {
do {
if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
- (lstrcmpW(fd.cFileName, dotdotW) != 0) &&
- (lstrcmpW(fd.cFileName, dotW) != 0)) {
+ (lstrcmpW(fd.cFileName, L"..") != 0) && (lstrcmpW(fd.cFileName, L".") != 0)) {
DIRECTORY_STACK *nextDir;
WCHAR subParm[MAX_PATH];
@@ -1384,7 +1375,7 @@ static BOOL WCMD_delete_one (const WCHAR *thisArg) {
/* Work out search parameter in sub dir */
lstrcpyW (subParm, thisDir);
lstrcatW (subParm, fd.cFileName);
- lstrcatW (subParm, slashW);
+ lstrcatW (subParm, L"\\");
lstrcatW (subParm, fname);
lstrcatW (subParm, ext);
WINE_TRACE("Recursive, Adding to search list '%s'\n", wine_dbgstr_w(subParm));
@@ -1526,7 +1517,7 @@ void WCMD_echo (const WCHAR *args)
echo_mode = FALSE;
else {
WCMD_output_asis (args);
- WCMD_output_asis (newlineW);
+ WCMD_output_asis(L"\r\n");
}
heap_free(trimmed);
}
@@ -1783,8 +1774,7 @@ static void WCMD_add_dirstowalk(DIRECTORY_STACK *dirsToWalk) {
do {
WINE_TRACE("Looking for subdirectories\n");
if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
- (lstrcmpW(fd.cFileName, dotdotW) != 0) &&
- (lstrcmpW(fd.cFileName, dotW) != 0))
+ (lstrcmpW(fd.cFileName, L"..") != 0) && (lstrcmpW(fd.cFileName, L".") != 0))
{
/* Allocate memory, add to list */
DIRECTORY_STACK *toWalk = heap_xalloc(sizeof(DIRECTORY_STACK));
@@ -1794,7 +1784,7 @@ static void WCMD_add_dirstowalk(DIRECTORY_STACK *dirsToWalk) {
remainingDirs = toWalk;
toWalk->dirName = heap_xalloc(sizeof(WCHAR) * (lstrlenW(dirsToWalk->dirName) + 2 + lstrlenW(fd.cFileName)));
lstrcpyW(toWalk->dirName, dirsToWalk->dirName);
- lstrcatW(toWalk->dirName, slashW);
+ lstrcatW(toWalk->dirName, L"\\");
lstrcatW(toWalk->dirName, fd.cFileName);
WINE_TRACE("Added to stack %s (%p->%p)\n", wine_dbgstr_w(toWalk->dirName),
toWalk, toWalk->next);
@@ -2329,7 +2319,7 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
as it is fully qualified in the /R case */
if (dirsToWalk) {
lstrcpyW(fullitem, dirsToWalk->dirName);
- lstrcatW(fullitem, slashW);
+ lstrcatW(fullitem, L"\\");
lstrcatW(fullitem, item);
} else {
WCHAR *prefix = wcsrchr(item, '\\');
@@ -2347,15 +2337,14 @@ void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
/* Handle as files or dirs appropriately, but ignore . and .. */
if (isDirectory == expandDirs &&
- (lstrcmpW(fd.cFileName, dotdotW) != 0) &&
- (lstrcmpW(fd.cFileName, dotW) != 0))
+ (lstrcmpW(fd.cFileName, L"..") != 0) && (lstrcmpW(fd.cFileName, L".") != 0))
{
thisCmdStart = cmdStart;
WINE_TRACE("Processing FOR filename %s\n", wine_dbgstr_w(fd.cFileName));
if (doRecurse) {
lstrcpyW(fullitem, dirsToWalk->dirName);
- lstrcatW(fullitem, slashW);
+ lstrcatW(fullitem, L"\\");
lstrcatW(fullitem, fd.cFileName);
} else {
if (prefixlen) lstrcpynW(fullitem, item, prefixlen + 1);
@@ -2867,7 +2856,7 @@ int evaluate_if_condition(WCHAR *p, WCHAR **command, int *test, int *negate)
int len = lstrlenW(param);
/* FindFirstFile does not like a directory path ending in '\', append a '.' */
- if (len && param[len-1] == '\\') lstrcatW(param, dotW);
+ if (len && param[len-1] == '\\') lstrcatW(param, L".");
hff = FindFirstFileW(param, &fd);
*test = (hff != INVALID_HANDLE_VALUE );
@@ -2982,7 +2971,7 @@ void WCMD_move (void)
/* If no destination supplied, assume current directory */
if (param2[0] == 0x00) {
- lstrcpyW(param2, dotW);
+ lstrcpyW(param2, L".");
}
/* If 2nd parm is directory, then use original filename */
@@ -3017,7 +3006,7 @@ void WCMD_move (void)
if (attribs != INVALID_FILE_ATTRIBUTES &&
(attribs & FILE_ATTRIBUTE_DIRECTORY)) {
lstrcpyW(dest, output);
- lstrcatW(dest, slashW);
+ lstrcatW(dest, L"\\");
lstrcatW(dest, fd.cFileName);
} else {
lstrcpyW(dest, output);
@@ -3477,7 +3466,7 @@ void WCMD_setshow_default (const WCHAR *args) {
GetCurrentDirectoryW(ARRAY_SIZE(cwd), cwd);
if (!*args) {
- lstrcatW (cwd, newlineW);
+ lstrcatW(cwd, L"\r\n");
WCMD_output_asis (cwd);
}
else {
@@ -3544,7 +3533,7 @@ void WCMD_setshow_default (const WCHAR *args) {
drive */
if ((string[1] == ':') && IsCharAlphaW(string[0])) {
WCHAR env[4];
- lstrcpyW(env, equalW);
+ lstrcpyW(env, L"=");
memcpy(env+1, string, 2 * sizeof(WCHAR));
env[3] = 0x00;
WINE_TRACE("Setting '%s' to '%s'\n", wine_dbgstr_w(env), wine_dbgstr_w(string));
@@ -3596,7 +3585,7 @@ static int __cdecl WCMD_compare( const void *a, const void *b )
int r;
const WCHAR * const *str_a = a, * const *str_b = b;
r = CompareStringW( LOCALE_USER_DEFAULT, NORM_IGNORECASE | SORT_STRINGSORT,
- *str_a, wcscspn(*str_a, equalW), *str_b, wcscspn(*str_b, equalW) );
+ *str_a, wcscspn(*str_a, L"="), *str_b, wcscspn(*str_b, L"=") );
if( r == CSTR_LESS_THAN ) return -1;
if( r == CSTR_GREATER_THAN ) return 1;
return 0;
@@ -3641,7 +3630,7 @@ static int WCMD_setshow_sortenv(const WCHAR *s, const WCHAR *stub)
/* Don't display special internal variables */
if (str[i][0] != '=') {
WCMD_output_asis(str[i]);
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
displayedcount++;
}
}
@@ -4314,7 +4303,7 @@ void WCMD_setshow_path (const WCHAR *args) {
if (status != 0) {
WCMD_output_asis ( pathEqW);
WCMD_output_asis ( string);
- WCMD_output_asis ( newlineW);
+ WCMD_output_asis(L"\r\n");
}
else {
WCMD_output_stderr(WCMD_LoadMessage(WCMD_NOPATH));
@@ -4438,7 +4427,7 @@ void WCMD_start(WCHAR *args)
lstrcatW( file, exeW );
cmdline = heap_xalloc( (lstrlenW(file) + lstrlenW(args) + 8) * sizeof(WCHAR) );
lstrcpyW( cmdline, file );
- lstrcatW( cmdline, spaceW );
+ lstrcatW(cmdline, L" ");
cmdline_params = cmdline + lstrlenW(cmdline);
/* The start built-in has some special command-line parsing properties
@@ -4866,8 +4855,7 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
if (newValue) accessOptions |= KEY_WRITE;
/* Open a key to HKEY_CLASSES_ROOT for enumerating */
- if (RegOpenKeyExW(HKEY_CLASSES_ROOT, nullW, 0,
- accessOptions, &key) != ERROR_SUCCESS) {
+ if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"", 0, accessOptions, &key) != ERROR_SUCCESS) {
WINE_FIXME("Unexpected failure opening HKCR key: %d\n", GetLastError());
return;
}
@@ -4901,12 +4889,12 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
valueLen = ARRAY_SIZE(keyValue);
rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
WCMD_output_asis(keyName);
- WCMD_output_asis(equalW);
+ WCMD_output_asis(L"=");
/* If no default value found, leave line empty after '=' */
if (rc == ERROR_SUCCESS) {
WCMD_output_asis(keyValue);
}
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
RegCloseKey(readKey);
}
}
@@ -4933,10 +4921,10 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
rc = RegQueryValueExW(readKey, NULL, NULL, NULL, (LPBYTE)keyValue, &valueLen);
WCMD_output_asis(args);
- WCMD_output_asis(equalW);
+ WCMD_output_asis(L"=");
/* If no default value found, leave line empty after '=' */
if (rc == ERROR_SUCCESS) WCMD_output_asis(keyValue);
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
RegCloseKey(readKey);
} else {
@@ -5005,9 +4993,9 @@ void WCMD_assoc (const WCHAR *args, BOOL assoc) {
errorlevel = 2;
} else {
WCMD_output_asis(args);
- WCMD_output_asis(equalW);
+ WCMD_output_asis(L"=");
WCMD_output_asis(newValue);
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
}
}
}
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c
index 2d35f8eb1d1..df3ed4387ee 100644
--- a/programs/cmd/directory.c
+++ b/programs/cmd/directory.c
@@ -310,7 +310,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Output the results */
if (!bare) {
- if (level != 0 && (entry_count > 0)) WCMD_output_asis (newlineW);
+ if (level != 0 && (entry_count > 0)) WCMD_output_asis(L"\r\n");
if (!recurse || ((entry_count > 0) && done_header==FALSE)) {
WCMD_output (L"Directory of %1\n\n", real_path);
done_header = TRUE;
@@ -397,7 +397,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if ((cur_width + widest) > max_width) {
cur_width = 0;
} else {
- WCMD_output(L"%1!*s!", cur_width - tmp_width, nullW);
+ WCMD_output(L"%1!*s!", cur_width - tmp_width, L"");
}
} else if (fd[i].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
@@ -409,9 +409,9 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (usernames) WCMD_output (fmt3, username);
WCMD_output(fmt4,fd[i].cFileName);
} else {
- if (!((lstrcmpW(fd[i].cFileName, dotW) == 0) ||
- (lstrcmpW(fd[i].cFileName, dotdotW) == 0))) {
- WCMD_output (fmt5, recurse?inputparms->dirName:nullW, fd[i].cFileName);
+ if (!((lstrcmpW(fd[i].cFileName, L".") == 0) ||
+ (lstrcmpW(fd[i].cFileName, L"..") == 0))) {
+ WCMD_output(fmt5, recurse?inputparms->dirName:L"", fd[i].cFileName);
} else {
addNewLine = FALSE;
}
@@ -429,11 +429,11 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (usernames) WCMD_output (fmt3, username);
WCMD_output(fmt4,fd[i].cFileName);
} else {
- WCMD_output (fmt5, recurse?inputparms->dirName:nullW, fd[i].cFileName);
+ WCMD_output(fmt5, recurse ? inputparms->dirName : L"", fd[i].cFileName);
}
}
}
- if (addNewLine) WCMD_output_asis (newlineW);
+ if (addNewLine) WCMD_output_asis(L"\r\n");
cur_width = 0;
}
@@ -467,15 +467,15 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Build path to search */
lstrcpyW(string, inputparms->dirName);
- lstrcatW(string, starW);
+ lstrcatW(string, L"*");
WINE_TRACE("Recursive, looking for '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFileW(string, &finddata);
if (hff != INVALID_HANDLE_VALUE) {
do {
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
- (lstrcmpW(finddata.cFileName, dotdotW) != 0) &&
- (lstrcmpW(finddata.cFileName, dotW) != 0)) {
+ (lstrcmpW(finddata.cFileName, L"..") != 0) &&
+ (lstrcmpW(finddata.cFileName, L".") != 0)) {
DIRECTORY_STACK *thisDir;
int dirsToCopy = concurrentDirs;
@@ -488,7 +488,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Work out search parameter in sub dir */
lstrcpyW (string, inputparms->dirName);
lstrcatW (string, finddata.cFileName);
- lstrcatW (string, slashW);
+ lstrcatW(string, L"\\");
WINE_TRACE("Recursive, Adding to search list '%s'\n", wine_dbgstr_w(string));
/* Allocate memory, add to list */
@@ -762,7 +762,7 @@ void WCMD_directory (WCHAR *args)
argno = 0;
argN = args;
GetCurrentDirectoryW(MAX_PATH, cwd);
- lstrcatW(cwd, slashW);
+ lstrcatW(cwd, L"\\");
/* Loop through all args, calculating full effective directory */
fullParms = NULL;
@@ -781,7 +781,7 @@ void WCMD_directory (WCHAR *args)
if (!GetEnvironmentVariableW(envvar, fullname, MAX_PATH)) {
wsprintfW(fullname, L"%c:", thisArg[0]);
}
- lstrcatW(fullname, slashW);
+ lstrcatW(fullname, L"\\");
lstrcatW(fullname, &thisArg[2]);
} else if (thisArg[0] == '\\') {
memcpy(fullname, cwd, 2 * sizeof(WCHAR));
@@ -802,13 +802,13 @@ void WCMD_directory (WCHAR *args)
if ((wcschr(path, '*') == NULL) && (wcschr(path, '%') == NULL)) {
status = GetFileAttributesW(path);
if ((status != INVALID_FILE_ATTRIBUTES) && (status & FILE_ATTRIBUTE_DIRECTORY)) {
- if (!ends_with_backslash( path )) lstrcatW( path, slashW );
- lstrcatW (path, starW);
+ if (!ends_with_backslash(path)) lstrcatW(path, L"\\");
+ lstrcatW(path, L"*");
}
} else {
/* Special case wildcard search with no extension (ie parameters ending in '.') as
GetFullPathName strips off the additional '.' */
- if (fullname[lstrlenW(fullname)-1] == '.') lstrcatW(path, dotW);
+ if (fullname[lstrlenW(fullname)-1] == '.') lstrcatW(path, L".");
}
WINE_TRACE("Using path '%s'\n", wine_dbgstr_w(path));
@@ -841,7 +841,7 @@ void WCMD_directory (WCHAR *args)
fullParms = heap_xalloc(sizeof(DIRECTORY_STACK));
fullParms->next = NULL;
fullParms->dirName = heap_strdupW(cwd);
- fullParms->fileName = heap_strdupW(starW);
+ fullParms->fileName = heap_strdupW(L"*");
}
lastDrive = '?';
diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index 9ae87ea7064..65a89ac26d7 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -271,14 +271,6 @@ extern BOOL delayedsubst;
#define WCMD_EXIT 46
/* Some standard messages */
-extern const WCHAR newlineW[];
-extern const WCHAR spaceW[];
-extern const WCHAR nullW[];
-extern const WCHAR dotW[];
-extern const WCHAR dotdotW[];
-extern const WCHAR starW[];
-extern const WCHAR slashW[];
-extern const WCHAR equalW[];
extern WCHAR anykey[];
extern WCHAR version_string[];
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 2b55a39dca3..3484f05ae73 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -46,8 +46,6 @@ int defaultColor = 7;
BOOL echo_mode = TRUE;
WCHAR anykey[100], version_string[100];
-const WCHAR newlineW[] = {'\r','\n','\0'};
-const WCHAR spaceW[] = {' ','\0'};
static const WCHAR envPathExt[] = {'P','A','T','H','E','X','T','\0'};
static const WCHAR dfltPathExt[] = {'.','b','a','t',';',
'.','c','o','m',';',
@@ -319,8 +317,7 @@ void WCMD_print_error (void) {
WCMD_output_asis_len(lpMsgBuf, lstrlenW(lpMsgBuf),
GetStdHandle(STD_ERROR_HANDLE));
LocalFree (lpMsgBuf);
- WCMD_output_asis_len (newlineW, lstrlenW(newlineW),
- GetStdHandle(STD_ERROR_HANDLE));
+ WCMD_output_asis_len(L"\r\n", lstrlenW(L"\r\n"), GetStdHandle(STD_ERROR_HANDLE));
return;
}
@@ -731,7 +728,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
/* search and replace manipulation */
} else {
- WCHAR *equalspos = wcsstr(colonpos, equalW);
+ WCHAR *equalspos = wcsstr(colonpos, L"=");
WCHAR *replacewith = equalspos+1;
WCHAR *found = NULL;
WCHAR *searchIn;
@@ -1151,7 +1148,7 @@ void WCMD_run_program (WCHAR *command, BOOL called)
}
/* 1. If extension supplied, see if that file exists */
- lstrcatW(thisDir, slashW);
+ lstrcatW(thisDir, L"\\");
lstrcatW(thisDir, stemofsearch);
pos = &thisDir[lstrlenW(thisDir)]; /* Pos = end of name */
@@ -1395,7 +1392,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
/* According to MSDN CreateProcess docs, special env vars record
the current directory on each drive, in the form =C:
so see if one specified, and if so go back to it */
- lstrcpyW(envvar, equalW);
+ lstrcpyW(envvar, L"=");
lstrcatW(envvar, cmd);
if (GetEnvironmentVariableW(envvar, dir, MAX_PATH) == 0) {
static const WCHAR fmt[] = {'%','s','\\','\0'};
@@ -1607,7 +1604,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WCMD_type (parms_start);
break;
case WCMD_VER:
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
WCMD_version ();
break;
case WCMD_VERIFY:
@@ -1886,7 +1883,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
if (lstrlenW(extraSpace) == MAXSTRING -1) {
WCMD_output_asis_stderr(WCMD_LoadMessage(WCMD_TRUNCATEDLINE));
WCMD_output_asis_stderr(extraSpace);
- WCMD_output_asis_stderr(newlineW);
+ WCMD_output_asis_stderr(L"\r\n");
}
/* Replace env vars if in a batch context */
@@ -1914,9 +1911,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
&& CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
curPos, min_len, echoSlash, len) != CSTR_EQUAL)
{
- WCMD_output_asis(spaceW);
+ WCMD_output_asis(L" ");
}
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
}
/* Skip repeated 'no echo' characters */
@@ -2354,7 +2351,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
/* Continue to echo commands IF echo is on and in batch program */
if (context && echo_mode && *curPos && *curPos != '@') {
WCMD_output_asis(extraSpace);
- WCMD_output_asis(newlineW);
+ WCMD_output_asis(L"\r\n");
}
/* Skip repeated 'no echo' characters and whitespace */
--
2.26.2
1
0
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
programs/cmd/builtins.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 934e55ac587..c6dce091c69 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1968,6 +1968,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart,
BOOL thisduplicate = FALSE;
BOOL anyduplicates = FALSE;
int totalfound;
+ static WCHAR emptyW[] = L"";
/* Skip lines if requested */
if (*forf_skip) {
@@ -1998,7 +1999,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart,
for (varoffset=0;
varidx >= 0 && varoffset<totalfound && (((varidx%26) + varoffset) < 26);
varoffset++) {
- forloopcontext.variable[varidx + varoffset] = (WCHAR *)nullW;
+ forloopcontext.variable[varidx + varoffset] = emptyW;
}
/* Loop extracting the tokens
@@ -2048,7 +2049,7 @@ static void WCMD_parse_line(CMD_LIST *cmdStart,
int i;
for (i=varidx; i<MAX_FOR_VARIABLES; i++) {
if ((forloopcontext.variable[i] != oldcontext.variable[i]) &&
- (forloopcontext.variable[i] != nullW)) {
+ (forloopcontext.variable[i] != emptyW)) {
heap_free(forloopcontext.variable[i]);
}
}
--
2.26.2
1
0
Nov. 29, 2020
Signed-off-by: Esme Povirk <esme(a)codeweavers.com>
---
dlls/windowscodecs/Makefile.in | 2 +-
dlls/windowscodecs/encoder.c | 26 +
dlls/windowscodecs/icnsencoder.c | 296 ++++++++++
dlls/windowscodecs/icnsformat.c | 742 -------------------------
dlls/windowscodecs/main.c | 14 +
dlls/windowscodecs/regsvr.c | 2 +-
dlls/windowscodecs/unix_lib.c | 3 +
dlls/windowscodecs/wincodecs_private.h | 4 +
8 files changed, 345 insertions(+), 744 deletions(-)
create mode 100644 dlls/windowscodecs/icnsencoder.c
delete mode 100644 dlls/windowscodecs/icnsformat.c
diff --git a/dlls/windowscodecs/Makefile.in b/dlls/windowscodecs/Makefile.in
index 2ab89eac84c..774257f11c7 100644
--- a/dlls/windowscodecs/Makefile.in
+++ b/dlls/windowscodecs/Makefile.in
@@ -18,7 +18,7 @@ C_SRCS = \
encoder.c \
fliprotate.c \
gifformat.c \
- icnsformat.c \
+ icnsencoder.c \
icoformat.c \
imgfactory.c \
info.c \
diff --git a/dlls/windowscodecs/encoder.c b/dlls/windowscodecs/encoder.c
index b17895a6c9c..72a83822b50 100644
--- a/dlls/windowscodecs/encoder.c
+++ b/dlls/windowscodecs/encoder.c
@@ -220,6 +220,31 @@ static HRESULT WINAPI CommonEncoderFrame_SetSize(IWICBitmapFrameEncode *iface,
EnterCriticalSection(&This->parent->lock);
+ if (This->parent->encoder_info.flags & ENCODER_FLAGS_ICNS_SIZE)
+ {
+ if (uiWidth != uiHeight)
+ {
+ WARN("cannot generate ICNS icon from %dx%d image\n", uiWidth, uiHeight);
+ hr = E_INVALIDARG;
+ goto end;
+ }
+
+ switch (uiWidth)
+ {
+ case 16:
+ case 32:
+ case 48:
+ case 128:
+ case 256:
+ case 512:
+ break;
+ default:
+ WARN("cannot generate ICNS icon from %dx%d image\n", uiWidth, uiHeight);
+ hr = E_INVALIDARG;
+ goto end;
+ }
+ }
+
if (!This->initialized || This->frame_created)
{
hr = WINCODEC_ERR_WRONGSTATE;
@@ -231,6 +256,7 @@ static HRESULT WINAPI CommonEncoderFrame_SetSize(IWICBitmapFrameEncode *iface,
hr = S_OK;
}
+end:
LeaveCriticalSection(&This->parent->lock);
return hr;
diff --git a/dlls/windowscodecs/icnsencoder.c b/dlls/windowscodecs/icnsencoder.c
new file mode 100644
index 00000000000..82fa8fde380
--- /dev/null
+++ b/dlls/windowscodecs/icnsencoder.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright 2010 Damjan Jovanovic
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#if 0
+#pragma makedep unix
+#endif
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdarg.h>
+
+#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
+#define GetCurrentProcess GetCurrentProcess_Mac
+#define GetCurrentThread GetCurrentThread_Mac
+#define LoadResource LoadResource_Mac
+#define AnimatePalette AnimatePalette_Mac
+#define EqualRgn EqualRgn_Mac
+#define FillRgn FillRgn_Mac
+#define FrameRgn FrameRgn_Mac
+#define GetPixel GetPixel_Mac
+#define InvertRgn InvertRgn_Mac
+#define LineTo LineTo_Mac
+#define OffsetRgn OffsetRgn_Mac
+#define PaintRgn PaintRgn_Mac
+#define Polygon Polygon_Mac
+#define ResizePalette ResizePalette_Mac
+#define SetRectRgn SetRectRgn_Mac
+#define EqualRect EqualRect_Mac
+#define FillRect FillRect_Mac
+#define FrameRect FrameRect_Mac
+#define GetCursor GetCursor_Mac
+#define InvertRect InvertRect_Mac
+#define OffsetRect OffsetRect_Mac
+#define PtInRect PtInRect_Mac
+#define SetCursor SetCursor_Mac
+#define SetRect SetRect_Mac
+#define ShowCursor ShowCursor_Mac
+#define UnionRect UnionRect_Mac
+#include <ApplicationServices/ApplicationServices.h>
+#undef GetCurrentProcess
+#undef GetCurrentThread
+#undef LoadResource
+#undef AnimatePalette
+#undef EqualRgn
+#undef FillRgn
+#undef FrameRgn
+#undef GetPixel
+#undef InvertRgn
+#undef LineTo
+#undef OffsetRgn
+#undef PaintRgn
+#undef Polygon
+#undef ResizePalette
+#undef SetRectRgn
+#undef EqualRect
+#undef FillRect
+#undef FrameRect
+#undef GetCursor
+#undef InvertRect
+#undef OffsetRect
+#undef PtInRect
+#undef SetCursor
+#undef SetRect
+#undef ShowCursor
+#undef UnionRect
+#endif
+
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winternl.h"
+#include "winbase.h"
+#include "objbase.h"
+
+#include "wincodecs_private.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
+
+#if defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) && \
+ MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
+
+typedef struct IcnsEncoder {
+ struct encoder encoder;
+ IStream *stream;
+ IconFamilyHandle icns_family;
+ struct encoder_frame frame;
+ OSType icns_type;
+ BYTE* icns_image;
+ int lines_written;
+} IcnsEncoder;
+
+static inline IcnsEncoder *impl_from_encoder(struct encoder *iface)
+{
+ return CONTAINING_RECORD(iface, IcnsEncoder, encoder);
+}
+
+void CDECL IcnsEncoder_destroy(struct encoder *iface)
+{
+ IcnsEncoder *This = impl_from_encoder(iface);
+
+ free(This->icns_image);
+
+ if (This->icns_family)
+ DisposeHandle((Handle)This->icns_family);
+
+ RtlFreeHeap(GetProcessHeap(), 0, This);
+}
+
+HRESULT CDECL IcnsEncoder_get_supported_format(struct encoder *iface,
+ GUID *pixel_format, DWORD *bpp, BOOL *indexed)
+{
+ *pixel_format = GUID_WICPixelFormat32bppBGRA;
+ *bpp = 32;
+ *indexed = FALSE;
+ return S_OK;
+}
+
+HRESULT CDECL IcnsEncoder_create_frame(struct encoder *iface, const struct encoder_frame *frame)
+{
+ IcnsEncoder *This = impl_from_encoder(iface);
+
+ This->frame = *frame;
+
+ switch (frame->width)
+ {
+ case 16: This->icns_type = kIconServices16PixelDataARGB; break;
+ case 32: This->icns_type = kIconServices32PixelDataARGB; break;
+ case 48: This->icns_type = kIconServices48PixelDataARGB; break;
+ case 128: This->icns_type = kIconServices128PixelDataARGB; break;
+ case 256: This->icns_type = kIconServices256PixelDataARGB; break;
+ case 512: This->icns_type = kIconServices512PixelDataARGB; break;
+ default:
+ ERR("cannot generate ICNS icon from %dx%d image\n", frame->width, frame->height);
+ return E_INVALIDARG;
+ }
+ This->icns_image = malloc(frame->width * frame->height * 4);
+ if (!This->icns_image)
+ {
+ WARN("failed to allocate image buffer\n");
+ return E_FAIL;
+ }
+ This->lines_written = 0;
+
+ return S_OK;
+}
+
+static HRESULT CDECL IcnsEncoder_write_lines(struct encoder* iface,
+ BYTE *data, DWORD line_count, DWORD stride)
+{
+ IcnsEncoder *This = impl_from_encoder(iface);
+ UINT i;
+
+ for (i = 0; i < line_count; i++)
+ {
+ BYTE *src_row, *dst_row;
+ UINT j;
+ src_row = data + stride * i;
+ dst_row = This->icns_image + (This->lines_written + i)*(This->frame.width*4);
+ /* swap bgr -> rgb */
+ for (j = 0; j < This->frame.width*4; j += 4)
+ {
+ dst_row[j] = src_row[j+3];
+ dst_row[j+1] = src_row[j+2];
+ dst_row[j+2] = src_row[j+1];
+ dst_row[j+3] = src_row[j];
+ }
+ }
+ This->lines_written += line_count;
+
+ return S_OK;
+}
+
+static HRESULT CDECL IcnsEncoder_commit_frame(struct encoder *iface)
+{
+ IcnsEncoder *This = impl_from_encoder(iface);
+ Handle handle;
+ OSErr ret;
+ HRESULT hr = S_OK;
+
+ ret = PtrToHand(This->icns_image, &handle, This->frame.width * This->frame.height * 4);
+ if (ret != noErr || !handle)
+ {
+ WARN("PtrToHand failed with error %d\n", ret);
+ return E_FAIL;
+ }
+
+ ret = SetIconFamilyData(This->icns_family, This->icns_type, handle);
+ DisposeHandle(handle);
+
+ if (ret != noErr)
+ {
+ WARN("SetIconFamilyData failed for image with error %d\n", ret);
+ return E_FAIL;
+ }
+
+ free(This->icns_image);
+ This->icns_image = NULL;
+
+ return S_OK;
+}
+
+static HRESULT CDECL IcnsEncoder_initialize(struct encoder *iface, IStream *stream)
+{
+ IcnsEncoder *This = impl_from_encoder(iface);
+
+ This->icns_family = (IconFamilyHandle)NewHandle(0);
+ if (!This->icns_family)
+ {
+ WARN("error creating icns family\n");
+ return E_FAIL;
+ }
+
+ This->stream = stream;
+
+ return S_OK;
+}
+
+static HRESULT CDECL IcnsEncoder_commit_file(struct encoder *iface)
+{
+ IcnsEncoder *This = impl_from_encoder(iface);
+ size_t buffer_size;
+ HRESULT hr = S_OK;
+ ULONG byteswritten;
+
+ buffer_size = GetHandleSize((Handle)This->icns_family);
+ hr = stream_write(This->stream, *This->icns_family, buffer_size, &byteswritten);
+ if (FAILED(hr) || byteswritten != buffer_size)
+ {
+ WARN("writing file failed, hr = 0x%08X\n", hr);
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+static const struct encoder_funcs IcnsEncoder_vtable = {
+ IcnsEncoder_initialize,
+ IcnsEncoder_get_supported_format,
+ IcnsEncoder_create_frame,
+ IcnsEncoder_write_lines,
+ IcnsEncoder_commit_frame,
+ IcnsEncoder_commit_file,
+ IcnsEncoder_destroy
+};
+
+HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result)
+{
+ IcnsEncoder *This;
+
+ TRACE("\n");
+
+ This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(IcnsEncoder));
+ if (!This) return E_OUTOFMEMORY;
+
+ This->encoder.vtable = &IcnsEncoder_vtable;
+ This->stream = NULL;
+ This->icns_family = NULL;
+ This->icns_image = NULL;
+
+ *result = &This->encoder;
+ info->flags = ENCODER_FLAGS_MULTI_FRAME|ENCODER_FLAGS_ICNS_SIZE;
+ info->container_format = GUID_WineContainerFormatIcns;
+ info->clsid = CLSID_WICIcnsEncoder;
+ info->encoder_options[0] = ENCODER_OPTION_END;
+
+ return S_OK;
+}
+
+#else /* !defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) ||
+ MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 */
+
+HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result)
+{
+ ERR("Trying to save ICNS picture, but ICNS support is not compiled in.\n");
+ return E_FAIL;
+}
+
+#endif
diff --git a/dlls/windowscodecs/icnsformat.c b/dlls/windowscodecs/icnsformat.c
deleted file mode 100644
index c74e4b24d71..00000000000
--- a/dlls/windowscodecs/icnsformat.c
+++ /dev/null
@@ -1,742 +0,0 @@
-/*
- * Copyright 2010 Damjan Jovanovic
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "config.h"
-#include "wine/port.h"
-
-#include <stdarg.h>
-
-#ifdef HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H
-#define GetCurrentProcess GetCurrentProcess_Mac
-#define GetCurrentThread GetCurrentThread_Mac
-#define LoadResource LoadResource_Mac
-#define AnimatePalette AnimatePalette_Mac
-#define EqualRgn EqualRgn_Mac
-#define FillRgn FillRgn_Mac
-#define FrameRgn FrameRgn_Mac
-#define GetPixel GetPixel_Mac
-#define InvertRgn InvertRgn_Mac
-#define LineTo LineTo_Mac
-#define OffsetRgn OffsetRgn_Mac
-#define PaintRgn PaintRgn_Mac
-#define Polygon Polygon_Mac
-#define ResizePalette ResizePalette_Mac
-#define SetRectRgn SetRectRgn_Mac
-#define EqualRect EqualRect_Mac
-#define FillRect FillRect_Mac
-#define FrameRect FrameRect_Mac
-#define GetCursor GetCursor_Mac
-#define InvertRect InvertRect_Mac
-#define OffsetRect OffsetRect_Mac
-#define PtInRect PtInRect_Mac
-#define SetCursor SetCursor_Mac
-#define SetRect SetRect_Mac
-#define ShowCursor ShowCursor_Mac
-#define UnionRect UnionRect_Mac
-#include <ApplicationServices/ApplicationServices.h>
-#undef GetCurrentProcess
-#undef GetCurrentThread
-#undef LoadResource
-#undef AnimatePalette
-#undef EqualRgn
-#undef FillRgn
-#undef FrameRgn
-#undef GetPixel
-#undef InvertRgn
-#undef LineTo
-#undef OffsetRgn
-#undef PaintRgn
-#undef Polygon
-#undef ResizePalette
-#undef SetRectRgn
-#undef EqualRect
-#undef FillRect
-#undef FrameRect
-#undef GetCursor
-#undef InvertRect
-#undef OffsetRect
-#undef PtInRect
-#undef SetCursor
-#undef SetRect
-#undef ShowCursor
-#undef UnionRect
-#endif
-
-#define COBJMACROS
-
-#include "windef.h"
-#include "winbase.h"
-#include "objbase.h"
-
-#include "wincodecs_private.h"
-
-#include "wine/debug.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
-
-#if defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) && \
- MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4
-
-typedef struct IcnsEncoder {
- IWICBitmapEncoder IWICBitmapEncoder_iface;
- LONG ref;
- IStream *stream;
- IconFamilyHandle icns_family;
- BOOL any_frame_committed;
- int outstanding_commits;
- BOOL committed;
- CRITICAL_SECTION lock;
-} IcnsEncoder;
-
-static inline IcnsEncoder *impl_from_IWICBitmapEncoder(IWICBitmapEncoder *iface)
-{
- return CONTAINING_RECORD(iface, IcnsEncoder, IWICBitmapEncoder_iface);
-}
-
-typedef struct IcnsFrameEncode {
- IWICBitmapFrameEncode IWICBitmapFrameEncode_iface;
- IcnsEncoder *encoder;
- LONG ref;
- BOOL initialized;
- UINT size;
- OSType icns_type;
- BYTE* icns_image;
- int lines_written;
- BOOL committed;
-} IcnsFrameEncode;
-
-static inline IcnsFrameEncode *impl_from_IWICBitmapFrameEncode(IWICBitmapFrameEncode *iface)
-{
- return CONTAINING_RECORD(iface, IcnsFrameEncode, IWICBitmapFrameEncode_iface);
-}
-
-static HRESULT WINAPI IcnsFrameEncode_QueryInterface(IWICBitmapFrameEncode *iface, REFIID iid,
- void **ppv)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
-
- if (!ppv) return E_INVALIDARG;
-
- if (IsEqualIID(&IID_IUnknown, iid) ||
- IsEqualIID(&IID_IWICBitmapFrameEncode, iid))
- {
- *ppv = &This->IWICBitmapFrameEncode_iface;
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
-
- IUnknown_AddRef((IUnknown*)*ppv);
- return S_OK;
-}
-
-static ULONG WINAPI IcnsFrameEncode_AddRef(IWICBitmapFrameEncode *iface)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- ULONG ref = InterlockedIncrement(&This->ref);
-
- TRACE("(%p) refcount=%u\n", iface, ref);
-
- return ref;
-}
-
-static ULONG WINAPI IcnsFrameEncode_Release(IWICBitmapFrameEncode *iface)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- ULONG ref = InterlockedDecrement(&This->ref);
-
- TRACE("(%p) refcount=%u\n", iface, ref);
-
- if (ref == 0)
- {
- if (!This->committed)
- {
- EnterCriticalSection(&This->encoder->lock);
- This->encoder->outstanding_commits--;
- LeaveCriticalSection(&This->encoder->lock);
- }
- HeapFree(GetProcessHeap(), 0, This->icns_image);
-
- IWICBitmapEncoder_Release(&This->encoder->IWICBitmapEncoder_iface);
- HeapFree(GetProcessHeap(), 0, This);
- }
-
- return ref;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_Initialize(IWICBitmapFrameEncode *iface,
- IPropertyBag2 *pIEncoderOptions)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p,%p)\n", iface, pIEncoderOptions);
-
- EnterCriticalSection(&This->encoder->lock);
-
- if (This->initialized)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
- This->initialized = TRUE;
-
-end:
- LeaveCriticalSection(&This->encoder->lock);
- return hr;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_SetSize(IWICBitmapFrameEncode *iface,
- UINT uiWidth, UINT uiHeight)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p,%u,%u)\n", iface, uiWidth, uiHeight);
-
- EnterCriticalSection(&This->encoder->lock);
-
- if (!This->initialized || This->icns_image)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
-
- if (uiWidth != uiHeight)
- {
- WARN("cannot generate ICNS icon from %dx%d image\n", uiWidth, uiHeight);
- hr = E_INVALIDARG;
- goto end;
- }
-
- switch (uiWidth)
- {
- case 16:
- case 32:
- case 48:
- case 128:
- case 256:
- case 512:
- break;
- default:
- WARN("cannot generate ICNS icon from %dx%d image\n", This->size, This->size);
- hr = E_INVALIDARG;
- goto end;
- }
-
- This->size = uiWidth;
-
-end:
- LeaveCriticalSection(&This->encoder->lock);
- return hr;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_SetResolution(IWICBitmapFrameEncode *iface,
- double dpiX, double dpiY)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p,%0.2f,%0.2f)\n", iface, dpiX, dpiY);
-
- EnterCriticalSection(&This->encoder->lock);
-
- if (!This->initialized || This->icns_image)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
-
-end:
- LeaveCriticalSection(&This->encoder->lock);
- return S_OK;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_SetPixelFormat(IWICBitmapFrameEncode *iface,
- WICPixelFormatGUID *pPixelFormat)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p,%s)\n", iface, debugstr_guid(pPixelFormat));
-
- EnterCriticalSection(&This->encoder->lock);
-
- if (!This->initialized || This->icns_image)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
-
- memcpy(pPixelFormat, &GUID_WICPixelFormat32bppBGRA, sizeof(GUID));
-
-end:
- LeaveCriticalSection(&This->encoder->lock);
- return S_OK;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_SetColorContexts(IWICBitmapFrameEncode *iface,
- UINT cCount, IWICColorContext **ppIColorContext)
-{
- FIXME("(%p,%u,%p): stub\n", iface, cCount, ppIColorContext);
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_SetPalette(IWICBitmapFrameEncode *iface,
- IWICPalette *pIPalette)
-{
- FIXME("(%p,%p): stub\n", iface, pIPalette);
- return WINCODEC_ERR_UNSUPPORTEDOPERATION;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_SetThumbnail(IWICBitmapFrameEncode *iface,
- IWICBitmapSource *pIThumbnail)
-{
- FIXME("(%p,%p): stub\n", iface, pIThumbnail);
- return WINCODEC_ERR_UNSUPPORTEDOPERATION;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_WritePixels(IWICBitmapFrameEncode *iface,
- UINT lineCount, UINT cbStride, UINT cbBufferSize, BYTE *pbPixels)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- HRESULT hr = S_OK;
- UINT i;
-
- TRACE("(%p,%u,%u,%u,%p)\n", iface, lineCount, cbStride, cbBufferSize, pbPixels);
-
- EnterCriticalSection(&This->encoder->lock);
-
- if (!This->initialized || !This->size)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
- if (lineCount == 0 || lineCount + This->lines_written > This->size)
- {
- hr = E_INVALIDARG;
- goto end;
- }
-
- if (!This->icns_image)
- {
- switch (This->size)
- {
- case 16: This->icns_type = kIconServices16PixelDataARGB; break;
- case 32: This->icns_type = kIconServices32PixelDataARGB; break;
- case 48: This->icns_type = kIconServices48PixelDataARGB; break;
- case 128: This->icns_type = kIconServices128PixelDataARGB; break;
- case 256: This->icns_type = kIconServices256PixelDataARGB; break;
- case 512: This->icns_type = kIconServices512PixelDataARGB; break;
- default:
- WARN("cannot generate ICNS icon from %dx%d image\n", This->size, This->size);
- hr = E_INVALIDARG;
- goto end;
- }
- This->icns_image = HeapAlloc(GetProcessHeap(), 0, This->size * This->size * 4);
- if (!This->icns_image)
- {
- WARN("failed to allocate image buffer\n");
- hr = E_FAIL;
- goto end;
- }
- }
-
- for (i = 0; i < lineCount; i++)
- {
- BYTE *src_row, *dst_row;
- UINT j;
- src_row = pbPixels + cbStride * i;
- dst_row = This->icns_image + (This->lines_written + i)*(This->size*4);
- /* swap bgr -> rgb */
- for (j = 0; j < This->size*4; j += 4)
- {
- dst_row[j] = src_row[j+3];
- dst_row[j+1] = src_row[j+2];
- dst_row[j+2] = src_row[j+1];
- dst_row[j+3] = src_row[j];
- }
- }
- This->lines_written += lineCount;
-
-end:
- LeaveCriticalSection(&This->encoder->lock);
- return hr;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_WriteSource(IWICBitmapFrameEncode *iface,
- IWICBitmapSource *pIBitmapSource, WICRect *prc)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- HRESULT hr;
-
- TRACE("(%p,%p,%s)\n", iface, pIBitmapSource, debug_wic_rect(prc));
-
- if (!This->initialized)
- return WINCODEC_ERR_WRONGSTATE;
-
- hr = configure_write_source(iface, pIBitmapSource, prc,
- &GUID_WICPixelFormat32bppBGRA, This->size, This->size,
- 1.0, 1.0);
-
- if (SUCCEEDED(hr))
- {
- hr = write_source(iface, pIBitmapSource, prc,
- &GUID_WICPixelFormat32bppBGRA, 32, FALSE, This->size, This->size);
- }
-
- return hr;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_Commit(IWICBitmapFrameEncode *iface)
-{
- IcnsFrameEncode *This = impl_from_IWICBitmapFrameEncode(iface);
- Handle handle;
- OSErr ret;
- HRESULT hr = S_OK;
-
- TRACE("(%p)\n", iface);
-
- EnterCriticalSection(&This->encoder->lock);
-
- if (!This->icns_image || This->lines_written != This->size || This->committed)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
-
- ret = PtrToHand(This->icns_image, &handle, This->size * This->size * 4);
- if (ret != noErr || !handle)
- {
- WARN("PtrToHand failed with error %d\n", ret);
- hr = E_FAIL;
- goto end;
- }
-
- ret = SetIconFamilyData(This->encoder->icns_family, This->icns_type, handle);
- DisposeHandle(handle);
-
- if (ret != noErr)
- {
- WARN("SetIconFamilyData failed for image with error %d\n", ret);
- hr = E_FAIL;
- goto end;
- }
-
- This->committed = TRUE;
- This->encoder->any_frame_committed = TRUE;
- This->encoder->outstanding_commits--;
-
-end:
- LeaveCriticalSection(&This->encoder->lock);
- return hr;
-}
-
-static HRESULT WINAPI IcnsFrameEncode_GetMetadataQueryWriter(IWICBitmapFrameEncode *iface,
- IWICMetadataQueryWriter **ppIMetadataQueryWriter)
-{
- FIXME("(%p, %p): stub\n", iface, ppIMetadataQueryWriter);
- return E_NOTIMPL;
-}
-
-static const IWICBitmapFrameEncodeVtbl IcnsEncoder_FrameVtbl = {
- IcnsFrameEncode_QueryInterface,
- IcnsFrameEncode_AddRef,
- IcnsFrameEncode_Release,
- IcnsFrameEncode_Initialize,
- IcnsFrameEncode_SetSize,
- IcnsFrameEncode_SetResolution,
- IcnsFrameEncode_SetPixelFormat,
- IcnsFrameEncode_SetColorContexts,
- IcnsFrameEncode_SetPalette,
- IcnsFrameEncode_SetThumbnail,
- IcnsFrameEncode_WritePixels,
- IcnsFrameEncode_WriteSource,
- IcnsFrameEncode_Commit,
- IcnsFrameEncode_GetMetadataQueryWriter
-};
-
-static HRESULT WINAPI IcnsEncoder_QueryInterface(IWICBitmapEncoder *iface, REFIID iid,
- void **ppv)
-{
- IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
- TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
-
- if (!ppv) return E_INVALIDARG;
-
- if (IsEqualIID(&IID_IUnknown, iid) ||
- IsEqualIID(&IID_IWICBitmapEncoder, iid))
- {
- *ppv = &This->IWICBitmapEncoder_iface;
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
-
- IUnknown_AddRef((IUnknown*)*ppv);
- return S_OK;
-}
-
-static ULONG WINAPI IcnsEncoder_AddRef(IWICBitmapEncoder *iface)
-{
- IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
- ULONG ref = InterlockedIncrement(&This->ref);
-
- TRACE("(%p) refcount=%u\n", iface, ref);
-
- return ref;
-}
-
-static ULONG WINAPI IcnsEncoder_Release(IWICBitmapEncoder *iface)
-{
- IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
- ULONG ref = InterlockedDecrement(&This->ref);
-
- TRACE("(%p) refcount=%u\n", iface, ref);
-
- if (ref == 0)
- {
- This->lock.DebugInfo->Spare[0] = 0;
- DeleteCriticalSection(&This->lock);
- if (This->icns_family)
- DisposeHandle((Handle)This->icns_family);
- if (This->stream)
- IStream_Release(This->stream);
- HeapFree(GetProcessHeap(), 0, This);
- }
-
- return ref;
-}
-
-static HRESULT WINAPI IcnsEncoder_Initialize(IWICBitmapEncoder *iface,
- IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
-{
- IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
- HRESULT hr = S_OK;
-
- TRACE("(%p,%p,%u)\n", iface, pIStream, cacheOption);
-
- EnterCriticalSection(&This->lock);
-
- if (This->icns_family)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
- This->icns_family = (IconFamilyHandle)NewHandle(0);
- if (!This->icns_family)
- {
- WARN("error creating icns family\n");
- hr = E_FAIL;
- goto end;
- }
- IStream_AddRef(pIStream);
- This->stream = pIStream;
-
-end:
- LeaveCriticalSection(&This->lock);
-
- return hr;
-}
-
-static HRESULT WINAPI IcnsEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
- GUID *pguidContainerFormat)
-{
- FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IcnsEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
- IWICBitmapEncoderInfo **ppIEncoderInfo)
-{
- FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo);
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IcnsEncoder_SetColorContexts(IWICBitmapEncoder *iface,
- UINT cCount, IWICColorContext **ppIColorContext)
-{
- FIXME("(%p,%u,%p): stub\n", iface, cCount, ppIColorContext);
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IcnsEncoder_SetPalette(IWICBitmapEncoder *iface, IWICPalette *pIPalette)
-{
- TRACE("(%p,%p)\n", iface, pIPalette);
- return WINCODEC_ERR_UNSUPPORTEDOPERATION;
-}
-
-static HRESULT WINAPI IcnsEncoder_SetThumbnail(IWICBitmapEncoder *iface, IWICBitmapSource *pIThumbnail)
-{
- TRACE("(%p,%p)\n", iface, pIThumbnail);
- return WINCODEC_ERR_UNSUPPORTEDOPERATION;
-}
-
-static HRESULT WINAPI IcnsEncoder_SetPreview(IWICBitmapEncoder *iface, IWICBitmapSource *pIPreview)
-{
- TRACE("(%p,%p)\n", iface, pIPreview);
- return WINCODEC_ERR_UNSUPPORTEDOPERATION;
-}
-
-static HRESULT WINAPI IcnsEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
- IWICBitmapFrameEncode **ppIFrameEncode, IPropertyBag2 **ppIEncoderOptions)
-{
- IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
- HRESULT hr = S_OK;
- IcnsFrameEncode *frameEncode = NULL;
-
- TRACE("(%p,%p,%p)\n", iface, ppIFrameEncode, ppIEncoderOptions);
-
- EnterCriticalSection(&This->lock);
-
- if (!This->icns_family)
- {
- hr = WINCODEC_ERR_NOTINITIALIZED;
- goto end;
- }
-
- if (ppIEncoderOptions)
- {
- hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions);
- if (FAILED(hr))
- goto end;
- }
-
- frameEncode = HeapAlloc(GetProcessHeap(), 0, sizeof(IcnsFrameEncode));
- if (frameEncode == NULL)
- {
- hr = E_OUTOFMEMORY;
- goto end;
- }
- frameEncode->IWICBitmapFrameEncode_iface.lpVtbl = &IcnsEncoder_FrameVtbl;
- frameEncode->encoder = This;
- frameEncode->ref = 1;
- frameEncode->initialized = FALSE;
- frameEncode->size = 0;
- frameEncode->icns_image = NULL;
- frameEncode->lines_written = 0;
- frameEncode->committed = FALSE;
- *ppIFrameEncode = &frameEncode->IWICBitmapFrameEncode_iface;
- This->outstanding_commits++;
- IWICBitmapEncoder_AddRef(&This->IWICBitmapEncoder_iface);
-
-end:
- LeaveCriticalSection(&This->lock);
-
- return hr;
-}
-
-static HRESULT WINAPI IcnsEncoder_Commit(IWICBitmapEncoder *iface)
-{
- IcnsEncoder *This = impl_from_IWICBitmapEncoder(iface);
- size_t buffer_size;
- HRESULT hr = S_OK;
- ULONG byteswritten;
-
- TRACE("(%p)\n", iface);
-
- EnterCriticalSection(&This->lock);
-
- if (!This->any_frame_committed || This->outstanding_commits > 0 || This->committed)
- {
- hr = WINCODEC_ERR_WRONGSTATE;
- goto end;
- }
-
- buffer_size = GetHandleSize((Handle)This->icns_family);
- hr = IStream_Write(This->stream, *This->icns_family, buffer_size, &byteswritten);
- if (FAILED(hr) || byteswritten != buffer_size)
- {
- WARN("writing file failed, hr = 0x%08X\n", hr);
- hr = E_FAIL;
- goto end;
- }
-
- This->committed = TRUE;
-
-end:
- LeaveCriticalSection(&This->lock);
- return hr;
-}
-
-static HRESULT WINAPI IcnsEncoder_GetMetadataQueryWriter(IWICBitmapEncoder *iface,
- IWICMetadataQueryWriter **ppIMetadataQueryWriter)
-{
- FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryWriter);
- return E_NOTIMPL;
-}
-
-static const IWICBitmapEncoderVtbl IcnsEncoder_Vtbl = {
- IcnsEncoder_QueryInterface,
- IcnsEncoder_AddRef,
- IcnsEncoder_Release,
- IcnsEncoder_Initialize,
- IcnsEncoder_GetContainerFormat,
- IcnsEncoder_GetEncoderInfo,
- IcnsEncoder_SetColorContexts,
- IcnsEncoder_SetPalette,
- IcnsEncoder_SetThumbnail,
- IcnsEncoder_SetPreview,
- IcnsEncoder_CreateNewFrame,
- IcnsEncoder_Commit,
- IcnsEncoder_GetMetadataQueryWriter
-};
-
-HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv)
-{
- IcnsEncoder *This;
- HRESULT ret;
-
- TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
-
- *ppv = NULL;
-
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(IcnsEncoder));
- if (!This) return E_OUTOFMEMORY;
-
- This->IWICBitmapEncoder_iface.lpVtbl = &IcnsEncoder_Vtbl;
- This->ref = 1;
- This->stream = NULL;
- This->icns_family = NULL;
- This->any_frame_committed = FALSE;
- This->outstanding_commits = 0;
- This->committed = FALSE;
- InitializeCriticalSection(&This->lock);
- This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IcnsEncoder.lock");
-
- ret = IWICBitmapEncoder_QueryInterface(&This->IWICBitmapEncoder_iface, iid, ppv);
- IWICBitmapEncoder_Release(&This->IWICBitmapEncoder_iface);
-
- return ret;
-}
-
-#else /* !defined(HAVE_APPLICATIONSERVICES_APPLICATIONSERVICES_H) ||
- MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 */
-
-HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv)
-{
- ERR("Trying to save ICNS picture, but ICNS support is not compiled in.\n");
- return E_FAIL;
-}
-
-#endif
diff --git a/dlls/windowscodecs/main.c b/dlls/windowscodecs/main.c
index b8ffb216186..bfdde3e3891 100644
--- a/dlls/windowscodecs/main.c
+++ b/dlls/windowscodecs/main.c
@@ -307,3 +307,17 @@ HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv)
return hr;
}
+
+HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv)
+{
+ HRESULT hr;
+ struct encoder *encoder;
+ struct encoder_info encoder_info;
+
+ hr = get_unix_encoder(&CLSID_WICIcnsEncoder, &encoder_info, &encoder);
+
+ if (SUCCEEDED(hr))
+ hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
+
+ return hr;
+}
diff --git a/dlls/windowscodecs/regsvr.c b/dlls/windowscodecs/regsvr.c
index 38c252c2760..365f44979fc 100644
--- a/dlls/windowscodecs/regsvr.c
+++ b/dlls/windowscodecs/regsvr.c
@@ -1532,7 +1532,7 @@ static struct regsvr_encoder const encoder_list[] = {
"ICNS Encoder",
"1.0.0.0",
&GUID_VendorWine,
- NULL, /* no container format guid */
+ &GUID_WineContainerFormatIcns,
"image/icns",
".icns",
icns_encode_formats
diff --git a/dlls/windowscodecs/unix_lib.c b/dlls/windowscodecs/unix_lib.c
index f94340fc971..268a1cd9d16 100644
--- a/dlls/windowscodecs/unix_lib.c
+++ b/dlls/windowscodecs/unix_lib.c
@@ -92,6 +92,9 @@ HRESULT CDECL encoder_create(const CLSID *encoder_clsid, struct encoder_info *in
if (IsEqualGUID(encoder_clsid, &CLSID_WICJpegEncoder))
return jpeg_encoder_create(info, result);
+ if (IsEqualGUID(encoder_clsid, &CLSID_WICIcnsEncoder))
+ return icns_encoder_create(info, result);
+
return E_NOTIMPL;
}
diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h
index 3814edb32bb..ebd2d20dfe7 100644
--- a/dlls/windowscodecs/wincodecs_private.h
+++ b/dlls/windowscodecs/wincodecs_private.h
@@ -31,6 +31,8 @@ DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0
DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22);
+DEFINE_GUID(GUID_WineContainerFormatIcns, 0xe4cd3e69,0x4436,0x4363,0x98,0x1d,0xcc,0xf0,0x5a,0x87,0x4c,0x73);
+
DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a);
extern IID IID_IMILBitmap;
@@ -353,6 +355,7 @@ enum encoder_option
};
#define ENCODER_FLAGS_MULTI_FRAME 0x1
+#define ENCODER_FLAGS_ICNS_SIZE 0x2
struct encoder_info
{
@@ -407,6 +410,7 @@ HRESULT CDECL jpeg_decoder_create(struct decoder_info *info, struct decoder **re
HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **result);
HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **result);
HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **result);
+HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result);
struct unix_funcs
{
--
2.17.1
1
0
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/rpcrt4/cpsf.c | 38 ++++++++----------------
dlls/rpcrt4/rpc_binding.c | 3 +-
dlls/rpcrt4/rpc_epmap.c | 3 +-
dlls/rpcrt4/rpc_transport.c | 59 +++++++++++++------------------------
dlls/rpcrt4/tests/rpc.c | 3 +-
dlls/rpcrt4/tests/server.c | 20 +++++--------
6 files changed, 44 insertions(+), 82 deletions(-)
diff --git a/dlls/rpcrt4/cpsf.c b/dlls/rpcrt4/cpsf.c
index 881894a1be5..006e6bce62f 100644
--- a/dlls/rpcrt4/cpsf.c
+++ b/dlls/rpcrt4/cpsf.c
@@ -41,11 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole);
static void format_clsid( WCHAR *buffer, const CLSID *clsid )
{
- static const WCHAR clsid_formatW[] = {'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X','-',
- '%','0','2','X','%','0','2','X','-','%','0','2','X','%','0','2','X',
- '%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','}',0};
-
- swprintf( buffer, 39, clsid_formatW, clsid->Data1, clsid->Data2, clsid->Data3,
+ swprintf( buffer, 39, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ clsid->Data1, clsid->Data2, clsid->Data3,
clsid->Data4[0], clsid->Data4[1], clsid->Data4[2], clsid->Data4[3],
clsid->Data4[4], clsid->Data4[5], clsid->Data4[6], clsid->Data4[7] );
@@ -222,15 +219,6 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
const ProxyFileInfo **pProxyFileList,
const CLSID *pclsid)
{
- static const WCHAR bothW[] = {'B','o','t','h',0};
- static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
- static const WCHAR clsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
- static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
- static const WCHAR psfactoryW[] = {'P','S','F','a','c','t','o','r','y','B','u','f','f','e','r',0};
- static const WCHAR numformatW[] = {'%','u',0};
- static const WCHAR nummethodsW[] = {'N','u','m','M','e','t','h','o','d','s',0};
- static const WCHAR inprocserverW[] = {'I','n','P','r','o','c','S','e','r','v','e','r','3','2',0};
- static const WCHAR threadingmodelW[] = {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
WCHAR clsid[39], keyname[50], module[MAX_PATH];
HKEY key, subkey;
DWORD len;
@@ -257,15 +245,15 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
TRACE("registering %s %s => %s\n",
debugstr_a(name), debugstr_guid(proxy->header.piid), debugstr_w(clsid));
- lstrcpyW( keyname, interfaceW );
+ lstrcpyW( keyname, L"Interface\\" );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
WCHAR num[10];
if (name)
RegSetValueExA(key, NULL, 0, REG_SZ, (const BYTE *)name, strlen(name)+1);
- RegSetValueW( key, clsid32W, REG_SZ, clsid, 0 );
- swprintf(num, ARRAY_SIZE(num), numformatW, proxy->header.DispatchTableCount);
- RegSetValueW( key, nummethodsW, REG_SZ, num, 0 );
+ RegSetValueW( key, L"ProxyStubClsid32", REG_SZ, clsid, 0 );
+ swprintf(num, ARRAY_SIZE(num), L"%u", proxy->header.DispatchTableCount);
+ RegSetValueW( key, L"NumMethods", REG_SZ, num, 0 );
RegCloseKey(key);
}
}
@@ -273,16 +261,16 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll,
}
/* register clsid to point to module */
- lstrcpyW( keyname, clsidW );
+ lstrcpyW( keyname, L"CLSID\\" );
lstrcatW( keyname, clsid );
len = GetModuleFileNameW(hDll, module, ARRAY_SIZE(module));
if (len && len < sizeof(module)) {
TRACE("registering CLSID %s => %s\n", debugstr_w(clsid), debugstr_w(module));
if (RegCreateKeyW(HKEY_CLASSES_ROOT, keyname, &key) == ERROR_SUCCESS) {
- RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)psfactoryW, sizeof(psfactoryW));
- if (RegCreateKeyW(key, inprocserverW, &subkey) == ERROR_SUCCESS) {
+ RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)L"PSFactoryBuffer", sizeof(L"PSFactoryBuffer"));
+ if (RegCreateKeyW(key, L"InProcServer32", &subkey) == ERROR_SUCCESS) {
RegSetValueExW(subkey, NULL, 0, REG_SZ, (LPBYTE)module, (lstrlenW(module)+1)*sizeof(WCHAR));
- RegSetValueExW(subkey, threadingmodelW, 0, REG_SZ, (const BYTE *)bothW, sizeof(bothW));
+ RegSetValueExW(subkey, L"ThreadingModel", 0, REG_SZ, (const BYTE *)L"Both", sizeof(L"Both"));
RegCloseKey(subkey);
}
RegCloseKey(key);
@@ -299,8 +287,6 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
const ProxyFileInfo **pProxyFileList,
const CLSID *pclsid)
{
- static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0};
- static const WCHAR interfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
WCHAR keyname[50];
WCHAR clsid[39];
@@ -321,7 +307,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
TRACE("unregistering %s %s\n", debugstr_a(name), debugstr_guid(proxy->header.piid));
- lstrcpyW( keyname, interfaceW );
+ lstrcpyW( keyname, L"Interface\\" );
format_clsid( keyname + lstrlenW(keyname), proxy->header.piid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
}
@@ -329,7 +315,7 @@ HRESULT WINAPI NdrDllUnregisterProxy(HMODULE hDll,
}
/* unregister clsid */
- lstrcpyW( keyname, clsidW );
+ lstrcpyW( keyname, L"CLSID\\" );
lstrcatW( keyname, clsid );
RegDeleteTreeW(HKEY_CLASSES_ROOT, keyname);
diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c
index e8cdb933474..56502e4eb34 100644
--- a/dlls/rpcrt4/rpc_binding.c
+++ b/dlls/rpcrt4/rpc_binding.c
@@ -676,7 +676,6 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
RPC_WSTR *Endpoint, RPC_WSTR *Options)
{
const WCHAR *data, *next;
- static const WCHAR ep_opt[] = {'e','n','d','p','o','i','n','t','=',0};
BOOL endpoint_already_found = FALSE;
TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_w(StringBinding),
@@ -740,7 +739,7 @@ RPC_STATUS WINAPI RpcStringBindingParseW( RPC_WSTR StringBinding, RPC_WSTR *ObjU
else HeapFree(GetProcessHeap(), 0, opt);
endpoint_already_found = TRUE;
} else {
- if (wcsncmp(opt, ep_opt, lstrlenW(ep_opt)) == 0) {
+ if (wcsncmp(opt, L"endpoint=", lstrlenW(L"endpoint=")) == 0) {
/* endpoint option */
if (endpoint_already_found) goto fail;
if (Endpoint) *Endpoint = unescape_string_binding_componentW(next+1, -1);
diff --git a/dlls/rpcrt4/rpc_epmap.c b/dlls/rpcrt4/rpc_epmap.c
index 6444f29e79f..35af454ce95 100644
--- a/dlls/rpcrt4/rpc_epmap.c
+++ b/dlls/rpcrt4/rpc_epmap.c
@@ -78,7 +78,6 @@ static const struct epm_endpoints
static BOOL start_rpcss(void)
{
- static const WCHAR rpcssW[] = {'R','p','c','S','s',0};
SC_HANDLE scm, service;
SERVICE_STATUS_PROCESS status;
BOOL ret = FALSE;
@@ -90,7 +89,7 @@ static BOOL start_rpcss(void)
ERR( "failed to open service manager\n" );
return FALSE;
}
- if (!(service = OpenServiceW( scm, rpcssW, SERVICE_START | SERVICE_QUERY_STATUS )))
+ if (!(service = OpenServiceW( scm, L"RpcSs", SERVICE_START | SERVICE_QUERY_STATUS )))
{
ERR( "failed to open RpcSs service\n" );
CloseServiceHandle( scm );
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 243c4780bf7..4f2c6642792 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -1874,7 +1874,6 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
{
- static const WCHAR wszUserAgent[] = {'M','S','R','P','C',0};
LPWSTR proxy = NULL;
LPWSTR user = NULL;
LPWSTR password = NULL;
@@ -1912,12 +1911,9 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
for (option = httpc->common.NetworkOptions; option;
option = (wcschr(option, ',') ? wcschr(option, ',')+1 : NULL))
{
- static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0};
- static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0};
-
- if (!wcsnicmp(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
+ if (!wcsnicmp(option, L"RpcProxy=", ARRAY_SIZE(L"RpcProxy=")-1))
{
- const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
+ const WCHAR *value_start = option + ARRAY_SIZE(L"RpcProxy=")-1;
const WCHAR *value_end;
const WCHAR *p;
@@ -1934,9 +1930,9 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
servername = RPCRT4_strndupW(value_start, value_end-value_start);
}
- else if (!wcsnicmp(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
+ else if (!wcsnicmp(option, L"HttpProxy=", ARRAY_SIZE(L"HttpProxy=")-1))
{
- const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
+ const WCHAR *value_start = option + ARRAY_SIZE(L"HttpProxy=")-1;
const WCHAR *value_end;
value_end = wcschr(option, ',');
@@ -1949,7 +1945,7 @@ static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
FIXME("unhandled option %s\n", debugstr_w(option));
}
- httpc->app_info = InternetOpenW(wszUserAgent, proxy ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_PRECONFIG,
+ httpc->app_info = InternetOpenW(L"MSRPC", proxy ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, INTERNET_FLAG_ASYNC);
if (!httpc->app_info)
{
@@ -2062,11 +2058,9 @@ static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data,
static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
{
- static const WCHAR fmtW[] =
- {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
- WCHAR header[ARRAY_SIZE(fmtW) + 10];
+ WCHAR header[ARRAY_SIZE(L"Content-Length: %u\r\n") + 10];
- swprintf(header, ARRAY_SIZE(header), fmtW, len);
+ swprintf(header, ARRAY_SIZE(header), L"Content-Length: %u\r\n", len);
if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))) return RPC_S_OK;
return RPC_S_SERVER_UNAVAILABLE;
}
@@ -2379,12 +2373,6 @@ static void destroy_authinfo(struct authinfo *info)
HeapFree(GetProcessHeap(), 0, info);
}
-static const WCHAR basicW[] = {'B','a','s','i','c',0};
-static const WCHAR ntlmW[] = {'N','T','L','M',0};
-static const WCHAR passportW[] = {'P','a','s','s','p','o','r','t',0};
-static const WCHAR digestW[] = {'D','i','g','e','s','t',0};
-static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
-
static const struct
{
const WCHAR *str;
@@ -2393,11 +2381,11 @@ static const struct
}
auth_schemes[] =
{
- { basicW, ARRAY_SIZE(basicW) - 1, RPC_C_HTTP_AUTHN_SCHEME_BASIC },
- { ntlmW, ARRAY_SIZE(ntlmW) - 1, RPC_C_HTTP_AUTHN_SCHEME_NTLM },
- { passportW, ARRAY_SIZE(passportW) - 1, RPC_C_HTTP_AUTHN_SCHEME_PASSPORT },
- { digestW, ARRAY_SIZE(digestW) - 1, RPC_C_HTTP_AUTHN_SCHEME_DIGEST },
- { negotiateW, ARRAY_SIZE(negotiateW) - 1, RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE }
+ { L"Basic", ARRAY_SIZE(L"Basic") - 1, RPC_C_HTTP_AUTHN_SCHEME_BASIC },
+ { L"NTLM", ARRAY_SIZE(L"NTLM") - 1, RPC_C_HTTP_AUTHN_SCHEME_NTLM },
+ { L"Passport", ARRAY_SIZE(L"Passport") - 1, RPC_C_HTTP_AUTHN_SCHEME_PASSPORT },
+ { L"Digest", ARRAY_SIZE(L"Digest") - 1, RPC_C_HTTP_AUTHN_SCHEME_DIGEST },
+ { L"Negotiate", ARRAY_SIZE(L"Negotiate") - 1, RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE }
};
static DWORD auth_scheme_from_header( const WCHAR *header )
@@ -2458,7 +2446,7 @@ static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername,
case RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE:
{
- static SEC_WCHAR ntlmW[] = {'N','T','L','M',0}, negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
+ static SEC_WCHAR ntlmW[] = L"NTLM", negotiateW[] = L"Negotiate";
SECURITY_STATUS ret;
SecBufferDesc out_desc, in_desc;
SecBuffer out, in;
@@ -2634,7 +2622,6 @@ static void drain_content(HINTERNET request, RpcHttpAsyncData *async_data, HANDL
static RPC_STATUS authorize_request(RpcConnection_http *httpc, HINTERNET request)
{
- static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':','\r','\n',0};
struct authinfo *info = NULL;
RPC_STATUS status;
BOOL ret;
@@ -2658,7 +2645,7 @@ static RPC_STATUS authorize_request(RpcConnection_http *httpc, HINTERNET request
}
if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
- HttpAddRequestHeadersW(request, authW, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
+ HttpAddRequestHeadersW(request, L"Authorization:\r\n", -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
destroy_authinfo(info);
return status;
@@ -2691,8 +2678,8 @@ static BOOL is_secure(RpcConnection_http *httpc)
static RPC_STATUS set_auth_cookie(RpcConnection_http *httpc, const WCHAR *value)
{
- static WCHAR httpW[] = {'h','t','t','p',0};
- static WCHAR httpsW[] = {'h','t','t','p','s',0};
+ static WCHAR httpW[] = L"http";
+ static WCHAR httpsW[] = L"https";
URL_COMPONENTSW uc;
DWORD len;
WCHAR *url;
@@ -2737,12 +2724,8 @@ static RPC_STATUS set_auth_cookie(RpcConnection_http *httpc, const WCHAR *value)
static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
{
RpcConnection_http *httpc = (RpcConnection_http *)Connection;
- static const WCHAR wszVerbIn[] = {'R','P','C','_','I','N','_','D','A','T','A',0};
- static const WCHAR wszVerbOut[] = {'R','P','C','_','O','U','T','_','D','A','T','A',0};
- static const WCHAR wszRpcProxyPrefix[] = {'/','r','p','c','/','r','p','c','p','r','o','x','y','.','d','l','l','?',0};
- static const WCHAR wszColon[] = {':',0};
- static const WCHAR wszAcceptType[] = {'a','p','p','l','i','c','a','t','i','o','n','/','r','p','c',0};
- LPCWSTR wszAcceptTypes[] = { wszAcceptType, NULL };
+ static const WCHAR wszRpcProxyPrefix[] = L"/rpc/rpcproxy.dll?";
+ LPCWSTR wszAcceptTypes[] = { L"application/rpc", NULL };
DWORD flags;
WCHAR *url;
RPC_STATUS status;
@@ -2777,7 +2760,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
memcpy(url, wszRpcProxyPrefix, sizeof(wszRpcProxyPrefix));
MultiByteToWideChar(CP_ACP, 0, Connection->NetworkAddr, -1, url+ARRAY_SIZE(wszRpcProxyPrefix)-1,
strlen(Connection->NetworkAddr)+1);
- lstrcatW(url, wszColon);
+ lstrcatW(url, L":");
MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+lstrlenW(url), strlen(Connection->Endpoint)+1);
secure = is_secure(httpc);
@@ -2794,7 +2777,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
HeapFree(GetProcessHeap(), 0, url);
return status;
}
- httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL, NULL, wszAcceptTypes,
+ httpc->in_request = HttpOpenRequestW(httpc->session, L"RPC_IN_DATA", url, NULL, NULL, wszAcceptTypes,
flags, (DWORD_PTR)httpc->async_data);
if (!httpc->in_request)
{
@@ -2820,7 +2803,7 @@ static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection)
drain_content(httpc->in_request, httpc->async_data, httpc->cancel_event);
}
- httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL, NULL, wszAcceptTypes,
+ httpc->out_request = HttpOpenRequestW(httpc->session, L"RPC_OUT_DATA", url, NULL, NULL, wszAcceptTypes,
flags, (DWORD_PTR)httpc->async_data);
HeapFree(GetProcessHeap(), 0, url);
if (!httpc->out_request)
diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c
index ce16145119b..0b9e71ec0a2 100644
--- a/dlls/rpcrt4/tests/rpc.c
+++ b/dlls/rpcrt4/tests/rpc.c
@@ -1165,7 +1165,6 @@ enum firewall_op
static HRESULT set_firewall( enum firewall_op op )
{
- static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
@@ -1205,7 +1204,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
- name = SysAllocString( testW );
+ name = SysAllocString( L"rpcrt4_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index d6655688314..7b340a11f87 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -245,9 +245,6 @@ static void (__cdecl *test_handle)(ctx_handle_t ctx_handle);
/* type check statements generated in header file */
fnprintf *p_printf = printf;
-static const WCHAR helloW[] = { 'H','e','l','l','o',0 };
-static const WCHAR worldW[] = { 'W','o','r','l','d','!',0 };
-
static BOOL is_interp;
static void set_interp_interface(void)
@@ -833,10 +830,10 @@ void __cdecl s_get_namesw(int *n, wstr_array_t *names)
wstr_array_t list;
list = MIDL_user_allocate(2 * sizeof(list[0]));
- list[0] = MIDL_user_allocate(sizeof(helloW));
- lstrcpyW(list[0], helloW);
- list[1] = MIDL_user_allocate(sizeof(worldW));
- lstrcpyW(list[1], worldW);
+ list[0] = MIDL_user_allocate(sizeof(L"Hello"));
+ lstrcpyW(list[0], L"Hello");
+ list[1] = MIDL_user_allocate(sizeof(L"World!"));
+ lstrcpyW(list[1], L"World!");
*names = list;
*n = 2;
@@ -1157,7 +1154,7 @@ static void
basic_tests(void)
{
char string[] = "I am a string";
- WCHAR wstring[] = {'I',' ','a','m',' ','a',' ','w','s','t','r','i','n','g', 0};
+ WCHAR wstring[] = L"I am a wstring";
int f[5] = {1, 3, 0, -2, -4};
vector_t a = {1, 3, 7};
vector_t vec1 = {4, -2, 1}, vec2 = {-5, 2, 3}, *pvec2 = &vec2;
@@ -1599,8 +1596,8 @@ pointer_tests(void)
namesw = NULL;
get_namesw(&n, &namesw);
ok(n == 2, "expected 2, got %d\n", n);
- ok(!lstrcmpW(namesw[0], helloW), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0]));
- ok(!lstrcmpW(namesw[1], worldW), "expected World!, got %s\n", wine_dbgstr_w(namesw[1]));
+ ok(!lstrcmpW(namesw[0], L"Hello"), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0]));
+ ok(!lstrcmpW(namesw[1], L"World!"), "expected World!, got %s\n", wine_dbgstr_w(namesw[1]));
MIDL_user_free(namesw[0]);
MIDL_user_free(namesw[1]);
MIDL_user_free(namesw);
@@ -2464,7 +2461,6 @@ enum firewall_op
static HRESULT set_firewall( enum firewall_op op )
{
- static const WCHAR testW[] = {'r','p','c','r','t','4','_','t','e','s','t',0};
HRESULT hr, init;
INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL;
@@ -2504,7 +2500,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done;
- name = SysAllocString( testW );
+ name = SysAllocString( L"rpcrt4_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr );
--
2.26.2
2
3
Nov. 28, 2020
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/oleaut32/oleaut.c | 81 ++++++++++---------------------
dlls/oleaut32/olefont.c | 2 +-
dlls/oleaut32/usrmarshal.c | 3 +-
dlls/oleaut32/varformat.c | 98 +++++++++++++++-----------------------
4 files changed, 66 insertions(+), 118 deletions(-)
diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c
index a026c2bc374..08e6bc6e3f2 100644
--- a/dlls/oleaut32/oleaut.c
+++ b/dlls/oleaut32/oleaut.c
@@ -1138,39 +1138,23 @@ HCURSOR WINAPI OleIconToCursor( HINSTANCE hinstExe, HICON hIcon)
*/
HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
{
- static const WCHAR ar_month1W[] = {0x645,0x62d,0x631,0x645,0};
- static const WCHAR ar_month2W[] = {0x635,0x641,0x631,0};
- static const WCHAR ar_month3W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x627,0x648,0x644,0};
- static const WCHAR ar_month4W[] = {0x631,0x628,0x64a,0x639,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0};
- static const WCHAR ar_month5W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x627,0x648,0x644,0x649,0};
- static const WCHAR ar_month6W[] = {0x62c,0x645,0x627,0x62f,0x649,' ',0x627,0x644,0x62b,0x627,0x646,0x64a,0x629,0};
- static const WCHAR ar_month7W[] = {0x631,0x62c,0x628,0};
- static const WCHAR ar_month8W[] = {0x634,0x639,0x628,0x627,0x646,0};
- static const WCHAR ar_month9W[] = {0x631,0x645,0x636,0x627,0x646,0};
- static const WCHAR ar_month10W[] = {0x634,0x648,0x627,0x643,0};
- static const WCHAR ar_month11W[] = {0x630,0x648,' ',0x627,0x644,0x642,0x639,0x62f,0x629,0};
- static const WCHAR ar_month12W[] = {0x630,0x648,' ',0x627,0x644,0x62d,0x62c,0x629,0};
-
static const WCHAR *arabic_hijri[] =
{
- ar_month1W,
- ar_month2W,
- ar_month3W,
- ar_month4W,
- ar_month5W,
- ar_month6W,
- ar_month7W,
- ar_month8W,
- ar_month9W,
- ar_month10W,
- ar_month11W,
- ar_month12W,
+ L"\x0645\x062d\x0631\x0645",
+ L"\x0635\x0641\x0631",
+ L"\x0631\x0628\x064a\x0639 \x0627\x0644\x0627\x0648\x0644",
+ L"\x0631\x0628\x064a\x0639 \x0627\x0644\x062b\x0627\x0646\x064a",
+ L"\x062c\x0645\x0627\x062f\x0649 \x0627\x0644\x0627\x0648\x0644\x0649",
+ L"\x062c\x0645\x0627\x062f\x0649 \x0627\x0644\x062b\x0627\x0646\x064a\x0629",
+ L"\x0631\x062c\x0628",
+ L"\x0634\x0639\x0628\x0627\x0646",
+ L"\x0631\x0645\x0636\x0627\x0646",
+ L"\x0634\x0648\x0627\x0643",
+ L"\x0630\x0648 \x0627\x0644\x0642\x0639\x062f\x0629",
+ L"\x0630\x0648 \x0627\x0644\x062d\x062c\x0629",
NULL
};
- static const WCHAR pl_month9W[] = {'w','r','z','e',0x15b,'n','i','a',0};
- static const WCHAR pl_month10W[] = {'p','a',0x17a,'d','z','i','e','r','n','i','k','a',0};
-
static const WCHAR *polish_genitive_names[] =
{
L"stycznia",
@@ -1181,40 +1165,27 @@ HRESULT WINAPI GetAltMonthNames(LCID lcid, LPOLESTR **str)
L"czerwca",
L"lipca",
L"sierpnia",
- pl_month9W,
- pl_month10W,
+ L"wrze\x015bnia",
+ L"pa\x017a" "dziernika",
L"listopada",
L"grudnia",
NULL
};
- static const WCHAR ru_month1W[] = {0x44f,0x43d,0x432,0x430,0x440,0x44f,0};
- static const WCHAR ru_month2W[] = {0x444,0x435,0x432,0x440,0x430,0x43b,0x44f,0};
- static const WCHAR ru_month3W[] = {0x43c,0x430,0x440,0x442,0x430,0};
- static const WCHAR ru_month4W[] = {0x430,0x43f,0x440,0x435,0x43b,0x44f,0};
- static const WCHAR ru_month5W[] = {0x43c,0x430,0x44f,0};
- static const WCHAR ru_month6W[] = {0x438,0x44e,0x43d,0x44f,0};
- static const WCHAR ru_month7W[] = {0x438,0x44e,0x43b,0x44f,0};
- static const WCHAR ru_month8W[] = {0x430,0x432,0x433,0x443,0x441,0x442,0x430,0};
- static const WCHAR ru_month9W[] = {0x441,0x435,0x43d,0x442,0x44f,0x431,0x440,0x44f,0};
- static const WCHAR ru_month10W[] = {0x43e,0x43a,0x442,0x44f,0x431,0x440,0x44f,0};
- static const WCHAR ru_month11W[] = {0x43d,0x43e,0x44f,0x431,0x440,0x44f,0};
- static const WCHAR ru_month12W[] = {0x434,0x435,0x43a,0x430,0x431,0x440,0x44f,0};
-
static const WCHAR *russian_genitive_names[] =
{
- ru_month1W,
- ru_month2W,
- ru_month3W,
- ru_month4W,
- ru_month5W,
- ru_month6W,
- ru_month7W,
- ru_month8W,
- ru_month9W,
- ru_month10W,
- ru_month11W,
- ru_month12W,
+ L"\x044f\x043d\x0432\x0430\x0440\x044f",
+ L"\x0444\x0435\x0432\x0440\x0430\x043b\x044f",
+ L"\x043c\x0430\x0440\x0442\x0430",
+ L"\x0430\x043f\x0440\x0435\x043b\x044f",
+ L"\x043c\x0430\x044f",
+ L"\x0438\x044e\x043d\x044f",
+ L"\x0438\x044e\x043b\x044f",
+ L"\x0430\x0432\x0433\x0443\x0441\x0442\x0430",
+ L"\x0441\x0435\x043d\x0442\x044f\x0431\x0440\x044f",
+ L"\x043e\x043a\x0442\x044f\x0431\x0440\x044f",
+ L"\x043d\x043e\x044f\x0431\x0440\x044f",
+ L"\x0434\x0435\x043a\x0430\x0431\x0440\x044f",
NULL
};
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index 1fd67f9b1b7..f071d00c602 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -338,7 +338,7 @@ HRESULT WINAPI OleCreateFontIndirect(
*ppvObj = 0;
if (!lpFontDesc) {
- static WCHAR fname[] = { 'S','y','s','t','e','m',0 };
+ static WCHAR fname[] = L"System";
fd.cbSizeofstruct = sizeof(fd);
fd.lpstrName = fname;
diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index 163b48f6f46..5eeafb8e378 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -2261,7 +2261,6 @@ HRESULT __RPC_STUB IPropertyBag_Read_Stub(
DWORD varType,
IUnknown *pUnkObj)
{
- static const WCHAR emptyWstr[] = {0};
IDispatch *disp;
HRESULT hr;
TRACE("(%p, %s, %p, %p, %x, %p)\n", This, debugstr_w(pszPropName), pVar,
@@ -2287,7 +2286,7 @@ HRESULT __RPC_STUB IPropertyBag_Read_Stub(
V_UNKNOWN(pVar) = pUnkObj;
break;
case VT_BSTR:
- V_BSTR(pVar) = SysAllocString(emptyWstr);
+ V_BSTR(pVar) = SysAllocString(L"");
break;
case VT_SAFEARRAY:
FIXME("Safearray support not yet implemented.\n");
diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
index 4fbb2ffa068..e88bf0bc365 100644
--- a/dlls/oleaut32/varformat.c
+++ b/dlls/oleaut32/varformat.c
@@ -44,10 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(variant);
*/
#define LCID_US MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT)
-static const WCHAR szPercent_d[] = { '%','d','\0' };
-static const WCHAR szPercentZeroTwo_d[] = { '%','0','2','d','\0' };
-static const WCHAR szPercentZeroStar_d[] = { '%','0','*','d','\0' };
-
/******************************************************************************
* Variant-Formats {OLEAUT32}
*
@@ -272,7 +268,6 @@ typedef struct tagFMT_DATE_HEADER
#define FMT_STR_COPY_SKIP 0x41 /* Copy len chars or skip if no char */
/* Named Formats and their tokenised values */
-static const WCHAR szGeneralDate[] = { 'G','e','n','e','r','a','l',' ','D','a','t','e','\0' };
static const BYTE fmtGeneralDate[0x0a] =
{
0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -280,7 +275,6 @@ static const BYTE fmtGeneralDate[0x0a] =
FMT_DATE_GENERAL,FMT_GEN_END
};
-static const WCHAR szShortDate[] = { 'S','h','o','r','t',' ','D','a','t','e','\0' };
static const BYTE fmtShortDate[0x0a] =
{
0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -288,7 +282,6 @@ static const BYTE fmtShortDate[0x0a] =
FMT_DATE_SHORT,FMT_GEN_END
};
-static const WCHAR szMediumDate[] = { 'M','e','d','i','u','m',' ','D','a','t','e','\0' };
static const BYTE fmtMediumDate[0x0a] =
{
0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -296,7 +289,6 @@ static const BYTE fmtMediumDate[0x0a] =
FMT_DATE_MEDIUM,FMT_GEN_END
};
-static const WCHAR szLongDate[] = { 'L','o','n','g',' ','D','a','t','e','\0' };
static const BYTE fmtLongDate[0x0a] =
{
0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -304,7 +296,6 @@ static const BYTE fmtLongDate[0x0a] =
FMT_DATE_LONG,FMT_GEN_END
};
-static const WCHAR szShortTime[] = { 'S','h','o','r','t',' ','T','i','m','e','\0' };
static const BYTE fmtShortTime[0x0c] =
{
0x0c,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -312,7 +303,6 @@ static const BYTE fmtShortTime[0x0c] =
FMT_DATE_TIME_UNK2,FMT_DATE_TIME_SEP,FMT_DATE_MIN_0,FMT_GEN_END
};
-static const WCHAR szMediumTime[] = { 'M','e','d','i','u','m',' ','T','i','m','e','\0' };
static const BYTE fmtMediumTime[0x11] =
{
0x11,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -321,7 +311,6 @@ static const BYTE fmtMediumTime[0x11] =
FMT_GEN_INLINE,0x01,' ','\0',FMT_DATE_AMPM_SYS1,FMT_GEN_END
};
-static const WCHAR szLongTime[] = { 'L','o','n','g',' ','T','i','m','e','\0' };
static const BYTE fmtLongTime[0x0d] =
{
0x0a,FMT_TYPE_DATE,sizeof(FMT_SHORT_HEADER),
@@ -329,7 +318,6 @@ static const BYTE fmtLongTime[0x0d] =
FMT_DATE_TIME_SYS,FMT_GEN_END
};
-static const WCHAR szTrueFalse[] = { 'T','r','u','e','/','F','a','l','s','e','\0' };
static const BYTE fmtTrueFalse[0x0d] =
{
0x0d,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -337,7 +325,6 @@ static const BYTE fmtTrueFalse[0x0d] =
FMT_NUM_TRUE_FALSE,FMT_GEN_END
};
-static const WCHAR szYesNo[] = { 'Y','e','s','/','N','o','\0' };
static const BYTE fmtYesNo[0x0d] =
{
0x0d,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -345,7 +332,6 @@ static const BYTE fmtYesNo[0x0d] =
FMT_NUM_YES_NO,FMT_GEN_END
};
-static const WCHAR szOnOff[] = { 'O','n','/','O','f','f','\0' };
static const BYTE fmtOnOff[0x0d] =
{
0x0d,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -353,13 +339,11 @@ static const BYTE fmtOnOff[0x0d] =
FMT_NUM_ON_OFF,FMT_GEN_END
};
-static const WCHAR szGeneralNumber[] = { 'G','e','n','e','r','a','l',' ','N','u','m','b','e','r','\0' };
static const BYTE fmtGeneralNumber[sizeof(FMT_HEADER)] =
{
sizeof(FMT_HEADER),FMT_TYPE_GENERAL,sizeof(FMT_HEADER),0x0,0x0,0x0
};
-static const WCHAR szCurrency[] = { 'C','u','r','r','e','n','c','y','\0' };
static const BYTE fmtCurrency[0x26] =
{
0x26,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x12,0x0,0x0,
@@ -374,7 +358,6 @@ static const BYTE fmtCurrency[0x26] =
FMT_GEN_END
};
-static const WCHAR szFixed[] = { 'F','i','x','e','d','\0' };
static const BYTE fmtFixed[0x11] =
{
0x11,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -382,7 +365,6 @@ static const BYTE fmtFixed[0x11] =
FMT_NUM_COPY_ZERO,0x1,FMT_NUM_DECIMAL,FMT_NUM_COPY_ZERO,0x2,FMT_GEN_END
};
-static const WCHAR szStandard[] = { 'S','t','a','n','d','a','r','d','\0' };
static const BYTE fmtStandard[0x11] =
{
0x11,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -390,7 +372,6 @@ static const BYTE fmtStandard[0x11] =
FMT_NUM_COPY_ZERO,0x1,FMT_NUM_DECIMAL,FMT_NUM_COPY_ZERO,0x2,FMT_GEN_END
};
-static const WCHAR szPercent[] = { 'P','e','r','c','e','n','t','\0' };
static const BYTE fmtPercent[0x15] =
{
0x15,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -399,7 +380,6 @@ static const BYTE fmtPercent[0x15] =
FMT_GEN_INLINE,0x1,'%','\0',FMT_GEN_END
};
-static const WCHAR szScientific[] = { 'S','c','i','e','n','t','i','f','i','c','\0' };
static const BYTE fmtScientific[0x13] =
{
0x13,FMT_TYPE_NUMBER,sizeof(FMT_HEADER),0x0,0x0,0x0,
@@ -416,22 +396,22 @@ typedef struct tagNAMED_FORMAT
/* Format name to tokenised format. Must be kept sorted by name */
static const NAMED_FORMAT VARIANT_NamedFormats[] =
{
- { szCurrency, fmtCurrency },
- { szFixed, fmtFixed },
- { szGeneralDate, fmtGeneralDate },
- { szGeneralNumber, fmtGeneralNumber },
- { szLongDate, fmtLongDate },
- { szLongTime, fmtLongTime },
- { szMediumDate, fmtMediumDate },
- { szMediumTime, fmtMediumTime },
- { szOnOff, fmtOnOff },
- { szPercent, fmtPercent },
- { szScientific, fmtScientific },
- { szShortDate, fmtShortDate },
- { szShortTime, fmtShortTime },
- { szStandard, fmtStandard },
- { szTrueFalse, fmtTrueFalse },
- { szYesNo, fmtYesNo }
+ { L"Currency", fmtCurrency },
+ { L"Fixed", fmtFixed },
+ { L"General Date", fmtGeneralDate },
+ { L"General Number", fmtGeneralNumber },
+ { L"Long Date", fmtLongDate },
+ { L"Long Time", fmtLongTime },
+ { L"Medium Date", fmtMediumDate },
+ { L"Medium Time", fmtMediumTime },
+ { L"On/Off", fmtOnOff },
+ { L"Percent", fmtPercent },
+ { L"Scientific", fmtScientific },
+ { L"Short Date", fmtShortDate },
+ { L"Short Time", fmtShortTime },
+ { L"Standard", fmtStandard },
+ { L"True/False", fmtTrueFalse },
+ { L"Yes/No", fmtYesNo }
};
typedef const NAMED_FORMAT *LPCNAMED_FORMAT;
@@ -1415,13 +1395,13 @@ VARIANT_FormatNumber_Bool:
if (exponent < 0)
{
*pBuff++ = '-';
- swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), szPercentZeroStar_d, pToken[1], -exponent);
+ swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), L"%0*d", pToken[1], -exponent);
}
else
{
if (*pToken == FMT_NUM_EXP_POS_L || *pToken == FMT_NUM_EXP_POS_U)
*pBuff++ = '+';
- swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), szPercentZeroStar_d, pToken[1], exponent);
+ swprintf(pBuff, ARRAY_SIZE(buff) - (pBuff - buff), L"%0*d", pToken[1], exponent);
}
while (*pBuff)
pBuff++;
@@ -1697,12 +1677,12 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
break;
case FMT_DATE_DAY:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wDay;
break;
case FMT_DATE_DAY_0:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wDay;
break;
@@ -1736,7 +1716,7 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
break;
case FMT_DATE_DAY_WEEK:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
if (pToken[1])
dwVal = udate.st.wDayOfWeek + 2 - pToken[1];
else
@@ -1749,19 +1729,19 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
break;
case FMT_DATE_WEEK_YEAR:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.wDayOfYear / 7 + 1;
pToken += 2;
FIXME("Ignoring nFirstDay of %d, nFirstWeek of %d\n", pToken[0], pToken[1]);
break;
case FMT_DATE_MON:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wMonth;
break;
case FMT_DATE_MON_0:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wMonth;
break;
@@ -1780,58 +1760,58 @@ static HRESULT VARIANT_FormatDate(LPVARIANT pVarIn, LPOLESTR lpszFormat,
break;
case FMT_DATE_YEAR_DOY:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.wDayOfYear;
break;
case FMT_DATE_YEAR_0:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wYear % 100;
break;
case FMT_DATE_YEAR_LONG:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wYear;
break;
case FMT_DATE_MIN:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wMinute;
break;
case FMT_DATE_MIN_0:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wMinute;
break;
case FMT_DATE_SEC:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wSecond;
break;
case FMT_DATE_SEC_0:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wSecond;
break;
case FMT_DATE_HOUR:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wHour;
break;
case FMT_DATE_HOUR_0:
case FMT_DATE_TIME_UNK2:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wHour;
break;
case FMT_DATE_HOUR_12:
- szPrintFmt = szPercent_d;
+ szPrintFmt = L"%d";
dwVal = udate.st.wHour ? udate.st.wHour > 12 ? udate.st.wHour - 12 : udate.st.wHour : 12;
break;
case FMT_DATE_HOUR_12_0:
- szPrintFmt = szPercentZeroTwo_d;
+ szPrintFmt = L"%02d";
dwVal = udate.st.wHour ? udate.st.wHour > 12 ? udate.st.wHour - 12 : udate.st.wHour : 12;
break;
@@ -1918,7 +1898,7 @@ static HRESULT VARIANT_FormatString(LPVARIANT pVarIn, LPOLESTR lpszFormat,
LPBYTE rgbTok, ULONG dwFlags,
BSTR *pbstrOut, LCID lcid)
{
- static WCHAR szEmpty[] = { '\0' };
+ static WCHAR szEmpty[] = L"";
WCHAR buff[256], *pBuff = buff;
WCHAR *pSrc;
FMT_HEADER *header = (FMT_HEADER*)rgbTok;
@@ -2189,7 +2169,7 @@ HRESULT WINAPI VarFormat(LPVARIANT pVarIn, LPOLESTR lpszFormat,
*/
HRESULT WINAPI VarFormatDateTime(LPVARIANT pVarIn, INT nFormat, ULONG dwFlags, BSTR *pbstrOut)
{
- static WCHAR szEmpty[] = { '\0' };
+ static WCHAR szEmpty[] = L"";
const BYTE* lpFmt = NULL;
TRACE("%s,%d,0x%08x,%p)\n", debugstr_variant(pVarIn), nFormat, dwFlags, pbstrOut);
@@ -2345,8 +2325,6 @@ HRESULT WINAPI VarFormatNumber(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT nParens,
INT nGrouping, ULONG dwFlags, BSTR *pbstrOut)
{
- static const WCHAR szPercent[] = { '%','\0' };
- static const WCHAR szPercentBracket[] = { '%',')','\0' };
WCHAR buff[256];
HRESULT hRet;
VARIANT vDbl;
@@ -2382,7 +2360,7 @@ HRESULT WINAPI VarFormatPercent(LPVARIANT pVarIn, INT nDigits, INT nLeading, INT
dwLen -= bBracket;
memcpy(buff, *pbstrOut, dwLen * sizeof(WCHAR));
- lstrcpyW(buff + dwLen, bBracket ? szPercentBracket : szPercent);
+ lstrcpyW(buff + dwLen, bBracket ? L"%)" : L"%");
SysFreeString(*pbstrOut);
*pbstrOut = SysAllocString(buff);
if (!*pbstrOut)
--
2.26.2
1
0
Nov. 28, 2020
Signed-off-by: Derek Lesho <dlesho(a)codeweavers.com>
---
v3:
- Rebase against 133ba763e1f419dc23fd58ac82c6d8a73014ae22.
- Remove accidental inclusion of test.mp3.
---
dlls/mf/tests/Makefile.in | 2 -
dlls/mf/tests/mf.c | 601 +++++++++++++++++++++++++++++++-------
dlls/mf/tests/resource.rc | 22 --
3 files changed, 499 insertions(+), 126 deletions(-)
delete mode 100644 dlls/mf/tests/resource.rc
diff --git a/dlls/mf/tests/Makefile.in b/dlls/mf/tests/Makefile.in
index 5eb9ee4d4e3..614eb4fbc9e 100644
--- a/dlls/mf/tests/Makefile.in
+++ b/dlls/mf/tests/Makefile.in
@@ -3,5 +3,3 @@ IMPORTS = mf mfplat mfuuid ole32 user32
C_SRCS = \
mf.c
-
-RC_SRCS = resource.rc
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index fda80974724..092735466be 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -44,6 +44,7 @@ DEFINE_GUID(MFVideoFormat_ABGR32, 0x00000020, 0x0000, 0x0010, 0x80, 0x00, 0x00,
#include "mmdeviceapi.h"
#include "audioclient.h"
#include "evr.h"
+#include "propvarutil.h"
#include "wine/test.h"
@@ -97,34 +98,6 @@ static HWND create_window(void)
0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
}
-static WCHAR *load_resource(const WCHAR *name)
-{
- static WCHAR pathW[MAX_PATH];
- DWORD written;
- HANDLE file;
- HRSRC res;
- void *ptr;
-
- GetTempPathW(ARRAY_SIZE(pathW), pathW);
- lstrcatW(pathW, name);
-
- file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0,
- NULL, CREATE_ALWAYS, 0, 0);
- ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n",
- wine_dbgstr_w(pathW), GetLastError());
-
- res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
- ok(res != 0, "couldn't find resource\n");
- ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
- WriteFile(file, ptr, SizeofResource(GetModuleHandleA(NULL), res),
- &written, NULL);
- ok(written == SizeofResource(GetModuleHandleA(NULL), res),
- "couldn't write resource\n" );
- CloseHandle(file);
-
- return pathW;
-}
-
static HRESULT WINAPI test_unk_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IUnknown))
@@ -1447,26 +1420,316 @@ static const IMFSampleGrabberSinkCallbackVtbl test_grabber_callback_vtbl =
test_grabber_callback_OnShutdown,
};
+struct test_source
+{
+ IMFMediaSource IMFMediaSource_iface;
+ LONG refcount;
+};
+
+static struct test_source *impl_from_IMFMediaSource(IMFMediaSource *iface)
+{
+ return CONTAINING_RECORD(iface, struct test_source, IMFMediaSource_iface);
+}
+
+static HRESULT WINAPI test_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out)
+{
+ if (IsEqualIID(riid, &IID_IMFMediaSource)
+ || IsEqualIID(riid, &IID_IMFMediaEventGenerator)
+ || IsEqualIID(riid, &IID_IUnknown))
+ {
+ *out = iface;
+ }
+ else
+ {
+ *out = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IMFMediaSource_AddRef(iface);
+ return S_OK;
+}
+
+static ULONG WINAPI test_source_AddRef(IMFMediaSource *iface)
+{
+ struct test_source *source = impl_from_IMFMediaSource(iface);
+ return InterlockedIncrement(&source->refcount);
+}
+
+static ULONG WINAPI test_source_Release(IMFMediaSource *iface)
+{
+ struct test_source *source = impl_from_IMFMediaSource(iface);
+ ULONG refcount = InterlockedDecrement(&source->refcount);
+
+ if (!refcount)
+ HeapFree(GetProcessHeap(), 0, source);
+
+ return refcount;
+}
+
+static HRESULT WINAPI test_source_GetEvent(IMFMediaSource *iface, DWORD flags, IMFMediaEvent **event)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_BeginGetEvent(IMFMediaSource *iface, IMFAsyncCallback *callback, IUnknown *state)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_EndGetEvent(IMFMediaSource *iface, IMFAsyncResult *result, IMFMediaEvent **event)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_QueueEvent(IMFMediaSource *iface, MediaEventType event_type, REFGUID ext_type,
+ HRESULT hr, const PROPVARIANT *value)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_GetCharacteristics(IMFMediaSource *iface, DWORD *flags)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **pd)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *pd, const GUID *time_format,
+ const PROPVARIANT *start_position)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Stop(IMFMediaSource *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Pause(IMFMediaSource *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Shutdown(IMFMediaSource *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static const IMFMediaSourceVtbl test_source_vtbl =
+{
+ test_source_QueryInterface,
+ test_source_AddRef,
+ test_source_Release,
+ test_source_GetEvent,
+ test_source_BeginGetEvent,
+ test_source_EndGetEvent,
+ test_source_QueueEvent,
+ test_source_GetCharacteristics,
+ test_source_CreatePresentationDescriptor,
+ test_source_Start,
+ test_source_Stop,
+ test_source_Pause,
+ test_source_Shutdown,
+};
+
+static IMFMediaSource *create_test_source(void)
+{
+ struct test_source *source;
+
+ source = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*source));
+ source->IMFMediaSource_iface.lpVtbl = &test_source_vtbl;
+ source->refcount = 1;
+
+ return &source->IMFMediaSource_iface;
+}
+
static void test_topology_loader(void)
{
+ static const struct resolution_test
+ {
+ union
+ {
+ WAVEFORMATEX input_type;
+ MPEGLAYER3WAVEFORMAT mp3_input_type;
+ };
+ WAVEFORMATEX output_type;
+ MF_CONNECT_METHOD method;
+ HRESULT expected_result;
+ BOOL expect_decoder, expect_converter, wine_todo;
+ }
+ resolution_tests[] =
+ {
+ {
+ .input_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_DIRECT,
+ .expected_result = S_OK,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = FALSE,
+ },
+ {
+ .input_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 48000,
+ .nAvgBytesPerSec = 48000, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_DIRECT,
+ .expected_result = MF_E_INVALIDMEDIATYPE,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = FALSE,
+ },
+ {
+ .input_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 48000,
+ .nAvgBytesPerSec = 48000, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_ALLOW_CONVERTER,
+ .expected_result = S_OK,
+ .expect_decoder = FALSE,
+ .expect_converter = TRUE,
+ .wine_todo = TRUE,
+ },
+ /* Test MF_TOPONODE_CONNECT_METHOD:
+ - 0x1 (MF_CONNECT_ALLOW_CONVERTER) allows converters
+ - 0x3 (MF_CONNECT_ALLOW_DECODER) allows converters and decoders
+ - 0x2 allows neither */
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_DIRECT,
+ .expected_result = MF_E_INVALIDMEDIATYPE,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_ALLOW_CONVERTER,
+ .expected_result = MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = 2,
+ .expected_result = MF_E_INVALIDMEDIATYPE,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_ALLOW_DECODER,
+ .expected_result = S_OK,
+ .expect_decoder = TRUE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ };
+
IMFSampleGrabberSinkCallback test_grabber_callback = { &test_grabber_callback_vtbl };
+ IMFTopologyNode *src_node, *sink_node, *src_node2, *sink_node2, *mft_node;
IMFTopology *topology, *topology2, *full_topology;
- IMFTopologyNode *src_node, *sink_node;
+ unsigned int count, value, index;
IMFPresentationDescriptor *pd;
- IMFSourceResolver *resolver;
IMFActivate *sink_activate;
IMFStreamSink *stream_sink;
- unsigned int count, value;
+ MF_TOPOLOGY_TYPE node_type;
IMFMediaType *media_type;
IMFStreamDescriptor *sd;
- MF_OBJECT_TYPE obj_type;
+ IMFTransform *transform;
IMFMediaSource *source;
IMFTopoLoader *loader;
- IMFByteStream *stream;
- IMFAttributes *attr;
+ IUnknown *node_object;
+ BOOL compare_result;
IMFMediaSink *sink;
- WCHAR *filename;
- BOOL selected;
+ WORD node_count;
+ unsigned int i;
+ TOPOID node_id;
HRESULT hr;
GUID guid;
@@ -1487,44 +1750,41 @@ static void test_topology_loader(void)
todo_wine
ok(hr == MF_E_TOPO_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
- hr = MFCreateSourceResolver(&resolver);
- ok(hr == S_OK, "Failed to create source resolver, hr %#x.\n", hr);
+ /* Add source node. */
+ hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node);
+ ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
- filename = load_resource(L"test.wav");
+ /* when a decoder is involved, windows requires this attribute to be present */
+ source = create_test_source();
- hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &stream);
- ok(hr == S_OK, "Failed to create file stream, hr %#x.\n", hr);
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_SOURCE, (IUnknown *)source);
+ ok(hr == S_OK, "Failed to set node source, hr %#x.\n", hr);
- IMFByteStream_QueryInterface(stream, &IID_IMFAttributes, (void **)&attr);
- IMFAttributes_SetString(attr, &MF_BYTESTREAM_CONTENT_TYPE, L"audio/wav");
- IMFAttributes_Release(attr);
+ IMFMediaSource_Release(source);
- hr = IMFSourceResolver_CreateObjectFromByteStream(resolver, stream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL,
- &obj_type, (IUnknown **)&source);
- ok(hr == S_OK || broken(FAILED(hr)) /* Vista */, "Failed to create source, hr %#x.\n", hr);
- if (FAILED(hr))
- return;
+ hr = MFCreateMediaType(&media_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
- hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd);
- ok(hr == S_OK, "Failed to create descriptor, hr %#x.\n", hr);
- if (FAILED(hr))
- return;
+ hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
+ hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
- hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd);
- ok(hr == S_OK, "Failed to get stream descriptor, hr %#x.\n", hr);
+ hr = MFCreateStreamDescriptor(0, 1, &media_type, &sd);
+ ok(hr == S_OK, "Failed to create stream descriptor, hr %#x.\n");
- /* Add source node. */
- hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node);
- ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd);
+ ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
- hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_SOURCE, (IUnknown *)source);
- ok(hr == S_OK, "Failed to set node source, hr %#x.\n", hr);
+ hr = MFCreatePresentationDescriptor(1, &sd, &pd);
+ ok(hr == S_OK, "Failed to create presentation descriptor, hr %#x.\n");
hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_PRESENTATION_DESCRIPTOR, (IUnknown *)pd);
ok(hr == S_OK, "Failed to set node pd, hr %#x.\n", hr);
- hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd);
- ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
+ IMFPresentationDescriptor_Release(pd);
+ IMFStreamDescriptor_Release(sd);
+ IMFMediaType_Release(media_type);
hr = IMFTopology_AddNode(topology, src_node);
ok(hr == S_OK, "Failed to add a node, hr %#x.\n", hr);
@@ -1534,7 +1794,9 @@ todo_wine
todo_wine
ok(hr == MF_E_TOPO_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
- /* Add grabber sink. */
+ hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node);
+ ok(hr == S_OK, "Failed to create output node, hr %#x.\n", hr);
+
hr = MFCreateMediaType(&media_type);
ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
@@ -1546,13 +1808,11 @@ todo_wine
hr = MFCreateSampleGrabberSinkActivate(media_type, &test_grabber_callback, &sink_activate);
ok(hr == S_OK, "Failed to create grabber sink, hr %#x.\n", hr);
- IMFMediaType_Release(media_type);
-
- hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node);
- ok(hr == S_OK, "Failed to create output node, hr %#x.\n", hr);
-
hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate);
ok(hr == S_OK, "Failed to set object, hr %#x.\n", hr);
+
+ IMFMediaType_Release(media_type);
+
hr = IMFTopology_AddNode(topology, sink_node);
ok(hr == S_OK, "Failed to add sink node, hr %#x.\n", hr);
@@ -1567,55 +1827,192 @@ todo_wine
hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
ok(hr == MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
- hr = IMFActivate_ActivateObject(sink_activate, &IID_IMFMediaSink, (void **)&sink);
- ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr);
+ for (i = 0; i < ARRAY_SIZE(resolution_tests); i++)
+ {
+ IMFMediaType *input_type, *output_type;
+ IMFMediaTypeHandler *mth;
- hr = IMFMediaSink_GetStreamSinkByIndex(sink, 0, &stream_sink);
- ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ /* TODO: remove once MFInitMediaTypeFromWaveFormatEx gains support for non-zero cbSize */
+ if(resolution_tests[i].wine_todo && !strcmp(winetest_platform, "wine"))
+ {
+ todo_wine ok(0, "Skipping test %u on wine.\n", i);
+ continue;
+ }
- hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)stream_sink);
- ok(hr == S_OK, "Failed to set object, hr %#x.\n", hr);
+ hr = MFCreateMediaType(&input_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
- IMFStreamSink_Release(stream_sink);
+ hr = MFInitMediaTypeFromWaveFormatEx(input_type, &resolution_tests[i].input_type, sizeof(WAVEFORMATEX) + resolution_tests[i].input_type.cbSize);
+ ok(hr == S_OK, "MFInitMediaTypeFromWaveFormatEx failed, hr %#x.\n", hr);
- hr = IMFTopology_GetCount(topology, &count);
- ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
- ok(count == 0, "Unexpected count %u.\n", count);
+ hr = MFCreateMediaType(&output_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
- hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
- ok(hr == S_OK, "Failed to resolve topology, hr %#x.\n", hr);
- ok(full_topology != topology, "Unexpected instance.\n");
+ hr = MFInitMediaTypeFromWaveFormatEx(output_type, &resolution_tests[i].output_type, sizeof(WAVEFORMATEX) + resolution_tests[i].output_type.cbSize);
+ ok(hr == S_OK, "MFInitMediaTypeFromWaveFormatEx failed, hr %#x.\n", hr);
- hr = IMFTopology_GetCount(topology, &count);
- ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
- ok(count == 0, "Unexpected count %u.\n", count);
+ hr = MFCreateStreamDescriptor(0, 1, &input_type, &sd);
+ ok(hr == S_OK, "Failed to create stream descriptor, hr %#x.\n", hr);
- hr = IMFTopology_GetCount(full_topology, &count);
- ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
+ hr = IMFStreamDescriptor_GetMediaTypeHandler(sd, &mth);
+ ok(hr == S_OK, "Failed to get media type handler, hr %#x.\n", hr);
+
+ hr = IMFMediaTypeHandler_SetCurrentMediaType(mth, input_type);
+ ok(hr == S_OK, "Failed to set current media type, hr %#x.\n", hr);
+
+ IMFMediaTypeHandler_Release(mth);
+
+ hr = MFCreatePresentationDescriptor(1, &sd, &pd);
+ ok(hr == S_OK, "Failed to create presentation descriptor, hr %#x.\n", hr);
+
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_PRESENTATION_DESCRIPTOR, (IUnknown *)pd);
+ ok(hr == S_OK, "Failed to set node pd, hr %#x.\n", hr);
+
+ IMFPresentationDescriptor_Release(pd);
+
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd);
+ ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
+
+ IMFStreamDescriptor_Release(sd);
+
+ hr = MFCreateSampleGrabberSinkActivate(output_type, &test_grabber_callback, &sink_activate);
+ ok(hr == S_OK, "Failed to create grabber sink, hr %#x.\n", hr);
+
+ hr = IMFActivate_ActivateObject(sink_activate, &IID_IMFMediaSink, (void **)&sink);
+ ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr);
+
+ hr = IMFMediaSink_GetStreamSinkByIndex(sink, 0, &stream_sink);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ IMFMediaSink_Release(sink);
+
+ hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)stream_sink);
+ ok(hr == S_OK, "Failed to set object, hr %#x.\n", hr);
+
+ IMFStreamSink_Release(stream_sink);
+
+ hr = IMFTopologyNode_SetUINT32(sink_node, &MF_TOPONODE_CONNECT_METHOD, resolution_tests[i].method);
+ ok(hr == S_OK, "Failed to set connect method, hr %#x.\n", hr);
+
+ hr = IMFTopology_GetCount(topology, &count);
+ ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
+ ok(count == 0, "Unexpected count %u.\n", count);
+
+ hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
+todo_wine_if(resolution_tests[i].wine_todo)
+ ok(hr == resolution_tests[i].expected_result, "Unexpected hr %#x on test %u.\n", hr, i);
+ ok(full_topology != topology, "Unexpected instance.\n");
+
+ if (resolution_tests[i].expected_result == S_OK && hr == S_OK)
+ {
+ hr = IMFTopology_GetCount(full_topology, &count);
+ ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
todo_wine
- ok(count == 1, "Unexpected count %u.\n", count);
+ ok(count == 1, "Unexpected count %u.\n", count);
- hr = IMFTopology_GetItemByIndex(full_topology, 0, &guid, NULL);
+ hr = IMFTopology_GetItemByIndex(full_topology, 0, &guid, NULL);
todo_wine {
- ok(hr == S_OK, "Failed to get attribute key, hr %#x.\n", hr);
- ok(IsEqualGUID(&guid, &MF_TOPOLOGY_RESOLUTION_STATUS), "Unexpected key %s.\n", wine_dbgstr_guid(&guid));
+ ok(hr == S_OK, "Failed to get attribute key, hr %#x.\n", hr);
+ ok(IsEqualGUID(&guid, &MF_TOPOLOGY_RESOLUTION_STATUS), "Unexpected key %s.\n", wine_dbgstr_guid(&guid));
}
- value = 0xdeadbeef;
- hr = IMFTopology_GetUINT32(full_topology, &MF_TOPOLOGY_RESOLUTION_STATUS, &value);
+ value = 0xdeadbeef;
+ hr = IMFTopology_GetUINT32(full_topology, &MF_TOPOLOGY_RESOLUTION_STATUS, &value);
todo_wine {
- ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
- ok(value == MF_TOPOLOGY_RESOLUTION_SUCCEEDED, "Unexpected value %#x.\n", value);
+ ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
+ ok(value == MF_TOPOLOGY_RESOLUTION_SUCCEEDED, "Unexpected value %#x.\n", value);
}
- hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL);
- ok(hr == S_OK, "Failed to resolve topology, hr %#x.\n", hr);
- ok(full_topology != topology2, "Unexpected instance.\n");
- IMFTopology_Release(topology2);
- IMFTopology_Release(full_topology);
+ hr = IMFTopology_GetNodeCount(full_topology, &node_count);
+ ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
+ ok(node_count == 2 + resolution_tests[i].expect_decoder + resolution_tests[i].expect_converter, "Unexpected node count %u.\n", node_count);
+
+ hr = IMFTopologyNode_GetTopoNodeID(src_node, &node_id);
+ ok(hr == S_OK, "Failed to get source node id, hr %#x.\n", hr);
+
+ hr = IMFTopology_GetNodeByID(full_topology, node_id, &src_node2);
+ ok(hr == S_OK, "Failed to get source in resolved topology, hr %#x.\n", hr);
+
+ hr = IMFTopologyNode_GetTopoNodeID(sink_node, &node_id);
+ ok(hr == S_OK, "Failed to get sink node id, hr %#x.\n", hr);
+
+ hr = IMFTopology_GetNodeByID(full_topology, node_id, &sink_node2);
+ ok(hr == S_OK, "Failed to get sink in resolved topology, hr %#x.\n", hr);
+
+ if (resolution_tests[i].expect_decoder || resolution_tests[i].expect_converter)
+ {
+ hr = IMFTopologyNode_GetOutput(src_node2, 0, &mft_node, &index);
+ ok(hr == S_OK, "Failed to get transform node in resolved topology, hr %#x.\n", hr);
+ ok(index == 0, "Unexpected stream index %u.\n", index);
+
+ hr = IMFTopologyNode_GetNodeType(mft_node, &node_type);
+ ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#x.\n", hr);
+ ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u, expected MF_TOPOLOGY_TRANSFORM_NODE.\n", node_type);
+
+ hr = IMFTopologyNode_GetObject(mft_node, &node_object);
+ ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
+
+ hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void**) &transform);
+ ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr);
+ IUnknown_Release(node_object);
+
+ hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type);
+ ok(hr == S_OK, "Failed to get transform input type, hr %#x.\n", hr);
+
+ hr = IMFMediaType_Compare(media_type, (IMFAttributes *)input_type, MF_ATTRIBUTES_MATCH_ALL_ITEMS, &compare_result);
+ ok(hr == S_OK, "Failed to compare media types, hr %#x.\n", hr);
+ ok(compare_result, "Input type of first transform doesn't match source node type.\n");
+
+ IMFTopologyNode_Release(mft_node);
+ IMFMediaType_Release(media_type);
+ IMFTransform_Release(transform);
+
+ hr = IMFTopologyNode_GetInput(sink_node2, 0, &mft_node, &index);
+ ok(hr == S_OK, "Failed to get transform node in resolved topology, hr %#x.\n", hr);
+ ok(index == 0, "Unexpected stream index %u.\n", index);
+
+ hr = IMFTopologyNode_GetNodeType(mft_node, &node_type);
+ ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#x.\n", hr);
+ ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u, expected MF_TOPOLOGY_TRANSFORM_NODE.\n", node_type);
+
+ hr = IMFTopologyNode_GetObject(mft_node, &node_object);
+ ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
+
+ hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void**) &transform);
+ ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr);
+ IUnknown_Release(node_object);
+
+ hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type);
+ ok(hr == S_OK, "Failed to get transform output type, hr %#x.\n", hr);
+
+ hr = IMFMediaType_Compare(media_type, (IMFAttributes *)output_type, MF_ATTRIBUTES_MATCH_ALL_ITEMS, &compare_result);
+ ok(hr == S_OK, "Failed to compare media types, hr %#x.\n", hr);
+ ok(compare_result, "Output type of last transform doesn't match sink node type.\n");
+
+ IMFTopologyNode_Release(mft_node);
+ IMFMediaType_Release(media_type);
+ IMFTransform_Release(transform);
+ }
+
+ IMFTopologyNode_Release(sink_node2);
+
+ hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL);
+ ok(hr == S_OK, "Failed to resolve topology, hr %#x.\n", hr);
+ ok(full_topology != topology2, "Unexpected instance.\n");
+
+ IMFTopology_Release(topology2);
+ IMFTopology_Release(full_topology);
+ }
+
+ hr = IMFTopology_GetCount(topology, &count);
+ ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
+ ok(count == 0, "Unexpected count %u.\n", count);
+
+ IMFActivate_ShutdownObject(sink_activate);
+ IMFActivate_Release(sink_activate);
+ IMFMediaType_Release(input_type);
+ IMFMediaType_Release(output_type);
+ }
- IMFMediaSource_Release(source);
- IMFSourceResolver_Release(resolver);
- IMFByteStream_Release(stream);
IMFTopoLoader_Release(loader);
hr = MFShutdown();
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc
deleted file mode 100644
index f54212a8c8f..00000000000
--- a/dlls/mf/tests/resource.rc
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2019 Nikolay Sivov for CodeWeavers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "windef.h"
-
-/* @makedep: test.wav */
-test.wav RCDATA test.wav
--
2.29.2
2
7
Nov. 27, 2020
Signed-off-by: Derek Lesho <dlesho(a)codeweavers.com>
---
v2: Restructure topology loader tests to reduce boilerplate.
---
dlls/mf/tests/Makefile.in | 2 -
dlls/mf/tests/mf.c | 603 +++++++++++++++++++++++++++++++-------
dlls/mf/tests/resource.rc | 22 --
dlls/mf/tests/test.mp3 | Bin 0 -> 2551 bytes
4 files changed, 501 insertions(+), 126 deletions(-)
delete mode 100644 dlls/mf/tests/resource.rc
create mode 100644 dlls/mf/tests/test.mp3
diff --git a/dlls/mf/tests/Makefile.in b/dlls/mf/tests/Makefile.in
index 5eb9ee4d4e3..614eb4fbc9e 100644
--- a/dlls/mf/tests/Makefile.in
+++ b/dlls/mf/tests/Makefile.in
@@ -3,5 +3,3 @@ IMPORTS = mf mfplat mfuuid ole32 user32
C_SRCS = \
mf.c
-
-RC_SRCS = resource.rc
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 41ca385cc2b..a5d971bf121 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -44,6 +44,7 @@ DEFINE_GUID(MFVideoFormat_ABGR32, 0x00000020, 0x0000, 0x0010, 0x80, 0x00, 0x00,
#include "mmdeviceapi.h"
#include "audioclient.h"
#include "evr.h"
+#include "propvarutil.h"
#include "wine/test.h"
@@ -97,34 +98,6 @@ static HWND create_window(void)
0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
}
-static WCHAR *load_resource(const WCHAR *name)
-{
- static WCHAR pathW[MAX_PATH];
- DWORD written;
- HANDLE file;
- HRSRC res;
- void *ptr;
-
- GetTempPathW(ARRAY_SIZE(pathW), pathW);
- lstrcatW(pathW, name);
-
- file = CreateFileW(pathW, GENERIC_READ|GENERIC_WRITE, 0,
- NULL, CREATE_ALWAYS, 0, 0);
- ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n",
- wine_dbgstr_w(pathW), GetLastError());
-
- res = FindResourceW(NULL, name, (LPCWSTR)RT_RCDATA);
- ok(res != 0, "couldn't find resource\n");
- ptr = LockResource(LoadResource(GetModuleHandleA(NULL), res));
- WriteFile(file, ptr, SizeofResource(GetModuleHandleA(NULL), res),
- &written, NULL);
- ok(written == SizeofResource(GetModuleHandleA(NULL), res),
- "couldn't write resource\n" );
- CloseHandle(file);
-
- return pathW;
-}
-
static HRESULT WINAPI test_unk_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IUnknown))
@@ -1447,26 +1420,316 @@ static const IMFSampleGrabberSinkCallbackVtbl test_grabber_callback_vtbl =
test_grabber_callback_OnShutdown,
};
+struct test_source
+{
+ IMFMediaSource IMFMediaSource_iface;
+ LONG refcount;
+};
+
+static struct test_source *impl_from_IMFMediaSource(IMFMediaSource *iface)
+{
+ return CONTAINING_RECORD(iface, struct test_source, IMFMediaSource_iface);
+}
+
+static HRESULT WINAPI test_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out)
+{
+ if (IsEqualIID(riid, &IID_IMFMediaSource)
+ || IsEqualIID(riid, &IID_IMFMediaEventGenerator)
+ || IsEqualIID(riid, &IID_IUnknown))
+ {
+ *out = iface;
+ }
+ else
+ {
+ *out = NULL;
+ return E_NOINTERFACE;
+ }
+
+ IMFMediaSource_AddRef(iface);
+ return S_OK;
+}
+
+static ULONG WINAPI test_source_AddRef(IMFMediaSource *iface)
+{
+ struct test_source *source = impl_from_IMFMediaSource(iface);
+ return InterlockedIncrement(&source->refcount);
+}
+
+static ULONG WINAPI test_source_Release(IMFMediaSource *iface)
+{
+ struct test_source *source = impl_from_IMFMediaSource(iface);
+ ULONG refcount = InterlockedDecrement(&source->refcount);
+
+ if (!refcount)
+ HeapFree(GetProcessHeap(), 0, source);
+
+ return refcount;
+}
+
+static HRESULT WINAPI test_source_GetEvent(IMFMediaSource *iface, DWORD flags, IMFMediaEvent **event)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_BeginGetEvent(IMFMediaSource *iface, IMFAsyncCallback *callback, IUnknown *state)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_EndGetEvent(IMFMediaSource *iface, IMFAsyncResult *result, IMFMediaEvent **event)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_QueueEvent(IMFMediaSource *iface, MediaEventType event_type, REFGUID ext_type,
+ HRESULT hr, const PROPVARIANT *value)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_GetCharacteristics(IMFMediaSource *iface, DWORD *flags)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_CreatePresentationDescriptor(IMFMediaSource *iface, IMFPresentationDescriptor **pd)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Start(IMFMediaSource *iface, IMFPresentationDescriptor *pd, const GUID *time_format,
+ const PROPVARIANT *start_position)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Stop(IMFMediaSource *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Pause(IMFMediaSource *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI test_source_Shutdown(IMFMediaSource *iface)
+{
+ ok(0, "Unexpected call.\n");
+ return E_NOTIMPL;
+}
+
+static const IMFMediaSourceVtbl test_source_vtbl =
+{
+ test_source_QueryInterface,
+ test_source_AddRef,
+ test_source_Release,
+ test_source_GetEvent,
+ test_source_BeginGetEvent,
+ test_source_EndGetEvent,
+ test_source_QueueEvent,
+ test_source_GetCharacteristics,
+ test_source_CreatePresentationDescriptor,
+ test_source_Start,
+ test_source_Stop,
+ test_source_Pause,
+ test_source_Shutdown,
+};
+
+static IMFMediaSource *create_test_source(void)
+{
+ struct test_source *source;
+
+ source = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*source));
+ source->IMFMediaSource_iface.lpVtbl = &test_source_vtbl;
+ source->refcount = 1;
+
+ return &source->IMFMediaSource_iface;
+}
+
static void test_topology_loader(void)
{
+ static const struct resolution_test
+ {
+ union
+ {
+ WAVEFORMATEX input_type;
+ MPEGLAYER3WAVEFORMAT mp3_input_type;
+ };
+ WAVEFORMATEX output_type;
+ MF_CONNECT_METHOD method;
+ HRESULT expected_result;
+ BOOL expect_decoder, expect_converter, wine_todo;
+ }
+ resolution_tests[] =
+ {
+ {
+ .input_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_DIRECT,
+ .expected_result = S_OK,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = FALSE,
+ },
+ {
+ .input_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 48000,
+ .nAvgBytesPerSec = 48000, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_DIRECT,
+ .expected_result = MF_E_INVALIDMEDIATYPE,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .input_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 48000,
+ .nAvgBytesPerSec = 48000, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_ALLOW_CONVERTER,
+ .expected_result = S_OK,
+ .expect_decoder = FALSE,
+ .expect_converter = TRUE,
+ .wine_todo = TRUE,
+ },
+ /* Test MF_TOPONODE_CONNECT_METHOD:
+ - 0x1 (MF_CONNECT_ALLOW_CONVERTER) allows converters
+ - 0x3 (MF_CONNECT_ALLOW_DECODER) allows converters and decoders
+ - 0x2 allows neither */
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_DIRECT,
+ .expected_result = MF_E_INVALIDMEDIATYPE,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_ALLOW_CONVERTER,
+ .expected_result = MF_E_TRANSFORM_NOT_POSSIBLE_FOR_CURRENT_MEDIATYPE_COMBINATION,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = 2,
+ .expected_result = MF_E_INVALIDMEDIATYPE,
+ .expect_decoder = FALSE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ {
+ .mp3_input_type = {
+ {
+ .wFormatTag = WAVE_FORMAT_MPEGLAYER3, .nChannels = 2, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 16000, .nBlockAlign = 1, .wBitsPerSample = 0, .cbSize = MPEGLAYER3_WFX_EXTRA_BYTES,
+ },
+ .wID = MPEGLAYER3_ID_MPEG,
+ .fdwFlags = 0,
+ .nBlockSize = 417,
+ .nFramesPerBlock = 0,
+ .nCodecDelay = 0,
+ },
+ .output_type = {
+ .wFormatTag = WAVE_FORMAT_PCM, .nChannels = 1, .nSamplesPerSec = 44100,
+ .nAvgBytesPerSec = 44100, .nBlockAlign = 1, .wBitsPerSample = 8, .cbSize = 0,
+ },
+ .method = MF_CONNECT_ALLOW_DECODER,
+ .expected_result = S_OK,
+ .expect_decoder = TRUE,
+ .expect_converter = FALSE,
+ .wine_todo = TRUE,
+ },
+ };
+
IMFSampleGrabberSinkCallback test_grabber_callback = { &test_grabber_callback_vtbl };
+ IMFTopologyNode *src_node, *sink_node, *src_node2, *sink_node2, *mft_node;
IMFTopology *topology, *topology2, *full_topology;
- IMFTopologyNode *src_node, *sink_node;
+ unsigned int count, value, index;
IMFPresentationDescriptor *pd;
- IMFSourceResolver *resolver;
IMFActivate *sink_activate;
IMFStreamSink *stream_sink;
- unsigned int count, value;
+ MF_TOPOLOGY_TYPE node_type;
IMFMediaType *media_type;
IMFStreamDescriptor *sd;
- MF_OBJECT_TYPE obj_type;
+ IMFTransform *transform;
IMFMediaSource *source;
IMFTopoLoader *loader;
- IMFByteStream *stream;
- IMFAttributes *attr;
+ IUnknown *node_object;
+ BOOL compare_result;
IMFMediaSink *sink;
- WCHAR *filename;
- BOOL selected;
+ WORD node_count;
+ unsigned int i;
+ TOPOID node_id;
HRESULT hr;
GUID guid;
@@ -1487,44 +1750,41 @@ static void test_topology_loader(void)
todo_wine
ok(hr == MF_E_TOPO_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
- hr = MFCreateSourceResolver(&resolver);
- ok(hr == S_OK, "Failed to create source resolver, hr %#x.\n", hr);
+ /* Add source node. */
+ hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node);
+ ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
- filename = load_resource(L"test.wav");
+ /* when a decoder is involved, windows requires this attribute to be present */
+ source = create_test_source();
- hr = MFCreateFile(MF_ACCESSMODE_READ, MF_OPENMODE_FAIL_IF_NOT_EXIST, MF_FILEFLAGS_NONE, filename, &stream);
- ok(hr == S_OK, "Failed to create file stream, hr %#x.\n", hr);
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_SOURCE, (IUnknown *)source);
+ ok(hr == S_OK, "Failed to set node source, hr %#x.\n", hr);
- IMFByteStream_QueryInterface(stream, &IID_IMFAttributes, (void **)&attr);
- IMFAttributes_SetString(attr, &MF_BYTESTREAM_CONTENT_TYPE, L"audio/wav");
- IMFAttributes_Release(attr);
+ IMFMediaSource_Release(source);
- hr = IMFSourceResolver_CreateObjectFromByteStream(resolver, stream, NULL, MF_RESOLUTION_MEDIASOURCE, NULL,
- &obj_type, (IUnknown **)&source);
- ok(hr == S_OK || broken(FAILED(hr)) /* Vista */, "Failed to create source, hr %#x.\n", hr);
- if (FAILED(hr))
- return;
+ hr = MFCreateMediaType(&media_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
- hr = IMFMediaSource_CreatePresentationDescriptor(source, &pd);
- ok(hr == S_OK, "Failed to create descriptor, hr %#x.\n", hr);
- if (FAILED(hr))
- return;
+ hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Audio);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
+ hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFAudioFormat_PCM);
+ ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
- hr = IMFPresentationDescriptor_GetStreamDescriptorByIndex(pd, 0, &selected, &sd);
- ok(hr == S_OK, "Failed to get stream descriptor, hr %#x.\n", hr);
+ hr = MFCreateStreamDescriptor(0, 1, &media_type, &sd);
+ ok(hr == S_OK, "Failed to create stream descriptor, hr %#x.\n");
- /* Add source node. */
- hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &src_node);
- ok(hr == S_OK, "Failed to create topology node, hr %#x.\n", hr);
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd);
+ ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
- hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_SOURCE, (IUnknown *)source);
- ok(hr == S_OK, "Failed to set node source, hr %#x.\n", hr);
+ hr = MFCreatePresentationDescriptor(1, &sd, &pd);
+ ok(hr == S_OK, "Failed to create presentation descriptor, hr %#x.\n");
hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_PRESENTATION_DESCRIPTOR, (IUnknown *)pd);
ok(hr == S_OK, "Failed to set node pd, hr %#x.\n", hr);
- hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd);
- ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
+ IMFPresentationDescriptor_Release(pd);
+ IMFStreamDescriptor_Release(sd);
+ IMFMediaType_Release(media_type);
hr = IMFTopology_AddNode(topology, src_node);
ok(hr == S_OK, "Failed to add a node, hr %#x.\n", hr);
@@ -1534,7 +1794,9 @@ todo_wine
todo_wine
ok(hr == MF_E_TOPO_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
- /* Add grabber sink. */
+ hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node);
+ ok(hr == S_OK, "Failed to create output node, hr %#x.\n", hr);
+
hr = MFCreateMediaType(&media_type);
ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
@@ -1546,13 +1808,11 @@ todo_wine
hr = MFCreateSampleGrabberSinkActivate(media_type, &test_grabber_callback, &sink_activate);
ok(hr == S_OK, "Failed to create grabber sink, hr %#x.\n", hr);
- IMFMediaType_Release(media_type);
-
- hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &sink_node);
- ok(hr == S_OK, "Failed to create output node, hr %#x.\n", hr);
-
hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)sink_activate);
ok(hr == S_OK, "Failed to set object, hr %#x.\n", hr);
+
+ IMFMediaType_Release(media_type);
+
hr = IMFTopology_AddNode(topology, sink_node);
ok(hr == S_OK, "Failed to add sink node, hr %#x.\n", hr);
@@ -1567,55 +1827,194 @@ todo_wine
hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
ok(hr == MF_E_TOPO_SINK_ACTIVATES_UNSUPPORTED, "Unexpected hr %#x.\n", hr);
- hr = IMFActivate_ActivateObject(sink_activate, &IID_IMFMediaSink, (void **)&sink);
- ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr);
+ for (i = 0; i < ARRAY_SIZE(resolution_tests); i++)
+ {
+ IMFMediaType *input_type, *output_type;
+ IMFMediaTypeHandler *mth;
- hr = IMFMediaSink_GetStreamSinkByIndex(sink, 0, &stream_sink);
- ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ /* TODO: remove once
+ 1) sample grabber IsMediaTypeSupported is fixed and
+ 2) MFInitMediaTypeFromWaveFormatEx gains support for non-zero cbSize */
+ if(resolution_tests[i].wine_todo && !strcmp(winetest_platform, "wine"))
+ {
+ todo_wine ok(0, "Skipping test %u on wine.\n", i);
+ continue;
+ }
- hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)stream_sink);
- ok(hr == S_OK, "Failed to set object, hr %#x.\n", hr);
+ hr = MFCreateMediaType(&input_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
- IMFStreamSink_Release(stream_sink);
+ hr = MFInitMediaTypeFromWaveFormatEx(input_type, &resolution_tests[i].input_type, sizeof(WAVEFORMATEX) + resolution_tests[i].input_type.cbSize);
+ ok(hr == S_OK, "MFInitMediaTypeFromWaveFormatEx failed, hr %#x.\n", hr);
- hr = IMFTopology_GetCount(topology, &count);
- ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
- ok(count == 0, "Unexpected count %u.\n", count);
+ hr = MFCreateMediaType(&output_type);
+ ok(hr == S_OK, "Failed to create media type, hr %#x.\n", hr);
- hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
- ok(hr == S_OK, "Failed to resolve topology, hr %#x.\n", hr);
- ok(full_topology != topology, "Unexpected instance.\n");
+ hr = MFInitMediaTypeFromWaveFormatEx(output_type, &resolution_tests[i].output_type, sizeof(WAVEFORMATEX) + resolution_tests[i].output_type.cbSize);
+ ok(hr == S_OK, "MFInitMediaTypeFromWaveFormatEx failed, hr %#x.\n", hr);
- hr = IMFTopology_GetCount(topology, &count);
- ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
- ok(count == 0, "Unexpected count %u.\n", count);
+ hr = MFCreateStreamDescriptor(0, 1, &input_type, &sd);
+ ok(hr == S_OK, "Failed to create stream descriptor, hr %#x.\n", hr);
- hr = IMFTopology_GetCount(full_topology, &count);
- ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
+ hr = IMFStreamDescriptor_GetMediaTypeHandler(sd, &mth);
+ ok(hr == S_OK, "Failed to get media type handler, hr %#x.\n", hr);
+
+ hr = IMFMediaTypeHandler_SetCurrentMediaType(mth, input_type);
+ ok(hr == S_OK, "Failed to set current media type, hr %#x.\n", hr);
+
+ IMFMediaTypeHandler_Release(mth);
+
+ hr = MFCreatePresentationDescriptor(1, &sd, &pd);
+ ok(hr == S_OK, "Failed to create presentation descriptor, hr %#x.\n", hr);
+
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_PRESENTATION_DESCRIPTOR, (IUnknown *)pd);
+ ok(hr == S_OK, "Failed to set node pd, hr %#x.\n", hr);
+
+ IMFPresentationDescriptor_Release(pd);
+
+ hr = IMFTopologyNode_SetUnknown(src_node, &MF_TOPONODE_STREAM_DESCRIPTOR, (IUnknown *)sd);
+ ok(hr == S_OK, "Failed to set node sd, hr %#x.\n", hr);
+
+ IMFStreamDescriptor_Release(sd);
+
+ hr = MFCreateSampleGrabberSinkActivate(output_type, &test_grabber_callback, &sink_activate);
+ ok(hr == S_OK, "Failed to create grabber sink, hr %#x.\n", hr);
+
+ hr = IMFActivate_ActivateObject(sink_activate, &IID_IMFMediaSink, (void **)&sink);
+ ok(hr == S_OK, "Failed to activate, hr %#x.\n", hr);
+
+ hr = IMFMediaSink_GetStreamSinkByIndex(sink, 0, &stream_sink);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+ IMFMediaSink_Release(sink);
+
+ hr = IMFTopologyNode_SetObject(sink_node, (IUnknown *)stream_sink);
+ ok(hr == S_OK, "Failed to set object, hr %#x.\n", hr);
+
+ IMFStreamSink_Release(stream_sink);
+
+ hr = IMFTopologyNode_SetUINT32(sink_node, &MF_TOPONODE_CONNECT_METHOD, resolution_tests[i].method);
+ ok(hr == S_OK, "Failed to set connect method, hr %#x.\n", hr);
+
+ hr = IMFTopology_GetCount(topology, &count);
+ ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
+ ok(count == 0, "Unexpected count %u.\n", count);
+
+ hr = IMFTopoLoader_Load(loader, topology, &full_topology, NULL);
+todo_wine_if(resolution_tests[i].wine_todo)
+ ok(hr == resolution_tests[i].expected_result, "Unexpected hr %#x on test %u.\n", hr, i);
+ ok(full_topology != topology, "Unexpected instance.\n");
+
+ if (resolution_tests[i].expected_result == S_OK && hr == S_OK)
+ {
+ hr = IMFTopology_GetCount(full_topology, &count);
+ ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
todo_wine
- ok(count == 1, "Unexpected count %u.\n", count);
+ ok(count == 1, "Unexpected count %u.\n", count);
- hr = IMFTopology_GetItemByIndex(full_topology, 0, &guid, NULL);
+ hr = IMFTopology_GetItemByIndex(full_topology, 0, &guid, NULL);
todo_wine {
- ok(hr == S_OK, "Failed to get attribute key, hr %#x.\n", hr);
- ok(IsEqualGUID(&guid, &MF_TOPOLOGY_RESOLUTION_STATUS), "Unexpected key %s.\n", wine_dbgstr_guid(&guid));
+ ok(hr == S_OK, "Failed to get attribute key, hr %#x.\n", hr);
+ ok(IsEqualGUID(&guid, &MF_TOPOLOGY_RESOLUTION_STATUS), "Unexpected key %s.\n", wine_dbgstr_guid(&guid));
}
- value = 0xdeadbeef;
- hr = IMFTopology_GetUINT32(full_topology, &MF_TOPOLOGY_RESOLUTION_STATUS, &value);
+ value = 0xdeadbeef;
+ hr = IMFTopology_GetUINT32(full_topology, &MF_TOPOLOGY_RESOLUTION_STATUS, &value);
todo_wine {
- ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
- ok(value == MF_TOPOLOGY_RESOLUTION_SUCCEEDED, "Unexpected value %#x.\n", value);
+ ok(hr == S_OK, "Failed to get attribute, hr %#x.\n", hr);
+ ok(value == MF_TOPOLOGY_RESOLUTION_SUCCEEDED, "Unexpected value %#x.\n", value);
}
- hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL);
- ok(hr == S_OK, "Failed to resolve topology, hr %#x.\n", hr);
- ok(full_topology != topology2, "Unexpected instance.\n");
- IMFTopology_Release(topology2);
- IMFTopology_Release(full_topology);
+ hr = IMFTopology_GetNodeCount(full_topology, &node_count);
+ ok(hr == S_OK, "Failed to get node count, hr %#x.\n", hr);
+ ok(node_count == 2 + resolution_tests[i].expect_decoder + resolution_tests[i].expect_converter, "Unexpected node count %u.\n", node_count);
+
+ hr = IMFTopologyNode_GetTopoNodeID(src_node, &node_id);
+ ok(hr == S_OK, "Failed to get source node id, hr %#x.\n", hr);
+
+ hr = IMFTopology_GetNodeByID(full_topology, node_id, &src_node2);
+ ok(hr == S_OK, "Failed to get source in resolved topology, hr %#x.\n", hr);
+
+ hr = IMFTopologyNode_GetTopoNodeID(sink_node, &node_id);
+ ok(hr == S_OK, "Failed to get sink node id, hr %#x.\n", hr);
+
+ hr = IMFTopology_GetNodeByID(full_topology, node_id, &sink_node2);
+ ok(hr == S_OK, "Failed to get sink in resolved topology, hr %#x.\n", hr);
+
+ if (resolution_tests[i].expect_decoder || resolution_tests[i].expect_converter)
+ {
+ hr = IMFTopologyNode_GetOutput(src_node2, 0, &mft_node, &index);
+ ok(hr == S_OK, "Failed to get transform node in resolved topology, hr %#x.\n", hr);
+ ok(index == 0, "Unexpected stream index %u.\n", index);
+
+ hr = IMFTopologyNode_GetNodeType(mft_node, &node_type);
+ ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#x.\n", hr);
+ ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u, expected MF_TOPOLOGY_TRANSFORM_NODE.\n", node_type);
+
+ hr = IMFTopologyNode_GetObject(mft_node, &node_object);
+ ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
+
+ hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void**) &transform);
+ ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr);
+ IUnknown_Release(node_object);
+
+ hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type);
+ ok(hr == S_OK, "Failed to get transform input type, hr %#x.\n", hr);
+
+ hr = IMFMediaType_Compare(media_type, (IMFAttributes *)input_type, MF_ATTRIBUTES_MATCH_ALL_ITEMS, &compare_result);
+ ok(hr == S_OK, "Failed to compare media types, hr %#x.\n", hr);
+ ok(compare_result, "Input type of first transform doesn't match source node type.\n");
+
+ IMFTopologyNode_Release(mft_node);
+ IMFMediaType_Release(media_type);
+ IMFTransform_Release(transform);
+
+ hr = IMFTopologyNode_GetInput(sink_node2, 0, &mft_node, &index);
+ ok(hr == S_OK, "Failed to get transform node in resolved topology, hr %#x.\n", hr);
+ ok(index == 0, "Unexpected stream index %u.\n", index);
+
+ hr = IMFTopologyNode_GetNodeType(mft_node, &node_type);
+ ok(hr == S_OK, "Failed to get transform node type in resolved topology, hr %#x.\n", hr);
+ ok(node_type == MF_TOPOLOGY_TRANSFORM_NODE, "Unexpected node type %u, expected MF_TOPOLOGY_TRANSFORM_NODE.\n", node_type);
+
+ hr = IMFTopologyNode_GetObject(mft_node, &node_object);
+ ok(hr == S_OK, "Failed to get object of transform node, hr %#x.\n", hr);
+
+ hr = IUnknown_QueryInterface(node_object, &IID_IMFTransform, (void**) &transform);
+ ok(hr == S_OK, "Failed to get IMFTransform from transform node's object, hr %#x.\n", hr);
+ IUnknown_Release(node_object);
+
+ hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type);
+ ok(hr == S_OK, "Failed to get transform output type, hr %#x.\n", hr);
+
+ hr = IMFMediaType_Compare(media_type, (IMFAttributes *)output_type, MF_ATTRIBUTES_MATCH_ALL_ITEMS, &compare_result);
+ ok(hr == S_OK, "Failed to compare media types, hr %#x.\n", hr);
+ ok(compare_result, "Output type of last transform doesn't match sink node type.\n");
+
+ IMFTopologyNode_Release(mft_node);
+ IMFMediaType_Release(media_type);
+ IMFTransform_Release(transform);
+ }
+
+ IMFTopologyNode_Release(sink_node2);
+
+ hr = IMFTopoLoader_Load(loader, full_topology, &topology2, NULL);
+ ok(hr == S_OK, "Failed to resolve topology, hr %#x.\n", hr);
+ ok(full_topology != topology2, "Unexpected instance.\n");
+
+ IMFTopology_Release(topology2);
+ IMFTopology_Release(full_topology);
+ }
+
+ hr = IMFTopology_GetCount(topology, &count);
+ ok(hr == S_OK, "Failed to get attribute count, hr %#x.\n", hr);
+ ok(count == 0, "Unexpected count %u.\n", count);
+
+ IMFActivate_ShutdownObject(sink_activate);
+ IMFActivate_Release(sink_activate);
+ IMFMediaType_Release(input_type);
+ IMFMediaType_Release(output_type);
+ }
- IMFMediaSource_Release(source);
- IMFSourceResolver_Release(resolver);
- IMFByteStream_Release(stream);
IMFTopoLoader_Release(loader);
hr = MFShutdown();
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc
deleted file mode 100644
index f54212a8c8f..00000000000
--- a/dlls/mf/tests/resource.rc
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2019 Nikolay Sivov for CodeWeavers
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "windef.h"
-
-/* @makedep: test.wav */
-test.wav RCDATA test.wav
diff --git a/dlls/mf/tests/test.mp3 b/dlls/mf/tests/test.mp3
new file mode 100644
index 0000000000000000000000000000000000000000..8b66f19da24624d58beda20187e1f6f85bdc4f44
GIT binary patch
literal 2551
zcmeH}iBr=_7RP@%xN!*g6(n*=fo4evhp=cE2!{lTLQq&?fRG>o0|Lr$SQ82N5s(nM
zWC(IB1mzSL&;bEqHrx)EAi4yQ(~%KHM3n50v8HOOhQDBIztz?6b-${v_xjUS{haMh
z;lRFhJ>1<1pp^pv7}5V4&CC*wGecucOn#4kokY7ie_9>vIx}ctU<5n{5CZ_Iet`T}
z{cwQz2Wa8|i4M?yCScAKFy|AP{ly>BgNc82rTT*$W-b5N{-3oVpg(a)oxQl6MZMS)cw
zLh%5I=H)`iok#mM<5=KiVux|Wx?l$|J@~kj0Fr@^e-k?s(G-;K)50E}ZH*@xN<#sr
zA1OgI(jluYWjvxG+yn&|Pk^L%J;o#8`Y@!n#D63{<{;n(a)py$cl$5WuSo13GEx?rW?
zn3Q7)H?aU*@2W+x>FGs=g<@zf0V<2cJCTggIH-rTMh`~8?pu~A{-zi{vMo75&C)I=
zbrk1;A59gMJ>2jTtljlpa?#DIn+WlhYhG7R7wCWQ)9Gf7PWjPr{b~w*)WP?4mF~#m
z2~T&-ZAOvn=kf~XM##0wx6eNq=qjw6Q(a)+%S`47MBD>@%nR8+vL9lSh~ye=}_t^3?N
z%b$HU6me=qlr}v)tkEYrv040KWBY<|WQV=|kEzWLQL$+1l<dZfPu#7+&OOn(wX)fF
z$cNb?;imzO>xlEBa?#?XBvY9$CFi}?ivYa3ZrCO(8fxA(kEPUP4dLbSe$E_A6C*9X
zoVPl#D7Li=4=WX9DP!Br$@C5n>@e3g5bfp$YQx^|gbp3O!UJI(Ld^jXrQ^-V*urW&
z2#5&)@H}h<T|2ekzt6nf_Fa+Syti(benFa!+jYA;h6QPT4}NVEGYYCz2^o&04Ze3s
zETO*XNU}R?R(t$((~#Tk*sSd1@^hi-0x{~ZRCL|+Swi#lS$eMeef#l$IXA9cE*q$k
z1|NZQs#k@&>#HR!6o5Ayh~Aw~#*kWt%=CLfOBW4R&H&D8e)#uKO0TrNvK?vti1iLI
zrdVK=O9070e#O$jst3w7Me~f9oS`)*S<6Km(mz)J+*p;X(-IJCaet^*tv=sOOirb~
znC{RRD7Rs(%lEXRx)o~Q^(rTMWGQv~J`?)>EpldP6ZLM~E3^BH?Z>7?-pybeuEN4}
z=i%NN6f6-iI6{?`{V7!f4sno7Tk?*t>djtK%m`Y}I8yxYqhsXGTPB)QH{^K+(@zCw
z|9-46MVQYKL(<}ZG*&NyNF(Wm51d*8zIm1tGwR-=zT_XcuJSF7KM?ae-O7j%o6wNN
z(a)hvOQ-%6e=yER=^z7vmd(<yCK%Ho>u6S84#DTfZ&wbD`hga81dOlUU#X0;lm^E)9o
z7sJvLNwZl$ZKQXy+&_ozCq>`3$?V=cmg4B71RF5;$@U9!immV)6Q>VfT&T-Qoz#QF
zlET;F8;HE_U-BSu4~56==W-EB?IeVKgWR(a)EUHG-d(OGAX?1&0<N>y$i>1mY)*O)ok
zagr|2+DhUOfv6VhQotn!ZdN8}^JSc>BLRbZz`KGtOpK3wKpK}qH+I!%(IzB*YdT}f
z(a)3CCvWK&kx5+iEFcrBMQXno4HibM4A;OzORcUc(;jz=X^NSet6yLlITqO?~WTgMXt
z$S(a)TV3V9zc5Go9z1>(Bu<hPnoG(y5)FVPF>9c7gs#{E>*bLX}6Ls^wZE(bdQ#xy(h
zqMLd~_(a)4Pa6P$$Ng}v)<^I~~Rs|k5Klr~a9Q_|Dqi^4Ci85LB_4Ti}=`C#$k`qH@;
zy4It;=F_Z|JTw8<FzhhfOqnKbC5&IHlr>%`T+(a)zu6LQm;xUgW-$?2`kuxAMdt0S_h
z@!`2$0CXIS+P0}8?Gy5ZZ7GHh=(f_q(a)98U{tIb&MBnSw=B`^Uv3VN)J1vKV0H*&kW
zqBAuiGPg=XJD5mluds0i;2Q+^G8Fnae(&&4%DA!*xS5FvZOP#N^x&#vLu#|A99wpz
z7Nol<m`%fvTDp(@qWRJjDW0l!q^2f&xmwKzbC?~?;TDZEBi*9}j1(Jgx;UpQ73GE-
z90~0Ed19X4PH7XzbH@(9*y?C}%8yOy)(FlDgexK<%xITMlk7-hu9+eLxLcCjBi(OR
zKWAW{5fl{dM`bb_rlo4a!*EqZkEqAVISP~@GPB3nQjiFPXkVQvu(a)fH@AS5kgwlD$H
zhI;D4b5~T=E1dYVIb7thD>_h`t)AHVRCVi1whgA${4=5bk<rD^_GN296E7xLRs-`Z
z<*hfyOI}w_ZQd(6jk4Bm_i^^qI6+e&M!d1=FP6Dqz!>pgYYe*@Z9!Y8J$Da%f||dM
z{(<_vFitBd--5I2M(gl-y}Y;i@>KR7*>pKZv^)7Qc6fD7bU9?#b^B=T&+IdkykJ7U
zXrB-RkbwG<_QLQWl0&G+U(a)I_p3htB0M1X`?AfZK7(K1uHh0N4}NyTB6$YJhIO#|e4
zpW&@msvz2bqMHZD4(ZUzdgtP|#XO~-IJO!!j3v6UNMyfy-PAVsJEU<9lG)C8R{GI<
c(xM&8<FQwKqOB{zbiZdgpqKdn)}L?Szh6E_`Tzg`
literal 0
HcmV?d00001
--
2.29.2
2
7
[PATCH v2] vbscript: remove no longer used bool call_statement_t.is_strict member variable.
by Robert Wilhelm Nov. 27, 2020
by Robert Wilhelm Nov. 27, 2020
Nov. 27, 2020
Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net>
---
This code was added with e56a5907a3b7794a4014114a844726b7377c2395 vbscript:
Added a hack for parameterized assignments with one argument.Â
but it is no longer used as of 509044296dde3688cfdaaf02325a1bc8f890bd85 vbscript: Fix
parsing call expressions.
---
dlls/vbscript/parse.h | 1 -
dlls/vbscript/parser.y | 9 ++++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h
index f5d8a616b9f..2888ea3b546 100644
--- a/dlls/vbscript/parse.h
+++ b/dlls/vbscript/parse.h
@@ -140,7 +140,6 @@ typedef struct _statement_t {
typedef struct {
statement_t stat;
call_expression_t *expr;
- BOOL is_strict;
} call_statement_t;
typedef struct {
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 034baffa4dd..37b14f05e14 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -46,7 +46,7 @@ static call_expression_t *new_call_expression(parser_ctx_t*,expression_t*,expres
static call_expression_t *make_call_expression(parser_ctx_t*,expression_t*,expression_t*);
static void *new_statement(parser_ctx_t*,statement_type_t,size_t,unsigned);
-static statement_t *new_call_statement(parser_ctx_t*,unsigned,BOOL,expression_t*);
+static statement_t *new_call_statement(parser_ctx_t*,unsigned,expression_t*);
static statement_t *new_assign_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t *new_set_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t *new_dim_statement(parser_ctx_t*,unsigned,dim_decl_t*);
@@ -200,8 +200,8 @@ Statement
SimpleStatement
: CallExpression ArgumentList_opt { call_expression_t *call_expr = make_call_expression(ctx, $1, $2); CHECK_ERROR;
- $$ = new_call_statement(ctx, @$, FALSE, &call_expr->expr); CHECK_ERROR; };
- | tCALL UnaryExpression { $$ = new_call_statement(ctx, @$, TRUE, $2); CHECK_ERROR; }
+ $$ = new_call_statement(ctx, @$, &call_expr->expr); CHECK_ERROR; };
+ | tCALL UnaryExpression { $$ = new_call_statement(ctx, @$, $2); CHECK_ERROR; }
| CallExpression '=' Expression
{ $$ = new_assign_statement(ctx, @$, $1, $3); CHECK_ERROR; }
| tDIM DimDeclList { $$ = new_dim_statement(ctx, @$, $2); CHECK_ERROR; }
@@ -734,7 +734,7 @@ static void *new_statement(parser_ctx_t *ctx, statement_type_t type, size_t size
return stat;
}
-static statement_t *new_call_statement(parser_ctx_t *ctx, unsigned loc, BOOL is_strict, expression_t *expr)
+static statement_t *new_call_statement(parser_ctx_t *ctx, unsigned loc, expression_t *expr)
{
call_expression_t *call_expr = NULL;
call_statement_t *stat;
@@ -758,7 +758,6 @@ static statement_t *new_call_statement(parser_ctx_t *ctx, unsigned loc, BOOL is_
return NULL;
stat->expr = call_expr;
- stat->is_strict = is_strict;
return &stat->stat;
}
--
2.28.0
2
1
[PATCH] vbscript: remove no longer used bool call_statement_t.is_strict member variable.
by Robert Wilhelm Nov. 27, 2020
by Robert Wilhelm Nov. 27, 2020
Nov. 27, 2020
Signed-off-by: Robert Wilhelm <robert.wilhelm(a)gmx.net>
---Â
This code was added with e56a5907a3b7794a4014114a844726b7377c2395
vbscript: Added a hack for parameterized assignments with one argument.
but it is no longer used as ofÂ
509044296dde3688cfdaaf02325a1bc8f890bd85
vbscript: Fix parsing call expressions.
---
dlls/vbscript/parse.h | 1 -
dlls/vbscript/parser.y | 9 ++++-----
dlls/vbscript/vbscript.c | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/vbscript/parse.h b/dlls/vbscript/parse.h
index f5d8a616b9f..2888ea3b546 100644
--- a/dlls/vbscript/parse.h
+++ b/dlls/vbscript/parse.h
@@ -140,7 +140,6 @@ typedef struct _statement_t {
typedef struct {
statement_t stat;
call_expression_t *expr;
- BOOL is_strict;
} call_statement_t;
typedef struct {
diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y
index 034baffa4dd..37b14f05e14 100644
--- a/dlls/vbscript/parser.y
+++ b/dlls/vbscript/parser.y
@@ -46,7 +46,7 @@ static call_expression_t
*new_call_expression(parser_ctx_t*,expression_t*,expres
static call_expression_t
*make_call_expression(parser_ctx_t*,expression_t*,expression_t*);
static void
*new_statement(parser_ctx_t*,statement_type_t,size_t,unsigned);
-static statement_t
*new_call_statement(parser_ctx_t*,unsigned,BOOL,expression_t*);
+static statement_t
*new_call_statement(parser_ctx_t*,unsigned,expression_t*);
static statement_t
*new_assign_statement(parser_ctx_t*,unsigned,expression_t*,expression_t
*);
static statement_t
*new_set_statement(parser_ctx_t*,unsigned,expression_t*,expression_t*);
static statement_t
*new_dim_statement(parser_ctx_t*,unsigned,dim_decl_t*);
@@ -200,8 +200,8 @@ Statement
SimpleStatement
: CallExpression ArgumentList_opt { call_expression_t
*call_expr = make_call_expression(ctx, $1, $2); CHECK_ERROR;
- $$ =
new_call_statement(ctx, @$, FALSE, &call_expr->expr); CHECK_ERROR; };
- | tCALL UnaryExpression { $$ =
new_call_statement(ctx, @$, TRUE, $2); CHECK_ERROR; }
+ $$ =
new_call_statement(ctx, @$, &call_expr->expr); CHECK_ERROR; };
+ | tCALL UnaryExpression { $$ =
new_call_statement(ctx, @$, $2); CHECK_ERROR; }
| CallExpression '=' Expression
{ $$ =
new_assign_statement(ctx, @$, $1, $3); CHECK_ERROR; }
| tDIM DimDeclList { $$ =
new_dim_statement(ctx, @$, $2); CHECK_ERROR; }
@@ -734,7 +734,7 @@ static void *new_statement(parser_ctx_t *ctx,
statement_type_t type, size_t size
return stat;
}
-static statement_t *new_call_statement(parser_ctx_t *ctx, unsigned
loc, BOOL is_strict, expression_t *expr)
+static statement_t *new_call_statement(parser_ctx_t *ctx, unsigned
loc, expression_t *expr)
{
call_expression_t *call_expr = NULL;
call_statement_t *stat;
@@ -758,7 +758,6 @@ static statement_t *new_call_statement(parser_ctx_t
*ctx, unsigned loc, BOOL is_
return NULL;
stat->expr = call_expr;
- stat->is_strict = is_strict;
return &stat->stat;
}
diff --git a/dlls/vbscript/vbscript.c b/dlls/vbscript/vbscript.c
index f31bdf2d351..4b57b4b2b93 100644
--- a/dlls/vbscript/vbscript.c
+++ b/dlls/vbscript/vbscript.c
@@ -739,7 +739,7 @@ static HRESULT WINAPI
VBScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTyp
DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
{
VBScript *This = impl_from_IActiveScript(iface);
- FIXME("(%p)->()\n", This);
+ FIXME("(%p)->(%s %d %d %d)\n", This, debugstr_guid(rguidTypeLib),
dwMajor, dwMinor, dwFlags);
return E_NOTIMPL;
}
--
2.28.0
2
1
[PATCH v3 1/3] winebuild: select all __wine_spec_exe* entry inside winebuild
by Kevin Puetz Nov. 27, 2020
by Kevin Puetz Nov. 27, 2020
Nov. 27, 2020
winegcc now overrides --entry only when it applies to any compiler
(e.g. kernel drivers or msvcrt) but leaves spec details to winebuild.
It therefore now forwards -municode so winebuild will know which to use.
Signed-off-by: Kevin Puetz <PuetzKevinA(a)JohnDeere.com>
---
tools/winebuild/build.h | 1 +
tools/winebuild/main.c | 9 +++++++--
tools/winegcc/winegcc.c | 4 ++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 03715af9563..26a0539c500 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -136,6 +136,7 @@ typedef struct
int subsystem; /* subsystem id */
int subsystem_major; /* subsystem version major number */
int subsystem_minor; /* subsystem version minor number */
+ int unicode_app; /* default to unicode entry point */
ORDDEF *entry_points; /* dll entry points */
ORDDEF **names; /* array of entry point names (points into entry_points) */
ORDDEF **ordinals; /* array of dll ordinals (points into entry_points) */
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 0e5e1627dda..b1e6d115717 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -396,8 +396,12 @@ static const char *get_default_entry_point( const DLLSPEC *spec )
{
if (spec->characteristics & IMAGE_FILE_DLL) return "DllMain";
if (spec->subsystem == IMAGE_SUBSYSTEM_NATIVE) return "DriverEntry";
- if (spec->type == SPEC_WIN16) return "__wine_spec_exe16_entry";
- return "__wine_spec_exe_entry";
+ if (spec->type == SPEC_WIN16)
+ return "__wine_spec_exe16_entry";
+ else if (spec->unicode_app)
+ return "__wine_spec_exe_wentry";
+ else
+ return "__wine_spec_exe_entry";
}
/* parse options from the argv array and remove all the recognized ones */
@@ -448,6 +452,7 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
else if (!strcmp( optarg, "thumb" )) thumb_mode = 1;
else if (!strcmp( optarg, "no-cygwin" )) use_msvcrt = 1;
else if (!strcmp( optarg, "unix" )) unix_lib = 1;
+ else if (!strcmp( optarg, "unicode" )) spec->unicode_app = 1;
else if (!strncmp( optarg, "cpu=", 4 )) cpu_option = xstrdup( optarg + 4 );
else if (!strncmp( optarg, "fpu=", 4 )) fpu_option = xstrdup( optarg + 4 );
else if (!strncmp( optarg, "arch=", 5 )) arch_option = xstrdup( optarg + 5 );
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 9268a5dfd1d..cef0832455c 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1245,8 +1245,6 @@ static void build(struct options* opts)
entry_point = (is_pe && opts->target_cpu == CPU_x86) ? "DriverEntry(a)8" : "DriverEntry";
else if (opts->use_msvcrt && !opts->shared && !opts->win16_app)
entry_point = opts->unicode_app ? "wmainCRTStartup" : "mainCRTStartup";
- else if (!is_pe && !opts->shared && opts->unicode_app)
- entry_point = "__wine_spec_exe_wentry";
}
else entry_point = opts->entry_point;
@@ -1258,6 +1256,8 @@ static void build(struct options* opts)
spec_o_name = get_temp_file(output_name, ".spec.o");
if (opts->force_pointer_size)
strarray_add(spec_args, strmake("-m%u", 8 * opts->force_pointer_size ));
+ if(opts->unicode_app)
+ strarray_add(spec_args, "-municode");
strarray_add(spec_args, "-D_REENTRANT");
if (opts->pic && !is_pe) strarray_add(spec_args, "-fPIC");
strarray_add(spec_args, opts->shared ? "--dll" : "--exe");
--
2.29.2
2
5