Wine-devel
Threads by month
- ----- 2026 -----
- 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
October 2020
- 82 participants
- 799 discussions
Signed-off-by: Vijay Kiran Kamuju <infyquest(a)gmail.com>
2
1
29 Oct '20
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50075
Signed-off-by: Arkadiusz Hiler <ahiler(a)codeweavers.com>
---
dlls/kernelbase/version.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/kernelbase/version.c b/dlls/kernelbase/version.c
index 58c49aa148b..cb6c57d7617 100644
--- a/dlls/kernelbase/version.c
+++ b/dlls/kernelbase/version.c
@@ -240,7 +240,8 @@ done:
* Copied from loader/pe_resource.c
*/
static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DIRECTORY *dir,
- WORD id, const void *root )
+ WORD id, const void *root,
+ const void *end )
{
const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
int min, max, pos;
@@ -251,6 +252,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI
while (min <= max)
{
pos = (min + max) / 2;
+ if ((void*)&entry[pos] >= end || &entry[pos] < entry) return NULL;
if (entry[pos].u.Id == id)
return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory);
if (entry[pos].u.Id > id) max = pos - 1;
@@ -294,7 +296,8 @@ static inline int push_language( WORD *list, int pos, WORD lang )
* find_entry_language
*/
static const IMAGE_RESOURCE_DIRECTORY *find_entry_language( const IMAGE_RESOURCE_DIRECTORY *dir,
- const void *root, DWORD flags )
+ const void *root, const void *end,
+ DWORD flags )
{
const IMAGE_RESOURCE_DIRECTORY *ret;
WORD list[9];
@@ -319,7 +322,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_language( const IMAGE_RESOURCE
pos = push_language( list, pos, MAKELANGID( LANG_ENGLISH, SUBLANG_DEFAULT ) );
}
- for (i = 0; i < pos; i++) if ((ret = find_entry_by_id( dir, list[i], root ))) return ret;
+ for (i = 0; i < pos; i++) if ((ret = find_entry_by_id( dir, list[i], root, end ))) return ret;
return find_entry_default( dir, root );
}
@@ -488,19 +491,19 @@ static BOOL find_pe_resource( HANDLE handle, DWORD *resLen, DWORD *resOff, DWORD
resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress);
resPtr = resDir;
- resPtr = find_entry_by_id( resPtr, VS_FILE_INFO, resDir );
+ resPtr = find_entry_by_id( resPtr, VS_FILE_INFO, resDir, resSection + section_size );
if ( !resPtr )
{
TRACE("No typeid entry found\n" );
goto done;
}
- resPtr = find_entry_by_id( resPtr, VS_VERSION_INFO, resDir );
+ resPtr = find_entry_by_id( resPtr, VS_VERSION_INFO, resDir, resSection + section_size );
if ( !resPtr )
{
TRACE("No resid entry found\n" );
goto done;
}
- resPtr = find_entry_language( resPtr, resDir, flags );
+ resPtr = find_entry_language( resPtr, resDir, resSection + section_size, flags );
if ( !resPtr )
{
TRACE("No default language entry found\n" );
--
2.29.1
1
0
29 Oct '20
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wbemprox/tests/query.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 7ba55dffdfb..191b9f6c85a 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1745,10 +1745,13 @@ static void test_Win32_SoundDevice( IWbemServices *services )
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
+ check_property( obj, L"DeviceID", VT_BSTR, CIM_STRING );
+ check_property( obj, L"Manufacturer", VT_BSTR, CIM_STRING );
check_property( obj, L"Name", VT_BSTR, CIM_STRING );
+ check_property( obj, L"PNPDeviceID", VT_BSTR, CIM_STRING );
check_property( obj, L"ProductName", VT_BSTR, CIM_STRING );
+ check_property( obj, L"Status", VT_BSTR, CIM_STRING );
check_property( obj, L"StatusInfo", VT_I4, CIM_UINT16 );
- check_property( obj, L"Manufacturer", VT_BSTR, CIM_STRING );
IWbemClassObject_Release( obj );
}
--
2.28.0
1
0
[PATCH v2 1/2] wbemprox: Implement Win32_SoundDevice.{DeviceID, PNPDeviceID}.
by Hans Leidekker 29 Oct '20
by Hans Leidekker 29 Oct '20
29 Oct '20
From: Pengpeng Dong <dongpengpeng(a)uniontech.com>
v2: Factor out get_dxgi_adapter_desc. Keep properties sorted.
Signed-off-by: Pengpeng Dong <dongpengpeng(a)uniontech.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/wbemprox/builtin.c | 95 ++++++++++++++++++++++++++++++-----------
1 file changed, 71 insertions(+), 24 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index e35aa069e1d..be22d8d3066 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -376,8 +376,10 @@ static const struct column col_sid[] =
};
static const struct column col_sounddevice[] =
{
+ { L"DeviceID", CIM_STRING },
{ L"Manufacturer", CIM_STRING },
{ L"Name", CIM_STRING },
+ { L"PNPDeviceID", CIM_STRING },
{ L"ProductName", CIM_STRING },
{ L"Status", CIM_STRING },
{ L"StatusInfo", CIM_UINT16 },
@@ -766,8 +768,10 @@ struct record_sid
};
struct record_sounddevice
{
+ const WCHAR *deviceid;
const WCHAR *manufacturer;
const WCHAR *name;
+ const WCHAR *pnpdeviceid;
const WCHAR *productname;
const WCHAR *status;
UINT16 statusinfo;
@@ -886,10 +890,7 @@ static const struct record_quickfixengineering data_quickfixengineering[] =
{
{ L"http://winehq.org", L"KB1234567" },
};
-static const struct record_sounddevice data_sounddevice[] =
-{
- { L"The Wine Project", L"Wine Audio Device", L"Wine Audio Device", L"OK", 3 /* enabled */ }
-};
+
static const struct record_stdregprov data_stdregprov[] =
{
{ reg_create_key, reg_enum_key, reg_enum_values, reg_get_stringvalue }
@@ -3830,7 +3831,7 @@ static enum fill_status fill_systemenclosure( struct table *table, const struct
return status;
}
-static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
+static WCHAR *get_videocontroller_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
{
static const WCHAR fmtW[] = L"PCI\\VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%02X\\0&DEADBEEF&0&DEAD";
UINT len = sizeof(fmtW) + 2;
@@ -3846,7 +3847,7 @@ static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
#define HW_VENDOR_VMWARE 0x15ad
#define HW_VENDOR_INTEL 0x8086
-static const WCHAR *get_installeddriver( UINT vendorid )
+static const WCHAR *get_videocontroller_installeddriver( UINT vendorid )
{
/* FIXME: wined3d has a better table, but we cannot access this information through dxgi */
@@ -3856,12 +3857,32 @@ static const WCHAR *get_installeddriver( UINT vendorid )
return L"wine.dll";
}
+static BOOL get_dxgi_adapter_desc( DXGI_ADAPTER_DESC *desc )
+{
+ IDXGIFactory *factory;
+ IDXGIAdapter *adapter;
+ HRESULT hr;
+
+ memset( desc, 0, sizeof(*desc) );
+ hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
+ if (FAILED( hr )) return FALSE;
+
+ hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
+ if (FAILED( hr ))
+ {
+ IDXGIFactory_Release( factory );
+ return FALSE;
+ }
+
+ hr = IDXGIAdapter_GetDesc( adapter, desc );
+ IDXGIAdapter_Release( adapter );
+ IDXGIFactory_Release( factory );
+ return SUCCEEDED( hr );
+}
+
static enum fill_status fill_videocontroller( struct table *table, const struct expr *cond )
{
struct record_videocontroller *rec;
- HRESULT hr;
- IDXGIFactory *factory = NULL;
- IDXGIAdapter *adapter = NULL;
DXGI_ADAPTER_DESC desc;
UINT row = 0, hres = 1024, vres = 768, vidmem = 512 * 1024 * 1024;
const WCHAR *name = L"VideoController1";
@@ -3870,22 +3891,13 @@ static enum fill_status fill_videocontroller( struct table *table, const struct
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
- memset (&desc, 0, sizeof(desc));
- hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
- if (FAILED(hr)) goto done;
-
- hr = IDXGIFactory_EnumAdapters( factory, 0, &adapter );
- if (FAILED(hr)) goto done;
-
- hr = IDXGIAdapter_GetDesc( adapter, &desc );
- if (SUCCEEDED(hr))
+ if (get_dxgi_adapter_desc( &desc ))
{
if (desc.DedicatedVideoMemory > UINT_MAX) vidmem = 0xfff00000;
else vidmem = desc.DedicatedVideoMemory;
name = desc.Description;
}
-done:
rec = (struct record_videocontroller *)table->data;
rec->adapter_compatibility = L"(Standard display types)";
rec->adapter_dactype = L"Integrated RAMDAC";
@@ -3902,9 +3914,9 @@ done:
rec->device_id = L"VideoController1";
rec->driverdate = L"20170101000000.000000+000";
rec->driverversion = L"1.0";
- rec->installeddriver = get_installeddriver( desc.VendorId );
+ rec->installeddriver = get_videocontroller_installeddriver( desc.VendorId );
rec->name = heap_strdupW( name );
- rec->pnpdevice_id = get_pnpdeviceid( &desc );
+ rec->pnpdevice_id = get_videocontroller_pnpdeviceid( &desc );
rec->status = L"OK";
rec->videoarchitecture = 2; /* Unknown */
rec->videomemorytype = 2; /* Unknown */
@@ -3916,9 +3928,44 @@ done:
TRACE("created %u rows\n", row);
table->num_rows = row;
+ return status;
+}
- if (adapter) IDXGIAdapter_Release( adapter );
- if (factory) IDXGIFactory_Release( factory );
+static WCHAR *get_sounddevice_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
+{
+ static const WCHAR fmtW[] = L"HDAUDIO\\FUNC_01&VEN_%04X&DEV_%04X&SUBSYS_%08X&REV_%04X\\0&DEADBEEF&0&DEAD";
+ UINT len = sizeof(fmtW) + 2;
+ WCHAR *ret;
+
+ if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
+ swprintf( ret, len, fmtW, desc->VendorId, desc->DeviceId, desc->SubSysId, desc->Revision );
+ return ret;
+}
+
+static enum fill_status fill_sounddevice( struct table *table, const struct expr *cond )
+{
+ struct record_sounddevice *rec;
+ DXGI_ADAPTER_DESC desc;
+ UINT row = 0;
+ enum fill_status status = FILL_STATUS_UNFILTERED;
+
+ if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
+
+ get_dxgi_adapter_desc( &desc );
+
+ rec = (struct record_sounddevice *)table->data;
+ rec->deviceid = get_sounddevice_pnpdeviceid( &desc );
+ rec->manufacturer = L"The Wine Project";
+ rec->name = L"Wine Audio Device";
+ rec->pnpdeviceid = get_sounddevice_pnpdeviceid( &desc );
+ rec->productname = L"Wine Audio Device";
+ rec->status = L"OK";
+ rec->statusinfo = 3;
+ if (!match_row( table, row, cond, &status )) free_row_values( table, row );
+ else row++;
+
+ TRACE("created %u rows\n", row);
+ table->num_rows = row;
return status;
}
@@ -3960,7 +4007,7 @@ static struct table builtin_classes[] =
{ L"Win32_QuickFixEngineering", C(col_quickfixengineering), D(data_quickfixengineering) },
{ L"Win32_SID", C(col_sid), 0, 0, NULL, fill_sid },
{ L"Win32_Service", C(col_service), 0, 0, NULL, fill_service },
- { L"Win32_SoundDevice", C(col_sounddevice), D(data_sounddevice) },
+ { L"Win32_SoundDevice", C(col_sounddevice), 0, 0, NULL, fill_sounddevice },
{ L"Win32_SystemEnclosure", C(col_systemenclosure), 0, 0, NULL, fill_systemenclosure },
{ L"Win32_VideoController", C(col_videocontroller), 0, 0, NULL, fill_videocontroller },
{ L"Win32_WinSAT", C(col_winsat), D(data_winsat) },
--
2.28.0
1
0
29 Oct '20
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.c | 3 --
dlls/riched20/editor.h | 1 -
dlls/riched20/table.c | 89 ------------------------------------------
dlls/riched20/undo.c | 2 -
4 files changed, 95 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 797eb27b6b9..d1667dc9176 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1735,7 +1735,6 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
if (parser.tableDef) parser.tableDef->row_start = NULL;
}
}
- ME_CheckTablesForCorruption(editor);
RTFDestroy(&parser);
if (parser.stackTop > 0)
@@ -2515,7 +2514,6 @@ static BOOL handle_enter(ME_TextEditor *editor)
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
ME_CommitUndo(editor);
- ME_CheckTablesForCorruption(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
@@ -2541,7 +2539,6 @@ static BOOL handle_enter(ME_TextEditor *editor)
editor->pCursors[1] = editor->pCursors[0];
para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART;
ME_CommitCoalescingUndo(editor);
- ME_CheckTablesForCorruption(editor);
ME_UpdateRepaint(editor, FALSE);
return TRUE;
}
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index b8916bc4ff3..5f93aa39db9 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -309,7 +309,6 @@ ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
-void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN;
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN;
static inline ME_DisplayItem *cell_get_di(ME_Cell *cell)
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index c262d190b79..e08876d29bd 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -54,8 +54,6 @@
#include "editor.h"
#include "rtf.h"
-WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
-
static const WCHAR cr_lf[] = {'\r', '\n', 0};
static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cursor,
@@ -214,93 +212,6 @@ ME_Paragraph *cell_end_para( ME_Cell *cell )
return &ME_FindItemBack( cell_get_di( next ), diParagraph )->member.para;
}
-/* Make a bunch of assertions to make sure tables haven't been corrupted.
- *
- * These invariants may not hold true in the middle of streaming in rich text
- * or during an undo and redo of streaming in rich text. It should be safe to
- * call this method after an event is processed.
- */
-void ME_CheckTablesForCorruption(ME_TextEditor *editor)
-{
- if(TRACE_ON(richedit_lists))
- {
- TRACE("---\n");
- ME_DumpDocument(editor->pBuffer);
- }
-#ifndef NDEBUG
- {
- ME_DisplayItem *p, *pPrev;
- pPrev = editor->pBuffer->pFirst;
- p = pPrev->next;
- if (!editor->bEmulateVersion10) /* v4.1 */
- {
- while (p->type == diParagraph)
- {
- assert(p->member.para.fmt.dwMask & PFM_TABLE);
- assert(p->member.para.fmt.dwMask & PFM_TABLEROWDELIMITER);
- if (p->member.para.pCell)
- {
- assert(p->member.para.nFlags & MEPF_CELL);
- assert(p->member.para.fmt.wEffects & PFE_TABLE);
- }
- if (p->member.para.pCell != pPrev->member.para.pCell)
- {
- /* There must be a diCell in between the paragraphs if pCell changes. */
- ME_DisplayItem *pCell = ME_FindItemBack(p, diCell);
- assert(pCell);
- assert(ME_FindItemBack(p, diRun) == ME_FindItemBack(pCell, diRun));
- }
- if (p->member.para.nFlags & MEPF_ROWEND)
- {
- /* ROWEND must come after a cell. */
- assert(pPrev->member.para.pCell);
- assert(p->member.para.pCell
- == pPrev->member.para.pCell->member.cell.parent_cell);
- assert(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER);
- }
- else if (p->member.para.pCell)
- {
- assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
- assert(pPrev->member.para.pCell ||
- pPrev->member.para.nFlags & MEPF_ROWSTART);
- if (pPrev->member.para.pCell &&
- !(pPrev->member.para.nFlags & MEPF_ROWSTART))
- {
- assert(p->member.para.pCell->member.cell.parent_cell
- == pPrev->member.para.pCell->member.cell.parent_cell);
- if (pPrev->member.para.pCell != p->member.para.pCell)
- assert(pPrev->member.para.pCell
- == p->member.para.pCell->member.cell.prev_cell);
- }
- }
- else if (!(p->member.para.nFlags & MEPF_ROWSTART))
- {
- assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
- /* ROWSTART must be followed by a cell. */
- assert(!(p->member.para.nFlags & MEPF_CELL));
- /* ROWSTART must be followed by a cell. */
- assert(!(pPrev->member.para.nFlags & MEPF_ROWSTART));
- }
- pPrev = p;
- p = p->member.para.next_para;
- }
- } else { /* v1.0 - 3.0 */
- while (p->type == diParagraph)
- {
- assert(!(p->member.para.nFlags & (MEPF_ROWSTART|MEPF_ROWEND|MEPF_CELL)));
- assert(p->member.para.fmt.dwMask & PFM_TABLE);
- assert(!(p->member.para.fmt.wEffects & PFE_TABLEROWDELIMITER));
- assert(!p->member.para.pCell);
- p = p->member.para.next_para;
- }
- return;
- }
- assert(p->type == diTextEnd);
- assert(!pPrev->member.para.pCell);
- }
-#endif
-}
-
BOOL ME_IsInTable(ME_DisplayItem *pItem)
{
PARAFORMAT2 *pFmt;
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index fe0a4f721cd..884f87b56fd 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -440,7 +440,6 @@ BOOL ME_Undo(ME_TextEditor *editor)
table_move_from_row_start( editor );
add_undo( editor, undo_end_transaction );
- ME_CheckTablesForCorruption(editor);
editor->nUndoStackSize--;
editor->nUndoMode = nMode;
ME_UpdateRepaint(editor, FALSE);
@@ -477,7 +476,6 @@ BOOL ME_Redo(ME_TextEditor *editor)
}
table_move_from_row_start( editor );
add_undo( editor, undo_end_transaction );
- ME_CheckTablesForCorruption(editor);
editor->nUndoMode = nMode;
ME_UpdateRepaint(editor, FALSE);
return TRUE;
--
2.23.0
1
0
[PATCH 4/5] riched20: Use paragraph ptrs in the table move from row start function.
by Huw Davies 29 Oct '20
by Huw Davies 29 Oct '20
29 Oct '20
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.c | 2 +-
dlls/riched20/editor.h | 2 +-
dlls/riched20/table.c | 15 ++++++++-------
dlls/riched20/undo.c | 4 ++--
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 7687ec9d93e..797eb27b6b9 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2690,7 +2690,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
}
else
return TRUE;
- ME_MoveCursorFromTableRowStartParagraph(editor);
+ table_move_from_row_start( editor );
ME_UpdateSelectionLinkAttribute(editor);
ME_UpdateRepaint(editor, FALSE);
ME_SendRequestResize(editor, FALSE);
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index a49883c9861..b8916bc4ff3 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -302,6 +302,7 @@ ME_Paragraph *table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor ) DECL
ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
+void table_move_from_row_start( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;
void table_protect_partial_deletion( ME_TextEditor *editor, ME_Cursor *c, int *num_chars ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
@@ -309,7 +310,6 @@ ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN;
-void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN;
static inline ME_DisplayItem *cell_get_di(ME_Cell *cell)
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index 25c4e1820ce..c262d190b79 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -629,16 +629,17 @@ void table_handle_tab( ME_TextEditor *editor, BOOL selected_row )
/* Make sure the cursor is not in the hidden table row start paragraph
* without a selection. */
-void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor)
+void table_move_from_row_start( ME_TextEditor *editor )
{
- ME_DisplayItem *para = editor->pCursors[0].pPara;
- if (para == editor->pCursors[1].pPara &&
- para->member.para.nFlags & MEPF_ROWSTART) {
+ ME_Paragraph *para = &editor->pCursors[0].pPara->member.para;
+
+ if (para == &editor->pCursors[1].pPara->member.para && para->nFlags & MEPF_ROWSTART)
+ {
/* The cursors should not be at the hidden start row paragraph without
* a selection, so the cursor is moved into the first cell. */
- para = para->member.para.next_para;
- editor->pCursors[0].pPara = para;
- editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun);
+ para = para_next( para );
+ editor->pCursors[0].pPara = para_get_di( para );
+ editor->pCursors[0].pRun = run_get_di( para_first_run( para ) );
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
}
diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c
index d9c5d28d6dc..fe0a4f721cd 100644
--- a/dlls/riched20/undo.c
+++ b/dlls/riched20/undo.c
@@ -438,7 +438,7 @@ BOOL ME_Undo(ME_TextEditor *editor)
destroy_undo_item( undo );
}
- ME_MoveCursorFromTableRowStartParagraph(editor);
+ table_move_from_row_start( editor );
add_undo( editor, undo_end_transaction );
ME_CheckTablesForCorruption(editor);
editor->nUndoStackSize--;
@@ -475,7 +475,7 @@ BOOL ME_Redo(ME_TextEditor *editor)
list_remove( &undo->entry );
destroy_undo_item( undo );
}
- ME_MoveCursorFromTableRowStartParagraph(editor);
+ table_move_from_row_start( editor );
add_undo( editor, undo_end_transaction );
ME_CheckTablesForCorruption(editor);
editor->nUndoMode = nMode;
--
2.23.0
1
0
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/editor.c | 6 +--
dlls/riched20/editor.h | 2 +-
dlls/riched20/table.c | 104 +++++++++++++++++++----------------------
3 files changed, 52 insertions(+), 60 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index d06693232ab..7687ec9d93e 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -2799,7 +2799,7 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
!(ctrl_is_down && !editor->bEmulateVersion10))
{
ME_DisplayItem *para;
- BOOL bSelectedRow = FALSE;
+ BOOL selected_row = FALSE;
para = cursor.pPara;
if (ME_IsSelection(editor) &&
@@ -2808,11 +2808,11 @@ static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode,
para->member.para.prev_para->type == diParagraph)
{
para = para->member.para.prev_para;
- bSelectedRow = TRUE;
+ selected_row = TRUE;
}
if (ME_IsInTable(para))
{
- ME_TabPressedInTable(editor, bSelectedRow);
+ table_handle_tab( editor, selected_row );
ME_CommitUndo(editor);
return 0;
}
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 6e1c639236e..a49883c9861 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -297,6 +297,7 @@ ME_Paragraph *cell_first_para( ME_Cell *cell ) DECLSPEC_HIDDEN;
ME_Cell *cell_next( ME_Cell *cell ) DECLSPEC_HIDDEN;
ME_Cell *cell_prev( ME_Cell *cell ) DECLSPEC_HIDDEN;
ME_Paragraph *table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row ) DECLSPEC_HIDDEN;
+void table_handle_tab( ME_TextEditor *editor, BOOL selected_row ) DECLSPEC_HIDDEN;
ME_Paragraph *table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
@@ -308,7 +309,6 @@ ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN;
-void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow) DECLSPEC_HIDDEN;
void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index cc2ebb8ed50..25c4e1820ce 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -481,30 +481,27 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row )
}
/* Selects the next table cell or appends a new table row if at end of table */
-static void ME_SelectOrInsertNextCell( ME_TextEditor *editor, ME_DisplayItem *run )
+static void table_select_next_cell_or_append( ME_TextEditor *editor, ME_Run *run )
{
- ME_Paragraph *para = run->member.run.para;
+ ME_Paragraph *para = run->para;
+ ME_Cell *cell;
int i;
- assert(run && run->type == diRun);
- assert(ME_IsInTable(run));
+ assert( para_in_table( para ) );
if (!editor->bEmulateVersion10) /* v4.1 */
{
- ME_DisplayItem *cell;
/* Get the initial cell */
- if (para->nFlags & MEPF_ROWSTART) cell = para_next( para )->pCell;
- else if (para->nFlags & MEPF_ROWEND) cell = para_prev( para )->pCell;
- else cell = para->pCell;
- assert(cell);
+ if (para->nFlags & MEPF_ROWSTART) cell = para_cell( para_next( para ) );
+ else if (para->nFlags & MEPF_ROWEND) cell = para_cell( para_prev( para ) );
+ else cell = para_cell( para );
/* Get the next cell. */
- if (cell->member.cell.next_cell &&
- cell->member.cell.next_cell->member.cell.next_cell)
+ if (cell_next( cell ) && cell_next( cell_next( cell ) ))
+ cell = cell_next( cell );
+ else
{
- cell = cell->member.cell.next_cell;
- } else {
- para = para_next( table_row_end( &ME_FindItemFwd( cell, diParagraph )->member.para ) );
- if (para->nFlags & MEPF_ROWSTART) cell = para_next( para )->pCell;
+ para = para_next( table_row_end( para ) );
+ if (para->nFlags & MEPF_ROWSTART) cell = para_cell( para_next( para ) );
else
{
/* Insert row */
@@ -521,38 +518,32 @@ static void ME_SelectOrInsertNextCell( ME_TextEditor *editor, ME_DisplayItem *ru
}
}
/* Select cell */
- editor->pCursors[1].pRun = ME_FindItemFwd(cell, diRun);
- editor->pCursors[1].pPara = ME_GetParagraph(editor->pCursors[1].pRun);
+ editor->pCursors[1].pPara = para_get_di( cell_first_para( cell ) );
+ editor->pCursors[1].pRun = run_get_di( para_first_run( &editor->pCursors[1].pPara->member.para ) );
editor->pCursors[1].nOffset = 0;
- assert(editor->pCursors[0].pRun);
- cell = cell->member.cell.next_cell;
- editor->pCursors[0].pRun = ME_FindItemBack(cell, diRun);
- editor->pCursors[0].pPara = ME_GetParagraph(editor->pCursors[0].pRun);
+ editor->pCursors[0].pPara = para_get_di( cell_end_para( cell ) );
+ editor->pCursors[0].pRun = run_get_di( para_end_run( &editor->pCursors[0].pPara->member.para ) );
editor->pCursors[0].nOffset = 0;
- assert(editor->pCursors[1].pRun);
}
else /* v1.0 - 3.0 */
{
- if (run->member.run.nFlags & MERF_ENDPARA &&
- ME_IsInTable(ME_FindItemFwd(run, diParagraphOrEnd)))
+ if (run->nFlags & MERF_ENDPARA && para_in_table( para_next( para ) ))
{
- run = ME_FindItemFwd(run, diRun);
+ run = run_next_all_paras( run );
assert(run);
}
for (i = 0; i < 2; i++)
{
- while (!(run->member.run.nFlags & MERF_TAB))
+ while (!(run->nFlags & MERF_TAB))
{
- run = ME_FindItemFwd(run, diRunOrParagraphOrEnd);
- if (run->type != diRun)
+ if (!run_next( run ))
{
- para = &run->member.para;
+ para = para_next( run->para );
if (para_in_table( para ))
{
- run = run_get_di( para_first_run( para ) );
- assert(run);
+ run = para_first_run( para );
editor->pCursors[0].pPara = para_get_di( para );
- editor->pCursors[0].pRun = run;
+ editor->pCursors[0].pRun = run_get_di( run );
editor->pCursors[0].nOffset = 0;
i = 1;
}
@@ -569,18 +560,18 @@ static void ME_SelectOrInsertNextCell( ME_TextEditor *editor, ME_DisplayItem *ru
return;
}
}
+ else run = run_next( run );
}
- if (i == 0)
- run = ME_FindItemFwd(run, diRun);
- editor->pCursors[i].pRun = run;
- editor->pCursors[i].pPara = ME_GetParagraph(run);
+ if (i == 0) run = run_next_all_paras( run );
+ editor->pCursors[i].pRun = run_get_di( run );
+ editor->pCursors[i].pPara = para_get_di( run->para );
editor->pCursors[i].nOffset = 0;
}
}
}
-void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow)
+void table_handle_tab( ME_TextEditor *editor, BOOL selected_row )
{
/* FIXME: Shift tab should move to the previous cell. */
ME_Cursor fromCursor, toCursor;
@@ -593,7 +584,9 @@ void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow)
{
fromCursor = editor->pCursors[0];
toCursor = editor->pCursors[1];
- } else {
+ }
+ else
+ {
fromCursor = editor->pCursors[1];
toCursor = editor->pCursors[0];
}
@@ -604,29 +597,28 @@ void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow)
{
editor->pCursors[0] = toCursor;
editor->pCursors[1] = toCursor;
- } else {
- ME_SelectOrInsertNextCell(editor, toCursor.pRun);
}
- } else { /* v1.0 - 3.0 */
- if (!ME_IsInTable(fromCursor.pRun)) {
+ else table_select_next_cell_or_append( editor, &toCursor.pRun->member.run );
+ }
+ else /* v1.0 - 3.0 */
+ {
+ if (!ME_IsInTable(fromCursor.pRun))
+ {
editor->pCursors[0] = fromCursor;
editor->pCursors[1] = fromCursor;
/* FIXME: For some reason the caret is shown at the start of the
* previous paragraph in v1.0 to v3.0 */
- } else if ((bSelectedRow || !ME_IsInTable(toCursor.pRun))) {
- ME_SelectOrInsertNextCell(editor, fromCursor.pRun);
- } else {
- if (ME_IsSelection(editor) && !toCursor.nOffset)
- {
- ME_DisplayItem *run;
- run = ME_FindItemBack(toCursor.pRun, diRunOrParagraphOrEnd);
- if (run->type == diRun && run->member.run.nFlags & MERF_TAB)
- ME_SelectOrInsertNextCell(editor, run);
- else
- ME_SelectOrInsertNextCell(editor, toCursor.pRun);
- } else {
- ME_SelectOrInsertNextCell(editor, toCursor.pRun);
- }
+ }
+ else if ((selected_row || !para_in_table( &toCursor.pPara->member.para )))
+ table_select_next_cell_or_append( editor, &fromCursor.pRun->member.run );
+ else
+ {
+ ME_Run *run = run_prev( &toCursor.pRun->member.run );
+
+ if (ME_IsSelection(editor) && !toCursor.nOffset && run && run->nFlags & MERF_TAB)
+ table_select_next_cell_or_append( editor, run );
+ else
+ table_select_next_cell_or_append( editor, &toCursor.pRun->member.run );
}
}
ME_InvalidateSelection(editor);
--
2.23.0
1
0
29 Oct '20
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/table.c | 35 ++++++++++++++++-------------------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index 40eef4bbd13..cc2ebb8ed50 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -429,16 +429,14 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row )
{
WCHAR endl = '\r', tab = '\t';
ME_Run *run;
- PARAFORMAT2 *pFmt;
int i;
- assert(table_row);
if (!editor->bEmulateVersion10) /* v4.1 */
{
- ME_DisplayItem *insertedCell, *cell;
- ME_Paragraph *para, *prev_table_end;
+ ME_Cell *new_cell, *cell;
+ ME_Paragraph *para, *prev_table_end, *new_row_start;
- cell = ME_FindItemFwd( para_get_di( table_row_start( table_row ) ), diCell );
+ cell = table_row_first_cell( table_row );
prev_table_end = table_row_end( table_row );
para = para_next( prev_table_end );
run = para_first_run( para );
@@ -446,38 +444,37 @@ ME_Paragraph* table_append_row( ME_TextEditor *editor, ME_Paragraph *table_row )
editor->pCursors[0].pRun = run_get_di( run );
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
- para = table_insert_row_start( editor, editor->pCursors );
- insertedCell = ME_FindItemFwd( para_get_di( para ), diCell );
+ new_row_start = table_insert_row_start( editor, editor->pCursors );
+ new_cell = table_row_first_cell( new_row_start );
/* Copy cell properties */
- insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
- insertedCell->member.cell.border = cell->member.cell.border;
- while (cell->member.cell.next_cell)
+ new_cell->nRightBoundary = cell->nRightBoundary;
+ new_cell->border = cell->border;
+ while (cell_next( cell ))
{
- cell = cell->member.cell.next_cell;
+ cell = cell_next( cell );
para = table_insert_cell( editor, editor->pCursors );
- insertedCell = ME_FindItemBack( para_get_di( para ), diCell );
+ new_cell = para_cell( para );
/* Copy cell properties */
- insertedCell->member.cell.nRightBoundary = cell->member.cell.nRightBoundary;
- insertedCell->member.cell.border = cell->member.cell.border;
+ new_cell->nRightBoundary = cell->nRightBoundary;
+ new_cell->border = cell->border;
};
para = table_insert_row_end( editor, editor->pCursors );
para->fmt = prev_table_end->fmt;
/* return the table row start for the inserted paragraph */
- return para_next( &ME_FindItemFwd( cell, diParagraph )->member.para );
+ return new_row_start;
}
else /* v1.0 - 3.0 */
{
run = para_end_run( table_row );
- pFmt = &table_row->fmt;
- assert(pFmt->dwMask & PFM_TABLE && pFmt->wEffects & PFE_TABLE);
+ assert( para_in_table( table_row ) );
editor->pCursors[0].pPara = para_get_di( table_row );
editor->pCursors[0].pRun = run_get_di( run );
editor->pCursors[0].nOffset = 0;
editor->pCursors[1] = editor->pCursors[0];
ME_InsertTextFromCursor( editor, 0, &endl, 1, run->style );
run = &editor->pCursors[0].pRun->member.run;
- for (i = 0; i < pFmt->cTabCount; i++)
- ME_InsertTextFromCursor(editor, 0, &tab, 1, run->style);
+ for (i = 0; i < table_row->fmt.cTabCount; i++)
+ ME_InsertTextFromCursor( editor, 0, &tab, 1, run->style );
return para_next( table_row );
}
--
2.23.0
1
0
[PATCH 1/5] riched20: Use para and run ptrs in the table deletion function.
by Huw Davies 29 Oct '20
by Huw Davies 29 Oct '20
29 Oct '20
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
---
dlls/riched20/caret.c | 7 +--
dlls/riched20/editor.h | 2 +-
dlls/riched20/table.c | 136 +++++++++++++++++++----------------------
3 files changed, 67 insertions(+), 78 deletions(-)
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 8af0f1de724..68bf40c76de 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -306,12 +306,11 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
if (!bForce)
{
- ME_ProtectPartialTableDeletion(editor, &c, &nChars);
- if (nChars == 0)
- return FALSE;
+ table_protect_partial_deletion( editor, &c, &nChars );
+ if (nChars == 0) return FALSE;
}
- while(nChars > 0)
+ while (nChars > 0)
{
ME_Run *run;
cursor_from_char_ofs( editor, nOfs + nChars, &c );
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index ddb6d138957..6e1c639236e 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -302,12 +302,12 @@ ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) D
ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN;
ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN;
+void table_protect_partial_deletion( ME_TextEditor *editor, ME_Cursor *c, int *num_chars ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN;
void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN;
-void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nChars) DECLSPEC_HIDDEN;
void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow) DECLSPEC_HIDDEN;
void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN;
struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN;
diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c
index 33e89a11771..40eef4bbd13 100644
--- a/dlls/riched20/table.c
+++ b/dlls/riched20/table.c
@@ -315,123 +315,113 @@ BOOL ME_IsInTable(ME_DisplayItem *pItem)
}
/* Table rows should either be deleted completely or not at all. */
-void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, ME_Cursor *c, int *nChars)
+void table_protect_partial_deletion( ME_TextEditor *editor, ME_Cursor *c, int *num_chars )
{
- int nOfs = ME_GetCursorOfs(c);
+ int start_ofs = ME_GetCursorOfs( c );
ME_Cursor c2 = *c;
- ME_DisplayItem *this_para = c->pPara;
- ME_DisplayItem *end_para;
+ ME_Paragraph *this_para = &c->pPara->member.para, *end_para;
- ME_MoveCursorChars(editor, &c2, *nChars, FALSE);
- end_para = c2.pPara;
- if (c2.pRun->member.run.nFlags & MERF_ENDPARA) {
+ ME_MoveCursorChars( editor, &c2, *num_chars, FALSE );
+ end_para = &c2.pPara->member.para;
+ if (c2.pRun->member.run.nFlags & MERF_ENDPARA)
+ {
/* End offset might be in the middle of the end paragraph run.
* If this is the case, then we need to use the next paragraph as the last
* paragraphs.
*/
- int remaining = nOfs + *nChars - c2.pRun->member.run.nCharOfs
- - end_para->member.para.nCharOfs;
+ int remaining = start_ofs + *num_chars - c2.pRun->member.run.nCharOfs - end_para->nCharOfs;
if (remaining)
{
- assert(remaining < c2.pRun->member.run.len);
- end_para = end_para->member.para.next_para;
+ assert( remaining < c2.pRun->member.run.len );
+ end_para = para_next( end_para );
}
}
- if (!editor->bEmulateVersion10) { /* v4.1 */
- if (this_para->member.para.pCell != end_para->member.para.pCell ||
- ((this_para->member.para.nFlags|end_para->member.para.nFlags)
- & (MEPF_ROWSTART|MEPF_ROWEND)))
+ if (!editor->bEmulateVersion10) /* v4.1 */
+ {
+ if (para_cell( this_para ) != para_cell( end_para ) ||
+ ((this_para->nFlags | end_para->nFlags) & (MEPF_ROWSTART | MEPF_ROWEND)))
{
while (this_para != end_para)
{
- ME_DisplayItem *next_para = this_para->member.para.next_para;
- BOOL bTruancateDeletion = FALSE;
- if (this_para->member.para.nFlags & MEPF_ROWSTART) {
+ ME_Paragraph *next_para = para_next( this_para );
+ BOOL truancate_del = FALSE;
+ if (this_para->nFlags & MEPF_ROWSTART)
+ {
/* The following while loop assumes that next_para is MEPF_ROWSTART,
- * so moving back one paragraph let's it be processed as the start
+ * so moving back one paragraph lets it be processed as the start
* of the row. */
next_para = this_para;
- this_para = this_para->member.para.prev_para;
- } else if (next_para->member.para.pCell != this_para->member.para.pCell
- || this_para->member.para.nFlags & MEPF_ROWEND)
+ this_para = para_prev( this_para );
+ }
+ else if (para_cell( next_para) != para_cell( this_para ) || this_para->nFlags & MEPF_ROWEND)
{
/* Start of the deletion from after the start of the table row. */
- bTruancateDeletion = TRUE;
+ truancate_del = TRUE;
}
- while (!bTruancateDeletion &&
- next_para->member.para.nFlags & MEPF_ROWSTART)
+ while (!truancate_del && next_para->nFlags & MEPF_ROWSTART)
{
- next_para = table_row_end( &next_para->member.para )->next_para;
- if (next_para->member.para.nCharOfs > nOfs + *nChars)
+ next_para = para_next( table_row_end( next_para ) );
+ if (next_para->nCharOfs > start_ofs + *num_chars)
{
/* End of deletion is not past the end of the table row. */
- next_para = this_para->member.para.next_para;
+ next_para = para_next( this_para );
/* Delete the end paragraph preceding the table row if the
* preceding table row will be empty. */
- if (this_para->member.para.nCharOfs >= nOfs)
- {
- next_para = next_para->member.para.next_para;
- }
- bTruancateDeletion = TRUE;
- } else {
- this_para = next_para->member.para.prev_para;
+ if (this_para->nCharOfs >= start_ofs) next_para = para_next( next_para );
+ truancate_del = TRUE;
}
+ else this_para = para_prev( next_para );
}
- if (bTruancateDeletion)
+ if (truancate_del)
{
- ME_Run *end_run = &ME_FindItemBack(next_para, diRun)->member.run;
- int nCharsNew = (next_para->member.para.nCharOfs - nOfs
- - end_run->len);
- nCharsNew = max(nCharsNew, 0);
- assert(nCharsNew <= *nChars);
- *nChars = nCharsNew;
+ ME_Run *end_run = para_end_run( para_prev( next_para ) );
+ int new_chars = next_para->nCharOfs - start_ofs - end_run->len;
+ new_chars = max( new_chars, 0 );
+ assert( new_chars <= *num_chars);
+ *num_chars = new_chars;
break;
}
this_para = next_para;
}
}
- } else { /* v1.0 - 3.0 */
- ME_DisplayItem *pRun;
- int nCharsToBoundary;
+ }
+ else /* v1.0 - 3.0 */
+ {
+ ME_Run *run;
+ int chars_to_boundary;
- if ((this_para->member.para.nCharOfs != nOfs || this_para == end_para) &&
- this_para->member.para.fmt.dwMask & PFM_TABLE &&
- this_para->member.para.fmt.wEffects & PFE_TABLE)
+ if ((this_para->nCharOfs != start_ofs || this_para == end_para) && para_in_table( this_para ))
{
- pRun = c->pRun;
+ run = &c->pRun->member.run;
/* Find the next tab or end paragraph to use as a delete boundary */
- while (!(pRun->member.run.nFlags & (MERF_TAB|MERF_ENDPARA)))
- pRun = ME_FindItemFwd(pRun, diRun);
- nCharsToBoundary = pRun->member.run.nCharOfs
- - c->pRun->member.run.nCharOfs
- - c->nOffset;
- *nChars = min(*nChars, nCharsToBoundary);
- } else if (end_para->member.para.fmt.dwMask & PFM_TABLE &&
- end_para->member.para.fmt.wEffects & PFE_TABLE)
+ while (!(run->nFlags & (MERF_TAB | MERF_ENDPARA)))
+ run = run_next( run );
+ chars_to_boundary = run->nCharOfs - c->pRun->member.run.nCharOfs - c->nOffset;
+ *num_chars = min( *num_chars, chars_to_boundary );
+ }
+ else if (para_in_table( end_para ))
{
/* The deletion starts from before the row, so don't join it with
* previous non-empty paragraphs. */
- ME_DisplayItem *curPara;
- pRun = NULL;
- if (nOfs > this_para->member.para.nCharOfs) {
- pRun = ME_FindItemBack(end_para, diRun);
- curPara = end_para->member.para.prev_para;
+ ME_Paragraph *cur_para;
+ run = NULL;
+ if (start_ofs > this_para->nCharOfs)
+ {
+ cur_para = para_prev( end_para );
+ run = para_end_run( cur_para );
}
- if (!pRun) {
- pRun = ME_FindItemFwd(end_para, diRun);
- curPara = end_para;
+ if (!run)
+ {
+ cur_para = end_para;
+ run = para_first_run( end_para );
}
- if (pRun)
+ if (run)
{
- nCharsToBoundary = curPara->member.para.nCharOfs
- + pRun->member.run.nCharOfs
- - nOfs;
- if (nCharsToBoundary >= 0)
- *nChars = min(*nChars, nCharsToBoundary);
+ chars_to_boundary = cur_para->nCharOfs + run->nCharOfs - start_ofs;
+ if (chars_to_boundary >= 0) *num_chars = min( *num_chars, chars_to_boundary );
}
}
- if (*nChars < 0)
- *nChars = 0;
+ if (*num_chars < 0) *num_chars = 0;
}
}
--
2.23.0
1
0
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
---
dlls/msi/tests/automation.c | 273 +++++++++++++++---------------------
dlls/msi/tests/custom.c | 81 +++++------
dlls/msi/tests/db.c | 75 +++-------
dlls/msi/tests/install.c | 27 ++--
dlls/msi/tests/msi.c | 30 ++--
dlls/msi/tests/package.c | 124 +++++++---------
dlls/msi/tests/patch.c | 15 +-
dlls/msi/tests/record.c | 7 +-
dlls/msi/tests/suminfo.c | 3 +-
9 files changed, 250 insertions(+), 385 deletions(-)
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index 7e5124c1a16..42c41dcd731 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -41,14 +41,6 @@ static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
static const char *msifile = "winetest-automation.msi";
-static const WCHAR szMsifile[] = {'w','i','n','e','t','e','s','t','-','a','u','t','o','m','a','t','i','o','n','.','m','s','i',0};
-static const WCHAR szMSITEST[] = { 'M','S','I','T','E','S','T',0 };
-static const WCHAR szProductCode[] = { '{','8','3','7','4','5','0','f','a','-','a','3','9','b','-','4','b','c','8','-','b','3','2','1','-','0','8','b','3','9','3','f','7','8','4','b','3','}',0 };
-static const WCHAR szUpgradeCode[] = { '{','C','E','0','6','7','E','8','D','-','2','E','1','A','-','4','3','6','7','-','B','7','3','4','-','4','E','B','2','B','D','A','D','6','5','6','5','}',0 };
-static const WCHAR szProductInfoException[] = { 'P','r','o','d','u','c','t','I','n','f','o',',','P','r','o','d','u','c','t',',','A','t','t','r','i','b','u','t','e',0 };
-static const WCHAR WINE_INSTALLPROPERTY_PACKAGENAMEW[] = {'P','a','c','k','a','g','e','N','a','m','e',0};
-static const WCHAR WINE_INSTALLPROPERTY_PRODUCTNAMEW[] = {'P','r','o','d','u','c','t','N','a','m','e',0};
-static const WCHAR WINE_INSTALLPROPERTY_LOCALPACKAGEW[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
static FILETIME systemtime;
static CHAR CURR_DIR[MAX_PATH];
static EXCEPINFO excepinfo;
@@ -56,7 +48,6 @@ static EXCEPINFO excepinfo;
/*
* OLE automation data
**/
-static const WCHAR szProgId[] = { 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r','.','I','n','s','t','a','l','l','e','r',0 };
static IDispatch *pInstaller;
/* msi database data */
@@ -345,7 +336,6 @@ static void create_database(const CHAR *name, const msi_table *tables, int num_t
static BOOL create_package(LPWSTR path)
{
- static const WCHAR slashW[] = {'\\',0};
DWORD len;
/* Prepare package */
@@ -357,8 +347,7 @@ static BOOL create_package(LPWSTR path)
if (!len)
return FALSE;
- lstrcatW(path, slashW);
- lstrcatW(path, szMsifile);
+ lstrcatW(path, L"\\winetest-automation.msi");
return TRUE;
}
@@ -486,8 +475,6 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH];
ok(0, format, extra, string1, aString); \
/* exception checker */
-static const WCHAR szSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o','r',0};
-
#define ok_exception(hr, szDescription) \
if (hr == DISP_E_EXCEPTION) \
{ \
@@ -496,7 +483,7 @@ static const WCHAR szSource[] = {'M','s','i',' ','A','P','I',' ','E','r','r','o'
\
ok(excepinfo.bstrSource != NULL, "Exception source was NULL\n"); \
if (excepinfo.bstrSource) \
- ok_w2("Exception source was \"%s\" but expected to be \"%s\"\n", excepinfo.bstrSource, szSource); \
+ ok_w2("Exception source was \"%s\" but expected to be \"%s\"\n", excepinfo.bstrSource, L"Msi API Error"); \
\
ok(excepinfo.bstrDescription != NULL, "Exception description was NULL\n"); \
if (excepinfo.bstrDescription) \
@@ -625,9 +612,6 @@ static void test_dispid(void)
/* Test basic IDispatch functions */
static void test_dispatch(void)
{
- static WCHAR szOpenPackage[] = { 'O','p','e','n','P','a','c','k','a','g','e',0 };
- static const WCHAR szOpenPackageException[] = {'O','p','e','n','P','a','c','k','a','g','e',',','P','a','c','k','a','g','e','P','a','t','h',',','O','p','t','i','o','n','s',0};
- static WCHAR szProductState[] = { 'P','r','o','d','u','c','t','S','t','a','t','e',0 };
HRESULT hr;
DISPID dispid;
OLECHAR *name;
@@ -637,7 +621,7 @@ static void test_dispatch(void)
DISPPARAMS dispparams = {NULL, NULL, 0, 0};
/* Test getting ID of a function name that does not exist */
- name = (WCHAR *)szMsifile;
+ name = (WCHAR *)L"winetest-automation.msi";
hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
ok(hr == DISP_E_UNKNOWNNAME, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr);
@@ -646,7 +630,7 @@ static void test_dispatch(void)
ok(hr == DISP_E_MEMBERNOTFOUND, "IDispatch::Invoke returned 0x%08x\n", hr);
/* Test getting ID of a function name that does exist */
- name = szOpenPackage;
+ name = (WCHAR *)L"OpenPackage";
hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr);
@@ -683,10 +667,10 @@ static void test_dispatch(void)
dispparams.cArgs = 1;
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_BSTR;
- V_BSTR(&vararg[0]) = SysAllocString(szMsifile);
+ V_BSTR(&vararg[0]) = SysAllocString(L"winetest-automation.msi");
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr);
- ok_exception(hr, szOpenPackageException);
+ ok_exception(hr, L"OpenPackage,PackagePath,Options");
VariantClear(&vararg[0]);
/* Provide the required BSTR and an empty second parameter.
@@ -695,11 +679,11 @@ static void test_dispatch(void)
dispparams.cArgs = 2;
VariantInit(&vararg[1]);
V_VT(&vararg[1]) = VT_BSTR;
- V_BSTR(&vararg[1]) = SysAllocString(szMsifile);
+ V_BSTR(&vararg[1]) = SysAllocString(L"winetest-automation.msi");
VariantInit(&vararg[0]);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr);
- ok_exception(hr, szOpenPackageException);
+ ok_exception(hr, L"OpenPackage,PackagePath,Options");
VariantClear(&vararg[1]);
/* Provide the required BSTR and two empty parameters.
@@ -708,22 +692,22 @@ static void test_dispatch(void)
dispparams.cArgs = 3;
VariantInit(&vararg[2]);
V_VT(&vararg[2]) = VT_BSTR;
- V_BSTR(&vararg[2]) = SysAllocString(szMsifile);
+ V_BSTR(&vararg[2]) = SysAllocString(L"winetest-automation.msi");
VariantInit(&vararg[1]);
VariantInit(&vararg[0]);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr);
- ok_exception(hr, szOpenPackageException);
+ ok_exception(hr, L"OpenPackage,PackagePath,Options");
VariantClear(&vararg[2]);
/* Provide the required BSTR and a second parameter with the wrong type. */
dispparams.cArgs = 2;
VariantInit(&vararg[1]);
V_VT(&vararg[1]) = VT_BSTR;
- V_BSTR(&vararg[1]) = SysAllocString(szMsifile);
+ V_BSTR(&vararg[1]) = SysAllocString(L"winetest-automation.msi");
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_BSTR;
- V_BSTR(&vararg[0]) = SysAllocString(szMsifile);
+ V_BSTR(&vararg[0]) = SysAllocString(L"winetest-automation.msi");
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok(hr == DISP_E_TYPEMISMATCH, "IDispatch::Invoke returned 0x%08x\n", hr);
VariantClear(&vararg[0]);
@@ -738,10 +722,10 @@ static void test_dispatch(void)
dispparams.cArgs = 1;
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_BSTR;
- V_BSTR(&vararg[0]) = SysAllocString(szMsifile);
+ V_BSTR(&vararg[0]) = SysAllocString(L"winetest-automation.msi");
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
todo_wine ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr);
- ok_exception(hr, szOpenPackageException);
+ ok_exception(hr, L"OpenPackage,PackagePath,Options");
VariantClear(&vararg[0]);
if (hr != DISP_E_EXCEPTION)
VariantClear(&varresult);
@@ -831,7 +815,7 @@ static void test_dispatch(void)
ok(hr == DISP_E_MEMBERNOTFOUND, "IDispatch::Invoke returned 0x%08x\n", hr);
/* Test invoking a read-only property as DISPATCH_PROPERTYPUT or as a DISPATCH_METHOD */
- name = szProductState;
+ name = (WCHAR *)L"ProductState";
hr = IDispatch_GetIDsOfNames(pInstaller, &IID_NULL, &name, 1, LOCALE_USER_DEFAULT, &dispid);
ok(hr == S_OK, "IDispatch::GetIDsOfNames returned 0x%08x\n", hr);
@@ -1593,8 +1577,6 @@ static HRESULT SummaryInfo_PropertyCountGet(IDispatch *pSummaryInfo, int *pCount
static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *info, int num_info, BOOL readonly)
{
- static const WCHAR szPropertyException[] = { 'P','r','o','p','e','r','t','y',',','P','i','d',0 };
- static const WCHAR szTitle[] = { 'T','i','t','l','e',0 };
VARIANT varresult, var;
SYSTEMTIME st;
HRESULT hr;
@@ -1647,11 +1629,11 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
/* Invalid pids */
hr = SummaryInfo_PropertyGet(pSummaryInfo, -1, &varresult, VT_EMPTY);
ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szPropertyException);
+ ok_exception(hr, L"Property,Pid");
hr = SummaryInfo_PropertyGet(pSummaryInfo, 1000, &varresult, VT_EMPTY);
ok(hr == DISP_E_EXCEPTION, "SummaryInfo_PropertyGet failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szPropertyException);
+ ok_exception(hr, L"Property,Pid");
/* Unsupported pids */
hr = SummaryInfo_PropertyGet(pSummaryInfo, PID_DICTIONARY, &varresult, VT_EMPTY);
@@ -1692,7 +1674,7 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
/* VT_BSTR */
V_VT(&var) = VT_BSTR;
- V_BSTR(&var) = SysAllocString(szTitle);
+ V_BSTR(&var) = SysAllocString(L"Title");
hr = SummaryInfo_PropertyPut(pSummaryInfo, PID_TITLE, &var);
ok(hr == S_OK, "SummaryInfo_PropertyPut failed, hresult 0x%08x\n", hr);
@@ -1736,15 +1718,10 @@ static void test_SummaryInfo(IDispatch *pSummaryInfo, const msi_summary_info *in
static void test_Database(IDispatch *pDatabase, BOOL readonly)
{
- static const WCHAR szSql[] = { 'S','E','L','E','C','T',' ','`','F','e','a','t','u','r','e','`',' ','F','R','O','M',' ','`','F','e','a','t','u','r','e','`',' ','W','H','E','R','E',' ','`','F','e','a','t','u','r','e','_','P','a','r','e','n','t','`','=','\'','O','n','e','\'',0 };
- static const WCHAR szThree[] = { 'T','h','r','e','e',0 };
- static const WCHAR szTwo[] = { 'T','w','o',0 };
- static const WCHAR szStringDataField[] = { 'S','t','r','i','n','g','D','a','t','a',',','F','i','e','l','d',0 };
- static const WCHAR szModifyModeRecord[] = { 'M','o','d','i','f','y',',','M','o','d','e',',','R','e','c','o','r','d',0 };
IDispatch *pView = NULL, *pSummaryInfo = NULL;
HRESULT hr;
- hr = Database_OpenView(pDatabase, szSql, &pView);
+ hr = Database_OpenView(pDatabase, L"SELECT `Feature` FROM `Feature` WHERE `Feature_Parent`='One'", &pView);
ok(hr == S_OK, "Database_OpenView failed, hresult 0x%08x\n", hr);
if (hr == S_OK)
{
@@ -1765,35 +1742,35 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly)
memset(szString, 0, sizeof(szString));
hr = Record_StringDataGet(pRecord, 1, szString);
ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr);
- ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szThree);
+ ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Three");
/* Record::StringDataPut with correct index */
- hr = Record_StringDataPut(pRecord, 1, szTwo);
+ hr = Record_StringDataPut(pRecord, 1, L"Two");
ok(hr == S_OK, "Record_StringDataPut failed, hresult 0x%08x\n", hr);
/* Record::StringDataGet */
memset(szString, 0, sizeof(szString));
hr = Record_StringDataGet(pRecord, 1, szString);
ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr);
- ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szTwo);
+ ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Two");
/* Record::StringDataPut with incorrect index */
hr = Record_StringDataPut(pRecord, -1, szString);
ok(hr == DISP_E_EXCEPTION, "Record_StringDataPut failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szStringDataField);
+ ok_exception(hr, L"StringData,Field");
/* View::Modify with incorrect parameters */
hr = View_Modify(pView, -5, NULL);
ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szModifyModeRecord);
+ ok_exception(hr, L"Modify,Mode,Record");
hr = View_Modify(pView, -5, pRecord);
ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szModifyModeRecord);
+ ok_exception(hr, L"Modify,Mode,Record");
hr = View_Modify(pView, MSIMODIFY_REFRESH, NULL);
ok(hr == DISP_E_EXCEPTION, "View_Modify failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szModifyModeRecord);
+ ok_exception(hr, L"Modify,Mode,Record");
hr = View_Modify(pView, MSIMODIFY_REFRESH, pRecord);
ok(hr == S_OK, "View_Modify failed, hresult 0x%08x\n", hr);
@@ -1802,7 +1779,7 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly)
memset(szString, 0, sizeof(szString));
hr = Record_StringDataGet(pRecord, 1, szString);
ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr);
- todo_wine ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szThree);
+ todo_wine ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Three");
IDispatch_Release(pRecord);
}
@@ -1817,7 +1794,7 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly)
memset(szString, 0, sizeof(szString));
hr = Record_StringDataGet(pRecord, 1, szString);
ok(hr == S_OK, "Record_StringDataGet failed, hresult 0x%08x\n", hr);
- ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, szTwo);
+ ok_w2("Record_StringDataGet result was %s but expected %s\n", szString, L"Two");
IDispatch_Release(pRecord);
}
@@ -1849,17 +1826,6 @@ static void test_Database(IDispatch *pDatabase, BOOL readonly)
static void test_Session(IDispatch *pSession)
{
- static const WCHAR szProductName[] = { 'P','r','o','d','u','c','t','N','a','m','e',0 };
- static const WCHAR szOne[] = { 'O','n','e',0 };
- static const WCHAR szOneStateFalse[] = { '!','O','n','e','>','0',0 };
- static const WCHAR szOneStateTrue[] = { '!','O','n','e','=','-','1',0 };
- static const WCHAR szOneActionFalse[] = { '$','O','n','e','=','-','1',0 };
- static const WCHAR szOneActionTrue[] = { '$','O','n','e','>','0',0 };
- static const WCHAR szCostInitialize[] = { 'C','o','s','t','I','n','i','t','i','a','l','i','z','e',0 };
- static const WCHAR szEmpty[] = { 0 };
- static const WCHAR szEquals[] = { '=',0 };
- static const WCHAR szPropertyName[] = { 'P','r','o','p','e','r','t','y',',','N','a','m','e',0 };
- static const WCHAR szModeFlag[] = { 'M','o','d','e',',','F','l','a','g',0 };
WCHAR stringw[MAX_PATH];
CHAR string[MAX_PATH];
UINT len;
@@ -1885,9 +1851,9 @@ static void test_Session(IDispatch *pSession)
/* Session::Property, get */
memset(stringw, 0, sizeof(stringw));
- hr = Session_PropertyGet(pSession, szProductName, stringw);
+ hr = Session_PropertyGet(pSession, L"ProductName", stringw);
ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr);
- if (lstrcmpW(stringw, szMSITEST) != 0)
+ if (lstrcmpW(stringw, L"MSITEST") != 0)
{
len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL);
ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError());
@@ -1895,12 +1861,12 @@ static void test_Session(IDispatch *pSession)
}
/* Session::Property, put */
- hr = Session_PropertyPut(pSession, szProductName, szProductName);
+ hr = Session_PropertyPut(pSession, L"ProductName", L"ProductName");
ok(hr == S_OK, "Session_PropertyPut failed, hresult 0x%08x\n", hr);
memset(stringw, 0, sizeof(stringw));
- hr = Session_PropertyGet(pSession, szProductName, stringw);
+ hr = Session_PropertyGet(pSession, L"ProductName", stringw);
ok(hr == S_OK, "Session_PropertyGet failed, hresult 0x%08x\n", hr);
- if (lstrcmpW(stringw, szProductName) != 0)
+ if (lstrcmpW(stringw, L"ProductName") != 0)
{
len = WideCharToMultiByte(CP_ACP, 0, stringw, -1, string, MAX_PATH, NULL, NULL);
ok(len, "WideCharToMultiByteChar returned error %d\n", GetLastError());
@@ -1908,12 +1874,12 @@ static void test_Session(IDispatch *pSession)
}
/* Try putting a property using empty property identifier */
- hr = Session_PropertyPut(pSession, szEmpty, szProductName);
+ hr = Session_PropertyPut(pSession, L"", L"ProductName");
ok(hr == DISP_E_EXCEPTION, "Session_PropertyPut failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szPropertyName);
+ ok_exception(hr, L"Property,Name");
/* Try putting a property using illegal property identifier */
- hr = Session_PropertyPut(pSession, szEquals, szProductName);
+ hr = Session_PropertyPut(pSession, L"=", L"ProductName");
ok(hr == S_OK, "Session_PropertyPut failed, hresult 0x%08x\n", hr);
/* Session::Language, get */
@@ -1941,7 +1907,7 @@ static void test_Session(IDispatch *pSession)
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, VARIANT_TRUE);
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szModeFlag);
+ ok_exception(hr, L"Mode,Flag");
hr = Session_ModeGet(pSession, MSIRUNMODE_REBOOTNOW, &bool);
ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr);
@@ -1949,11 +1915,11 @@ static void test_Session(IDispatch *pSession)
hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, VARIANT_FALSE); /* set it again so we don't reboot */
ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szModeFlag);
+ ok_exception(hr, L"Mode,Flag");
hr = Session_ModePut(pSession, MSIRUNMODE_MAINTENANCE, VARIANT_TRUE);
ok(hr == DISP_E_EXCEPTION, "Session_ModePut failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szModeFlag);
+ ok_exception(hr, L"Mode,Flag");
/* Session::Database, get */
hr = Session_Database(pSession, &pDatabase);
@@ -1969,16 +1935,16 @@ static void test_Session(IDispatch *pSession)
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
- hr = Session_EvaluateCondition(pSession, szEmpty, &myint);
+ hr = Session_EvaluateCondition(pSession, L"", &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
- hr = Session_EvaluateCondition(pSession, szEquals, &myint);
+ hr = Session_EvaluateCondition(pSession, L"=", &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_ERROR, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
/* Session::DoAction(CostInitialize) must occur before the next statements */
- hr = Session_DoAction(pSession, szCostInitialize, &myint);
+ hr = Session_DoAction(pSession, L"CostInitialize", &myint);
ok(hr == S_OK, "Session_DoAction failed, hresult 0x%08x\n", hr);
ok(myint == IDOK, "DoAction(CostInitialize) returned %d, %d expected\n", myint, IDOK);
@@ -1987,7 +1953,7 @@ static void test_Session(IDispatch *pSession)
ok(hr == S_OK, "Session_SetInstallLevel failed, hresult 0x%08x\n", hr);
/* Session::FeatureCurrentState, get */
- hr = Session_FeatureCurrentState(pSession, szOne, &myint);
+ hr = Session_FeatureCurrentState(pSession, L"One", &myint);
ok(hr == S_OK, "Session_FeatureCurrentState failed, hresult 0x%08x\n", hr);
ok(myint == INSTALLSTATE_UNKNOWN, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
@@ -1999,27 +1965,27 @@ static void test_Session(IDispatch *pSession)
ok(myint == 0, "Session_Message returned %x\n", myint);
/* Session::EvaluateCondition */
- hr = Session_EvaluateCondition(pSession, szOneStateFalse, &myint);
+ hr = Session_EvaluateCondition(pSession, L"!One>0", &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
- hr = Session_EvaluateCondition(pSession, szOneStateTrue, &myint);
+ hr = Session_EvaluateCondition(pSession, L"!One=-1", &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
/* Session::FeatureRequestState, put */
- hr = Session_FeatureRequestStatePut(pSession, szOne, INSTALLSTATE_ADVERTISED);
+ hr = Session_FeatureRequestStatePut(pSession, L"One", INSTALLSTATE_ADVERTISED);
ok(hr == S_OK, "Session_FeatureRequestStatePut failed, hresult 0x%08x\n", hr);
- hr = Session_FeatureRequestStateGet(pSession, szOne, &myint);
+ hr = Session_FeatureRequestStateGet(pSession, L"One", &myint);
ok(hr == S_OK, "Session_FeatureRequestStateGet failed, hresult 0x%08x\n", hr);
ok(myint == INSTALLSTATE_ADVERTISED, "Feature request state was %d but expected %d\n", myint, INSTALLSTATE_ADVERTISED);
/* Session::EvaluateCondition */
- hr = Session_EvaluateCondition(pSession, szOneActionFalse, &myint);
+ hr = Session_EvaluateCondition(pSession, L"$One=-1", &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
- hr = Session_EvaluateCondition(pSession, szOneActionTrue, &myint);
+ hr = Session_EvaluateCondition(pSession, L"$One>0", &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
}
@@ -2048,21 +2014,6 @@ static DWORD delete_key( HKEY hkey )
static void test_Installer_RegistryValue(void)
{
static const DWORD qw[2] = { 0x12345678, 0x87654321 };
- static const WCHAR szKey[] = { 'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\','T','e','s','t',0 };
- static const WCHAR szOne[] = { 'O','n','e',0 };
- static const WCHAR szTwo[] = { 'T','w','o',0 };
- static const WCHAR szThree[] = { 'T','h','r','e','e',0 };
- static const WCHAR szREG_BINARY[] = { '(','R','E','G','_','B','I','N','A','R','Y',')',0 };
- static const WCHAR szFour[] = { 'F','o','u','r',0 };
- static const WCHAR szExpand[] = { '%','M','S','I','T','E','S','T','%',0 };
- static const WCHAR szFive[] = { 'F','i','v','e',0,'H','i',0,0 };
- static const WCHAR szFiveHi[] = { 'F','i','v','e','\n','H','i',0 };
- static const WCHAR szSix[] = { 'S','i','x',0 };
- static const WCHAR szREG_[] = { '(','R','E','G','_',']',0 };
- static const WCHAR szREG_2[] = { '(','R','E','G','_','?','?',')',0 };
- static const WCHAR szSeven[] = { 'S','e','v','e','n',0 };
- static const WCHAR szEight[] = { 'E','i','g','h','t',0 };
- static const WCHAR szBlank[] = { 0 };
VARIANT varresult;
VARIANTARG vararg;
WCHAR szString[MAX_PATH];
@@ -2074,7 +2025,7 @@ static void test_Installer_RegistryValue(void)
/* Delete keys */
SetLastError(0xdeadbeef);
- lRet = RegOpenKeyW( HKEY_CURRENT_USER, szKey, &hkey );
+ lRet = RegOpenKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Test", &hkey );
if (!lRet && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip("Needed W-functions are not implemented\n");
@@ -2084,129 +2035,129 @@ static void test_Installer_RegistryValue(void)
delete_key( hkey );
/* Does our key exist? Shouldn't; check with all three possible value parameter types */
- hr = Installer_RegistryValueE(curr_user, szKey, &bRet);
+ hr = Installer_RegistryValueE(curr_user, L"Software\\Wine\\Test", &bRet);
ok(hr == S_OK, "Installer_RegistryValueE failed, hresult 0x%08x\n", hr);
ok(!bRet, "Registry key expected to not exist, but Installer_RegistryValue claims it does\n");
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, NULL, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", NULL, szString);
ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueI(curr_user, szKey, 0, szString, VT_BSTR);
+ hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 0, szString, VT_BSTR);
ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* Create key */
- ok(!RegCreateKeyW( HKEY_CURRENT_USER, szKey, &hkey ), "RegCreateKeyW failed\n");
+ ok(!RegCreateKeyW( HKEY_CURRENT_USER, L"Software\\Wine\\Test", &hkey ), "RegCreateKeyW failed\n");
- ok(!RegSetValueExW(hkey,szOne,0,REG_SZ, (const BYTE *)szOne, sizeof(szOne)),
+ ok(!RegSetValueExW(hkey, L"One", 0, REG_SZ, (const BYTE *)L"One", sizeof(L"one")),
"RegSetValueExW failed\n");
- ok(!RegSetValueExW(hkey,szTwo,0,REG_DWORD, (const BYTE *)qw, 4),
+ ok(!RegSetValueExW(hkey, L"Two", 0, REG_DWORD, (const BYTE *)qw, 4),
"RegSetValueExW failed\n");
- ok(!RegSetValueExW(hkey,szThree,0,REG_BINARY, (const BYTE *)qw, 4),
+ ok(!RegSetValueExW(hkey, L"Three", 0, REG_BINARY, (const BYTE *)qw, 4),
"RegSetValueExW failed\n");
bRet = SetEnvironmentVariableA("MSITEST", "Four");
ok(bRet, "SetEnvironmentVariableA failed %d\n", GetLastError());
- ok(!RegSetValueExW(hkey,szFour,0,REG_EXPAND_SZ, (const BYTE *)szExpand, sizeof(szExpand)),
+ ok(!RegSetValueExW(hkey, L"Four", 0, REG_EXPAND_SZ, (const BYTE *)L"%MSITEST%", sizeof(L"%MSITEST%")),
"RegSetValueExW failed\n");
- ok(!RegSetValueExW(hkey,szFive,0,REG_MULTI_SZ, (const BYTE *)szFive, sizeof(szFive)),
+ ok(!RegSetValueExW(hkey, L"Five\0Hi\0", 0, REG_MULTI_SZ, (const BYTE *)L"Five\0Hi\0", sizeof(L"Five\0Hi\0")),
"RegSetValueExW failed\n");
- ok(!RegSetValueExW(hkey,szSix,0,REG_QWORD, (const BYTE *)qw, 8),
+ ok(!RegSetValueExW(hkey, L"Six", 0, REG_QWORD, (const BYTE *)qw, 8),
"RegSetValueExW failed\n");
- ok(!RegSetValueExW(hkey,szSeven,0,REG_NONE, NULL, 0),
+ ok(!RegSetValueExW(hkey, L"Seven", 0, REG_NONE, NULL, 0),
"RegSetValueExW failed\n");
- ok(!RegSetValueExW(hkey,NULL,0,REG_SZ, (const BYTE *)szOne, sizeof(szOne)),
+ ok(!RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE *)L"One", sizeof(L"One")),
"RegSetValueExW failed\n");
- ok(!RegCreateKeyW( hkey, szEight, &hkey_sub ), "RegCreateKeyW failed\n");
+ ok(!RegCreateKeyW( hkey, L"Eight", &hkey_sub ), "RegCreateKeyW failed\n");
/* Does our key exist? It should, and make sure we retrieve the correct default value */
bRet = FALSE;
- hr = Installer_RegistryValueE(curr_user, szKey, &bRet);
+ hr = Installer_RegistryValueE(curr_user, L"Software\\Wine\\Test", &bRet);
ok(hr == S_OK, "Installer_RegistryValueE failed, hresult 0x%08x\n", hr);
ok(bRet, "Registry key expected to exist, but Installer_RegistryValue claims it does not\n");
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, NULL, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", NULL, szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
- ok_w2("Default registry value \"%s\" does not match expected \"%s\"\n", szString, szOne);
+ ok_w2("Default registry value \"%s\" does not match expected \"%s\"\n", szString, L"One");
/* Ask for the value of a nonexistent key */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, szExpand, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"%MSITEST%", szString);
ok(hr == DISP_E_BADINDEX, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
/* Get values of keys */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, szOne, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"One", szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
- ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szOne);
+ ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, L"One");
VariantInit(&vararg);
V_VT(&vararg) = VT_BSTR;
- V_BSTR(&vararg) = SysAllocString(szTwo);
- hr = Installer_RegistryValue(curr_user, szKey, vararg, &varresult, VT_I4);
+ V_BSTR(&vararg) = SysAllocString(L"Two");
+ hr = Installer_RegistryValue(curr_user, L"Software\\Wine\\Test", vararg, &varresult, VT_I4);
ok(hr == S_OK, "Installer_RegistryValue failed, hresult 0x%08x\n", hr);
ok(V_I4(&varresult) == 305419896, "Registry value %d does not match expected value\n", V_I4(&varresult));
VariantClear(&varresult);
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, szThree, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Three", szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
- ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szREG_BINARY);
+ ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, L"(REG_BINARY)");
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, szFour, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Four", szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
- ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, szFour);
+ ok_w2("Registry value \"%s\" does not match expected \"%s\"\n", szString, L"Four");
/* Vista does not NULL-terminate this case */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, szFive, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Five\0Hi\0", szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
ok_w2n("Registry value \"%s\" does not match expected \"%s\"\n",
- szString, szFiveHi, lstrlenW(szFiveHi));
+ szString, L"Five\nHi", lstrlenW(L"Five\nHi"));
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueW(curr_user, szKey, szSix, szString);
+ hr = Installer_RegistryValueW(curr_user, L"Software\\Wine\\Test", L"Six", szString);
ok(hr == S_OK, "Installer_RegistryValueW failed, hresult 0x%08x\n", hr);
- ok(!lstrcmpW(szString, szREG_2) || broken(!lstrcmpW(szString, szREG_)),
+ ok(!lstrcmpW(szString, L"(REG_\?\?)") || broken(!lstrcmpW(szString, L"(REG_]")),
"Registry value does not match\n");
VariantInit(&vararg);
V_VT(&vararg) = VT_BSTR;
- V_BSTR(&vararg) = SysAllocString(szSeven);
- hr = Installer_RegistryValue(curr_user, szKey, vararg, &varresult, VT_EMPTY);
+ V_BSTR(&vararg) = SysAllocString(L"Seven");
+ hr = Installer_RegistryValue(curr_user, L"Software\\Wine\\Test", vararg, &varresult, VT_EMPTY);
ok(hr == S_OK, "Installer_RegistryValue failed, hresult 0x%08x\n", hr);
/* Get string class name for the key */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueI(curr_user, szKey, 0, szString, VT_BSTR);
+ hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 0, szString, VT_BSTR);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
- ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szBlank);
+ ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, L"");
/* Get name of a value by positive number (RegEnumValue like), valid index */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueI(curr_user, szKey, 2, szString, VT_BSTR);
+ hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 2, szString, VT_BSTR);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* RegEnumValue order seems different on wine */
- todo_wine ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szTwo);
+ todo_wine ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, L"Two");
/* Get name of a value by positive number (RegEnumValue like), invalid index */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueI(curr_user, szKey, 10, szString, VT_EMPTY);
+ hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", 10, szString, VT_EMPTY);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* Get name of a subkey by negative number (RegEnumValue like), valid index */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueI(curr_user, szKey, -1, szString, VT_BSTR);
+ hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", -1, szString, VT_BSTR);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
- ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, szEight);
+ ok_w2("Registry name \"%s\" does not match expected \"%s\"\n", szString, L"Eight");
/* Get name of a subkey by negative number (RegEnumValue like), invalid index */
memset(szString, 0, sizeof(szString));
- hr = Installer_RegistryValueI(curr_user, szKey, -10, szString, VT_EMPTY);
+ hr = Installer_RegistryValueI(curr_user, L"Software\\Wine\\Test", -10, szString, VT_EMPTY);
ok(hr == S_OK, "Installer_RegistryValueI failed, hresult 0x%08x\n", hr);
/* clean up */
@@ -2262,7 +2213,7 @@ static void test_Installer_Products(BOOL bProductInstalled)
ok(iValue == INSTALLSTATE_DEFAULT || iValue == INSTALLSTATE_ADVERTISED, "Installer_ProductState returned %d, expected %d or %d\n", iValue, INSTALLSTATE_DEFAULT, INSTALLSTATE_ADVERTISED);
/* Not found our product code yet? Check */
- if (!bProductFound && !lstrcmpW(szString, szProductCode))
+ if (!bProductFound && !lstrcmpW(szString, L"{837450fa-a39b-4bc8-b321-08b393f784b3}"))
bProductFound = TRUE;
/* IEnumVARIANT::Next */
@@ -2454,7 +2405,7 @@ static void test_Installer_InstallProduct(void)
ok(hr == S_OK, "Expected UILevel property put invoke to return S_OK, got 0x%08x\n", hr);
/* Installer::InstallProduct */
- hr = Installer_InstallProduct(szMsifile, NULL);
+ hr = Installer_InstallProduct(L"winetest-automation.msi", NULL);
if (hr == DISP_E_EXCEPTION)
{
skip("InstallProduct failed, insufficient rights?\n");
@@ -2464,7 +2415,7 @@ static void test_Installer_InstallProduct(void)
ok(hr == S_OK, "Installer_InstallProduct failed, hresult 0x%08x\n", hr);
/* Installer::ProductState for our product code, which has been installed */
- hr = Installer_ProductState(szProductCode, &iValue);
+ hr = Installer_ProductState(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", &iValue);
ok(hr == S_OK, "Installer_ProductState failed, hresult 0x%08x\n", hr);
ok(iValue == INSTALLSTATE_DEFAULT, "Installer_ProductState returned %d, expected %d\n", iValue, INSTALLSTATE_DEFAULT);
@@ -2472,33 +2423,33 @@ static void test_Installer_InstallProduct(void)
/* NULL attribute */
memset(szString, 0, sizeof(szString));
- hr = Installer_ProductInfo(szProductCode, NULL, szString);
+ hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", NULL, szString);
ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szProductInfoException);
+ ok_exception(hr, L"ProductInfo,Product,Attribute");
/* Nonexistent attribute */
memset(szString, 0, sizeof(szString));
- hr = Installer_ProductInfo(szProductCode, szMsifile, szString);
+ hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"winetest-automation.msi", szString);
ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szProductInfoException);
+ ok_exception(hr, L"ProductInfo,Product,Attribute");
/* Package name */
memset(szString, 0, sizeof(szString));
- hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PACKAGENAMEW, szString);
+ hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"PackageName", szString);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
- todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMsifile);
+ todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, L"winetest-automation.msi");
/* Product name */
memset(szString, 0, sizeof(szString));
- hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PRODUCTNAMEW, szString);
+ hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"ProductName", szString);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
- todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, szMSITEST);
+ todo_wine ok_w2("Installer_ProductInfo returned %s but expected %s\n", szString, L"MSITEST");
/* Installer::Products */
test_Installer_Products(TRUE);
/* Installer::RelatedProducts for our upgrade code */
- hr = Installer_RelatedProducts(szUpgradeCode, &pStringList);
+ hr = Installer_RelatedProducts(L"{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}", &pStringList);
ok(hr == S_OK, "Installer_RelatedProducts failed, hresult 0x%08x\n", hr);
if (hr == S_OK)
{
@@ -2511,12 +2462,12 @@ static void test_Installer_InstallProduct(void)
memset(szString, 0, sizeof(szString));
hr = StringList_Item(pStringList, 0, szString);
ok(hr == S_OK, "StringList_Item failed (idx 0, count %d), hresult 0x%08x\n", iCount, hr);
- ok_w2("StringList_Item returned %s but expected %s\n", szString, szProductCode);
+ ok_w2("StringList_Item returned %s but expected %s\n", szString, L"{837450fa-a39b-4bc8-b321-08b393f784b3}");
IDispatch_Release(pStringList);
}
- hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_LOCALPACKAGEW, szString);
+ hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"LocalPackage", szString);
ok(hr == S_OK, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
DeleteFileW( szString );
@@ -2604,8 +2555,6 @@ static void test_Installer_InstallProduct(void)
static void test_Installer(void)
{
- static const WCHAR szCreateRecordException[] = { 'C','r','e','a','t','e','R','e','c','o','r','d',',','C','o','u','n','t',0 };
- static const WCHAR szIntegerDataException[] = { 'I','n','t','e','g','e','r','D','a','t','a',',','F','i','e','l','d',0 };
WCHAR szPath[MAX_PATH];
HRESULT hr;
IDispatch *pSession = NULL, *pDatabase = NULL, *pRecord = NULL, *pStringList = NULL, *pSumInfo = NULL;
@@ -2618,7 +2567,7 @@ static void test_Installer(void)
/* Test for error */
hr = Installer_CreateRecord(-1, &pRecord);
ok(hr == DISP_E_EXCEPTION, "Installer_CreateRecord failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szCreateRecordException);
+ ok_exception(hr, L"CreateRecord,Count");
/* Test for success */
hr = Installer_CreateRecord(1, &pRecord);
@@ -2648,7 +2597,7 @@ static void test_Installer(void)
/* Record::IntegerDataPut, bad index */
hr = Record_IntegerDataPut(pRecord, 10, 100);
ok(hr == DISP_E_EXCEPTION, "Record_IntegerDataPut failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szIntegerDataException);
+ ok_exception(hr, L"IntegerData,Field");
/* Record::IntegerDataGet */
hr = Record_IntegerDataGet(pRecord, 1, &iValue);
@@ -2700,7 +2649,7 @@ static void test_Installer(void)
test_Installer_RegistryValue();
/* Installer::ProductState for our product code, which should not be installed */
- hr = Installer_ProductState(szProductCode, &iValue);
+ hr = Installer_ProductState(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", &iValue);
ok(hr == S_OK, "Installer_ProductState failed, hresult 0x%08x\n", hr);
ok(iValue == INSTALLSTATE_UNKNOWN, "Installer_ProductState returned %d, expected %d\n", iValue, INSTALLSTATE_UNKNOWN);
@@ -2708,21 +2657,21 @@ static void test_Installer(void)
/* Package name */
memset(szPath, 0, sizeof(szPath));
- hr = Installer_ProductInfo(szProductCode, WINE_INSTALLPROPERTY_PACKAGENAMEW, szPath);
+ hr = Installer_ProductInfo(L"{837450fa-a39b-4bc8-b321-08b393f784b3}", L"PackageName", szPath);
ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szProductInfoException);
+ ok_exception(hr, L"ProductInfo,Product,Attribute");
/* NULL attribute and NULL product code */
memset(szPath, 0, sizeof(szPath));
hr = Installer_ProductInfo(NULL, NULL, szPath);
ok(hr == DISP_E_EXCEPTION, "Installer_ProductInfo failed, hresult 0x%08x\n", hr);
- ok_exception(hr, szProductInfoException);
+ ok_exception(hr, L"ProductInfo,Product,Attribute");
/* Installer::Products */
test_Installer_Products(FALSE);
/* Installer::RelatedProducts for our upgrade code, should not find anything */
- hr = Installer_RelatedProducts(szUpgradeCode, &pStringList);
+ hr = Installer_RelatedProducts(L"{CE067E8D-2E1A-4367-B734-4EB2BDAD6565}", &pStringList);
ok(hr == S_OK, "Installer_RelatedProducts failed, hresult 0x%08x\n", hr);
if (hr == S_OK)
{
@@ -2772,7 +2721,7 @@ START_TEST(automation)
hr = OleInitialize(NULL);
ok (hr == S_OK, "OleInitialize returned 0x%08x\n", hr);
- hr = CLSIDFromProgID(szProgId, &clsid);
+ hr = CLSIDFromProgID(L"WindowsInstaller.Installer", &clsid);
ok (hr == S_OK, "CLSIDFromProgID returned 0x%08x\n", hr);
hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
ok(hr == S_OK, "CoCreateInstance returned 0x%08x\n", hr);
diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c
index 504f32cf96f..caf24356948 100644
--- a/dlls/msi/tests/custom.c
+++ b/dlls/msi/tests/custom.c
@@ -106,9 +106,6 @@ static void check_prop(MSIHANDLE hinst, const char *prop, const char *expect)
static void test_props(MSIHANDLE hinst)
{
- static const WCHAR booW[] = {'b','o','o',0};
- static const WCHAR xyzW[] = {'x','y','z',0};
- static const WCHAR xyW[] = {'x','y',0};
char buffer[10];
WCHAR bufferW[10];
DWORD sz;
@@ -219,43 +216,43 @@ static void test_props(MSIHANDLE hinst)
ok(hinst, !strcmp(buffer, "xyz"), "got \"%s\"\n", buffer);
ok(hinst, sz == 3, "got size %u\n", sz);
- r = MsiGetPropertyW(hinst, booW, NULL, NULL);
+ r = MsiGetPropertyW(hinst, L"boo", NULL, NULL);
ok(hinst, !r, "got %u\n", r);
- r = MsiGetPropertyW(hinst, booW, bufferW, NULL );
+ r = MsiGetPropertyW(hinst, L"boo", bufferW, NULL );
ok(hinst, r == ERROR_INVALID_PARAMETER, "got %u\n", r);
sz = 0;
- r = MsiGetPropertyW(hinst, booW, NULL, &sz);
+ r = MsiGetPropertyW(hinst, L"boo", NULL, &sz);
ok(hinst, !r, "got %u\n", r);
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 0;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, booW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"boo"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 1;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 3;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"xy"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 4;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hinst, booW, bufferW, &sz);
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hinst, L"boo", bufferW, &sz);
ok(hinst, !r, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"xyz"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
r = MsiSetPropertyA(hinst, "boo", NULL);
@@ -566,9 +563,6 @@ UINT WINAPI nested(MSIHANDLE hinst)
static void test_targetpath(MSIHANDLE hinst)
{
- static const WCHAR targetdirW[] = {'T','A','R','G','E','T','D','I','R',0};
- static const WCHAR xyzW[] = {'C',':','\\',0};
- static const WCHAR xyW[] = {'C',':',0};
WCHAR bufferW[100];
char buffer[100];
DWORD sz, srcsz;
@@ -621,36 +615,36 @@ static void test_targetpath(MSIHANDLE hinst)
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 0;
- r = MsiGetTargetPathW(hinst, targetdirW, NULL, &sz);
+ r = MsiGetTargetPathW(hinst, L"TARGETDIR", NULL, &sz);
ok(hinst, !r, "got %u\n", r);
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 0;
bufferW[0] = 'q';
- r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 1;
bufferW[0] = 'q';
- r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 3;
bufferW[0] = 'q';
- r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"C:"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
sz = 4;
bufferW[0] = 'q';
- r = MsiGetTargetPathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetTargetPathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, !r, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"C:\\"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 3, "got size %u\n", sz);
r = MsiSetTargetPathA(hinst, NULL, "C:\\subdir");
@@ -684,7 +678,7 @@ static void test_targetpath(MSIHANDLE hinst)
* Seems to be a casualty of RPC... */
srcsz = 0;
- MsiGetSourcePathW(hinst, targetdirW, NULL, &srcsz);
+ MsiGetSourcePathW(hinst, L"TARGETDIR", NULL, &srcsz);
sz = 0;
r = MsiGetSourcePathA(hinst, "TARGETDIR", NULL, &sz);
@@ -720,34 +714,34 @@ static void test_targetpath(MSIHANDLE hinst)
ok(hinst, sz == srcsz, "got size %u\n", sz);
sz = 0;
- r = MsiGetSourcePathW(hinst, targetdirW, NULL, &sz);
+ r = MsiGetSourcePathW(hinst, L"TARGETDIR", NULL, &sz);
ok(hinst, !r, "got %u\n", r);
ok(hinst, sz == srcsz, "got size %u\n", sz);
sz = 0;
bufferW[0] = 'q';
- r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == srcsz, "got size %u\n", sz);
sz = 1;
bufferW[0] = 'q';
- r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == srcsz, "got size %u\n", sz);
sz = srcsz;
bufferW[0] = 'q';
- r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, lstrlenW(bufferW) == srcsz - 1, "wrong buffer length %d\n", lstrlenW(bufferW));
ok(hinst, sz == srcsz, "got size %u\n", sz);
sz = srcsz + 1;
bufferW[0] = 'q';
- r = MsiGetSourcePathW(hinst, targetdirW, bufferW, &sz);
+ r = MsiGetSourcePathW(hinst, L"TARGETDIR", bufferW, &sz);
ok(hinst, !r, "got %u\n", r);
ok(hinst, lstrlenW(bufferW) == srcsz, "wrong buffer length %d\n", lstrlenW(bufferW));
ok(hinst, sz == srcsz, "got size %u\n", sz);
@@ -870,8 +864,6 @@ static void test_feature_states(MSIHANDLE hinst)
static void test_format_record(MSIHANDLE hinst)
{
- static const WCHAR xyzW[] = {'f','o','o',' ','1','2','3',0};
- static const WCHAR xyW[] = {'f','o','o',' ','1','2',0};
WCHAR bufferW[10];
char buffer[10];
MSIHANDLE rec;
@@ -955,14 +947,14 @@ static void test_format_record(MSIHANDLE hinst)
bufferW[0] = 'q';
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"foo 12"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 7, "got size %u\n", sz);
sz = 8;
bufferW[0] = 'q';
r = MsiFormatRecordW(hinst, rec, bufferW, &sz);
ok(hinst, !r, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"foo 123"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 7, "got size %u\n", sz);
/* check that properties work */
@@ -979,9 +971,6 @@ static void test_format_record(MSIHANDLE hinst)
static void test_costs(MSIHANDLE hinst)
{
- static const WCHAR oneW[] = {'O','n','e',0};
- static const WCHAR xyzW[] = {'C',':',0};
- static const WCHAR xyW[] = {'C',0};
WCHAR bufferW[10];
char buffer[10];
int cost, temp;
@@ -1085,30 +1074,30 @@ static void test_costs(MSIHANDLE hinst)
sz = 0;
bufferW[0] = 'q';
- r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
+ r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, bufferW[0] == 'q', "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 2, "got size %u\n", sz);
sz = 1;
bufferW[0] = 'q';
- r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
+ r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
ok(hinst, !bufferW[0], "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 2, "got size %u\n", sz);
sz = 2;
bufferW[0] = 'q';
- r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
+ r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
ok(hinst, r == ERROR_MORE_DATA, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"C"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 2, "got size %u\n", sz);
sz = 3;
bufferW[0] = 'q';
- r = MsiEnumComponentCostsW(hinst, oneW, 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
+ r = MsiEnumComponentCostsW(hinst, L"One", 0, INSTALLSTATE_LOCAL, bufferW, &sz, &cost, &temp);
ok(hinst, !r, "got %u\n", r);
- ok(hinst, !lstrcmpW(bufferW, xyzW), "got %s\n", dbgstr_w(bufferW));
+ ok(hinst, !lstrcmpW(bufferW, L"C:"), "got %s\n", dbgstr_w(bufferW));
ok(hinst, sz == 2, "got size %u\n", sz);
}
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 3e1c551d38f..4ffd30f0376 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -33,8 +33,8 @@
static const char *msifile = "winetest-db.msi";
static const char *msifile2 = "winetst2-db.msi";
static const char *mstfile = "winetst-db.mst";
-static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','-','d','b','.','m','s','i',0};
-static const WCHAR msifile2W[] = {'w','i','n','e','t','s','t','2','-','d','b','.','m','s','i',0};
+static const WCHAR msifileW[] = L"winetest-db.msi";
+static const WCHAR msifile2W[] = L"winetst2-db.msi";
static void WINAPIV check_record_(int line, MSIHANDLE rec, UINT count, ...)
{
@@ -1428,7 +1428,7 @@ static void test_msiexport(void)
static void test_longstrings(void)
{
- const char insert_query[] =
+ const char insert_query[] =
"INSERT INTO `strings` ( `id`, `val` ) VALUES('1', 'Z')";
char *str;
MSIHANDLE hdb = 0, hview = 0, hrec = 0;
@@ -1442,7 +1442,7 @@ static void test_longstrings(void)
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
/* create a table */
- r = try_query( hdb,
+ r = try_query( hdb,
"CREATE TABLE `strings` ( `id` INT, `val` CHAR(0) PRIMARY KEY `id`)");
ok(r == ERROR_SUCCESS, "query failed\n");
@@ -1507,7 +1507,7 @@ static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
}
#define create_file(name) create_file_data(name, name, 0)
-
+
static void test_streamtable(void)
{
MSIHANDLE hdb = 0, rec, view, hsi;
@@ -2740,7 +2740,7 @@ static void test_handle_limit(void)
static char szQueryBuf[256] = "SELECT * from `_Tables`";
hviews[i] = 0xdeadbeeb;
r = MsiDatabaseOpenViewA(hdb, szQueryBuf, &hviews[i]);
- if( r != ERROR_SUCCESS || hviews[i] == 0xdeadbeeb ||
+ if( r != ERROR_SUCCESS || hviews[i] == 0xdeadbeeb ||
hviews[i] == 0 || (i && (hviews[i] == hviews[i-1])))
break;
}
@@ -4776,34 +4776,6 @@ static void test_rows_order(void)
static void test_collation(void)
{
- static const WCHAR query1[] =
- {'I','N','S','E','R','T',' ','I','N','T','O',' ','`','b','a','r','`',' ',
- '(','`','f','o','o','`',',','`','b','a','z','`',')',' ','V','A','L','U','E','S',' ',
- '(','\'','a',0x30a,'\'',',','\'','C','\'',')',0};
- static const WCHAR query2[] =
- {'I','N','S','E','R','T',' ','I','N','T','O',' ','`','b','a','r','`',' ',
- '(','`','f','o','o','`',',','`','b','a','z','`',')',' ','V','A','L','U','E','S',' ',
- '(','\'',0xe5,'\'',',','\'','D','\'',')',0};
- static const WCHAR query3[] =
- {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','b','a','z','`',' ',
- '(',' ','`','a',0x30a,'`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ','N','U','L','L',',',
- ' ','`',0xe5,'`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ','N','U','L','L',' ',
- 'P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','a',0x30a,'`',')',0};
- static const WCHAR query4[] =
- {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','a',0x30a,'`',' ',
- '(',' ','`','f','o','o','`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ',
- 'N','U','L','L',' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','f','o','o','`',')',0};
- static const WCHAR query5[] =
- {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`',0xe5,'`',' ',
- '(',' ','`','f','o','o','`',' ','L','O','N','G','C','H','A','R',' ','N','O','T',' ',
- 'N','U','L','L',' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ','`','f','o','o','`',')',0};
- static const WCHAR query6[] =
- {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','b','a','r','`',' ','W','H','E','R','E',
- ' ','`','f','o','o','`',' ','=','\'',0xe5,'\'',0};
- static const WCHAR letter_C[] = {'C',0};
- static const WCHAR letter_D[] = {'D',0};
- static const WCHAR letter_a_ring[] = {'a',0x30a,0};
- static const WCHAR letter_a_with_ring[] = {0xe5,0};
const char *query;
MSIHANDLE hdb = 0, hview = 0, hrec = 0;
UINT r;
@@ -4832,19 +4804,19 @@ static void test_collation(void)
"( `foo`, `baz` ) VALUES ( '\1', 'B' )");
ok(r == ERROR_SUCCESS, "cannot add value to table %u\n", r);
- r = run_queryW(hdb, 0, query1);
+ r = run_queryW(hdb, 0, L"INSERT INTO `bar` (`foo`,`baz`) VALUES ('a\x30a','C')");
ok(r == ERROR_SUCCESS, "cannot add value to table %u\n", r);
- r = run_queryW(hdb, 0, query2);
+ r = run_queryW(hdb, 0, L"INSERT INTO `bar` (`foo`,`baz`) VALUES ('\xe5','D')");
ok(r == ERROR_SUCCESS, "cannot add value to table %u\n", r);
- r = run_queryW(hdb, 0, query3);
+ r = run_queryW(hdb, 0, L"CREATE TABLE `baz` ( `a\x30a` LONGCHAR NOT NULL, `\xe5` LONGCHAR NOT NULL PRIMARY KEY `a\x30a`)");
ok(r == ERROR_SUCCESS, "cannot create table %u\n", r);
- r = run_queryW(hdb, 0, query4);
+ r = run_queryW(hdb, 0, L"CREATE TABLE `a\x30a` ( `foo` LONGCHAR NOT NULL PRIMARY KEY `foo`)");
ok(r == ERROR_SUCCESS, "cannot create table %u\n", r);
- r = run_queryW(hdb, 0, query5);
+ r = run_queryW(hdb, 0, L"CREATE TABLE `\xe5` ( `foo` LONGCHAR NOT NULL PRIMARY KEY `foo`)");
ok(r == ERROR_SUCCESS, "cannot create table %u\n", r);
query = "SELECT * FROM `bar`";
@@ -4882,12 +4854,12 @@ static void test_collation(void)
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!memcmp(bufferW, letter_a_ring, sizeof(letter_a_ring)),
- "Expected %s, got %s\n", wine_dbgstr_w(letter_a_ring), wine_dbgstr_w(bufferW));
+ ok(!memcmp(bufferW, L"a\x30a", sizeof(L"a\x30a")),
+ "Expected %s, got %s\n", wine_dbgstr_w(L"a\x30a"), wine_dbgstr_w(bufferW));
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpW(bufferW, letter_C), "Expected C, got %s\n", wine_dbgstr_w(bufferW));
+ ok(!lstrcmpW(bufferW, L"C"), "Expected C, got %s\n", wine_dbgstr_w(bufferW));
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
@@ -4895,12 +4867,12 @@ static void test_collation(void)
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)),
- "Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW));
+ ok(!memcmp(bufferW, L"\xe5", sizeof(L"\xe5")),
+ "Expected %s, got %s\n", wine_dbgstr_w(L"\xe5"), wine_dbgstr_w(bufferW));
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
+ ok(!lstrcmpW(bufferW, L"D"), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
MsiCloseHandle(hrec);
r = MsiViewClose(hview);
@@ -4908,7 +4880,7 @@ static void test_collation(void)
r = MsiCloseHandle(hview);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
- r = MsiDatabaseOpenViewW(hdb, query6, &hview);
+ r = MsiDatabaseOpenViewW(hdb, L"SELECT * FROM `bar` WHERE `foo` ='\xe5'", &hview);
ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
r = MsiViewExecute(hview, 0);
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
@@ -4918,12 +4890,12 @@ static void test_collation(void)
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)),
- "Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW));
+ ok(!memcmp(bufferW, L"\xe5", sizeof(L"\xe5")),
+ "Expected %s, got %s\n", wine_dbgstr_w(L"\xe5"), wine_dbgstr_w(bufferW));
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
+ ok(!lstrcmpW(bufferW, L"D"), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
@@ -7539,7 +7511,6 @@ static void test_droptable(void)
static void test_dbmerge(void)
{
- static const WCHAR refdbW[] = {'r','e','f','d','b','.','m','s','i',0};
MSIHANDLE hdb, href, hview, hrec;
CHAR buf[MAX_PATH];
LPCSTR query;
@@ -7549,7 +7520,7 @@ static void test_dbmerge(void)
r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_CREATE, &hdb);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- r = MsiOpenDatabaseW(refdbW, MSIDBOPEN_CREATE, &href);
+ r = MsiOpenDatabaseW(L"refdb.msi", MSIDBOPEN_CREATE, &href);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
/* hDatabase is invalid */
@@ -8090,7 +8061,7 @@ static void test_dbmerge(void)
MsiCloseHandle(hdb);
MsiCloseHandle(href);
DeleteFileA(msifile);
- DeleteFileW(refdbW);
+ DeleteFileW(L"refdb.msi");
DeleteFileA("codepage.idt");
DeleteFileA("binary.dat");
}
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 2cfa810e1da..ce650b84d61 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -59,8 +59,8 @@ static const char *msifile = "msitest.msi";
static const char *msifile2 = "winetest2.msi";
static const char *mstfile = "winetest.mst";
-static const WCHAR msifileW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
-static const WCHAR msifile2W[] = {'w','i','n','e','t','e','s','t','2','.','m','s','i',0};
+static const WCHAR msifileW[] = L"msitest.msi";
+static const WCHAR msifile2W[] = L"msitest2.msi";
char CURR_DIR[MAX_PATH];
char PROG_FILES_DIR[MAX_PATH];
@@ -2209,7 +2209,7 @@ static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *
{
HANDLE handle = (HANDLE)hf;
DWORD ret;
-
+
ret = SetFilePointer(handle, dist, NULL, seektype);
ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
@@ -3995,11 +3995,6 @@ static void set_admin_property_stream(LPCSTR file)
DWORD count;
const DWORD mode = STGM_DIRECT | STGM_READWRITE | STGM_SHARE_EXCLUSIVE;
- /* AdminProperties */
- static const WCHAR stmname[] = {0x41ca,0x4330,0x3e71,0x44b5,0x4233,0x45f5,0x422c,0x4836,0};
- static const WCHAR data[] = {'M','Y','P','R','O','P','=','2','7','1','8',' ',
- 'M','y','P','r','o','p','=','4','2',0};
-
MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, MAX_PATH);
hr = StgOpenStorage(fileW, NULL, mode, NULL, 0, &stg);
@@ -4007,10 +4002,11 @@ static void set_admin_property_stream(LPCSTR file)
if (!stg)
return;
- hr = IStorage_CreateStream(stg, stmname, STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
+ hr = IStorage_CreateStream(stg, L"\x41ca\x4330\x3e71\x44b5\x4233\x45f5\x422c\x4836",
+ STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
- hr = IStream_Write(stm, data, sizeof(data), &count);
+ hr = IStream_Write(stm, L"MYPROP=2718 MyProp=42", sizeof(L"MYPROP=2718 MyProp=42"), &count);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
IStream_Release(stm);
@@ -4983,9 +4979,6 @@ error:
static void test_int_widths( void )
{
- static const WCHAR msitestW[] = {'m','s','i','t','e','s','t','.','m','s','i',0};
- static const WCHAR msitableW[] = {'m','s','i','t','a','b','l','e','.','i','d','t',0};
- static const WCHAR slashW[] = {'\\',0};
static const char int0[] = "int0\ni0\nint0\tint0\n1";
static const char int1[] = "int1\ni1\nint1\tint1\n1";
static const char int2[] = "int2\ni2\nint2\tint2\n1";
@@ -5017,12 +5010,10 @@ static void test_int_widths( void )
CreateDirectoryW(tmpdir, NULL);
lstrcpyW(msitable, tmpdir);
- lstrcatW(msitable, slashW);
- lstrcatW(msitable, msitableW);
+ lstrcatW(msitable, L"\\msitable.idt");
lstrcpyW(msidb, tmpdir);
- lstrcatW(msidb, slashW);
- lstrcatW(msidb, msitestW);
+ lstrcatW(msidb, L"\\msitest.msi");
r = MsiOpenDatabaseW(msidb, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
@@ -5035,7 +5026,7 @@ static void test_int_widths( void )
WriteFile(handle, tests[i].data, tests[i].size, &count, NULL);
CloseHandle(handle);
- r = MsiDatabaseImportW(db, tmpdir, msitableW);
+ r = MsiDatabaseImportW(db, tmpdir, L"msitable.idt");
ok(r == tests[i].ret, " %u expected %u, got %u\n", i, tests[i].ret, r);
r = MsiDatabaseCommit(db);
diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c
index eb547c98dce..5e0fa680c89 100644
--- a/dlls/msi/tests/msi.c
+++ b/dlls/msi/tests/msi.c
@@ -39,7 +39,7 @@
static BOOL is_wow64;
static const char msifile[] = "winetest.msi";
-static const WCHAR msifileW[] = {'w','i','n','e','t','e','s','t','.','m','s','i',0};
+static const WCHAR msifileW[] = L"winetest.msi";
static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
@@ -892,19 +892,19 @@ static void test_usefeature(void)
r = pMsiUseFeatureExA(NULL, "WORDVIEWFiles", -2, 1 );
ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
- r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
+ r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
NULL, -2, 0 );
ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
- r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
+ r = pMsiUseFeatureExA("{9085040-6000-11d3-8cfe-0150048383c9}",
"WORDVIEWFiles", -2, 0 );
ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
- r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
+ r = pMsiUseFeatureExA("{0085040-6000-11d3-8cfe-0150048383c9}",
"WORDVIEWFiles", -2, 0 );
ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
- r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
+ r = pMsiUseFeatureExA("{90850409-6000-11d3-8cfe-0150048383c9}",
"WORDVIEWFiles", -2, 1 );
ok( r == INSTALLSTATE_INVALIDARG, "wrong return val\n");
}
@@ -3379,14 +3379,6 @@ static void test_MsiGetComponentPathEx(void)
static void test_MsiProvideComponent(void)
{
- static const WCHAR sourcedirW[] =
- {'s','o','u','r','c','e','d','i','r',0};
- static const WCHAR productW[] =
- {'{','3','8','8','4','7','3','3','8','-','1','B','B','C','-','4','1','0','4','-',
- '8','1','A','C','-','2','F','A','A','C','7','E','C','D','D','C','D','}',0};
- static const WCHAR componentW[] =
- {'{','D','D','4','2','2','F','9','2','-','3','E','D','8','-','4','9','B','5','-',
- 'A','0','B','7','-','F','2','6','6','F','9','8','3','5','7','D','F','}',0};
INSTALLSTATE state;
char buf[0x100];
WCHAR bufW[0x100];
@@ -3445,21 +3437,21 @@ static void test_MsiProvideComponent(void)
bufW[0] = 0;
len = sizeof(buf);
- r = pMsiProvideComponentW(productW, sourcedirW, componentW,
- INSTALLMODE_NODETECTION, bufW, &len);
+ r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir",
+ L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len);
ok(r == ERROR_SUCCESS, "got %u\n", r);
ok(bufW[0], "empty path\n");
ok(len == lstrlenW(bufW), "got %u\n", len);
len2 = 0;
- r = pMsiProvideComponentW(productW, sourcedirW, componentW,
- INSTALLMODE_NODETECTION, NULL, &len2);
+ r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir",
+ L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, NULL, &len2);
ok(r == ERROR_SUCCESS, "got %u\n", r);
ok(len2 == len, "got %u\n", len2);
len2 = 0;
- r = pMsiProvideComponentW(productW, sourcedirW, componentW,
- INSTALLMODE_NODETECTION, bufW, &len2);
+ r = pMsiProvideComponentW(L"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}", L"sourcedir",
+ L"{DD422F92-3ED8-49B5-A0B7-F266F98357DF}", INSTALLMODE_NODETECTION, bufW, &len2);
ok(r == ERROR_MORE_DATA, "got %u\n", r);
ok(len2 == len, "got %u\n", len2);
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index bf83c116fff..f8bf431883b 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -35,8 +35,7 @@
static BOOL is_wow64;
static const char msifile[] = "winetest-package.msi";
-static const WCHAR msifileW[] =
- {'w','i','n','e','t','e','s','t','-','p','a','c','k','a','g','e','.','m','s','i',0};
+static const WCHAR msifileW[] = L"winetest-package.msi";
static char CURR_DIR[MAX_PATH];
static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD);
@@ -1137,8 +1136,6 @@ static void test_doaction( void )
static void test_gettargetpath_bad(void)
{
- static const WCHAR boo[] = {'b','o','o',0};
- static const WCHAR empty[] = {0};
char buffer[0x80];
WCHAR bufferW[0x80];
MSIHANDLE hpkg;
@@ -1182,20 +1179,20 @@ static void test_gettargetpath_bad(void)
r = MsiGetTargetPathW( 0, NULL, NULL, &sz );
ok( r == ERROR_INVALID_PARAMETER, "wrong return val\n");
- r = MsiGetTargetPathW( 0, boo, NULL, NULL );
+ r = MsiGetTargetPathW( 0, L"boo", NULL, NULL );
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
- r = MsiGetTargetPathW( 0, boo, NULL, NULL );
+ r = MsiGetTargetPathW( 0, L"boo", NULL, NULL );
ok( r == ERROR_INVALID_HANDLE, "wrong return val\n");
- r = MsiGetTargetPathW( hpkg, boo, NULL, NULL );
+ r = MsiGetTargetPathW( hpkg, L"boo", NULL, NULL );
ok( r == ERROR_DIRECTORY, "wrong return val\n");
- r = MsiGetTargetPathW( hpkg, boo, bufferW, NULL );
+ r = MsiGetTargetPathW( hpkg, L"boo", bufferW, NULL );
ok( r == ERROR_DIRECTORY, "wrong return val\n");
sz = 0;
- r = MsiGetTargetPathW( hpkg, empty, bufferW, &sz );
+ r = MsiGetTargetPathW( hpkg, L"", bufferW, &sz );
ok( r == ERROR_DIRECTORY, "wrong return val\n");
MsiCloseHandle( hpkg );
@@ -1391,10 +1388,6 @@ static void test_settargetpath(void)
static void test_condition(void)
{
- static const WCHAR cond1[] = {'\"','a',0x30a,'\"','<','\"',0xe5,'\"',0};
- static const WCHAR cond2[] = {'\"','a',0x30a,'\"','>','\"',0xe5,'\"',0};
- static const WCHAR cond3[] = {'\"','a',0x30a,'\"','<','>','\"',0xe5,'\"',0};
- static const WCHAR cond4[] = {'\"','a',0x30a,'\"','=','\"',0xe5,'\"',0};
MSICONDITION r;
MSIHANDLE hpkg;
@@ -2126,19 +2119,19 @@ static void test_condition(void)
r = MsiEvaluateConditionA(hpkg, "A <= X");
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
- r = MsiEvaluateConditionW(hpkg, cond1);
+ r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<\"\xe5\"");
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
"wrong return val (%d)\n", r);
- r = MsiEvaluateConditionW(hpkg, cond2);
+ r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\">\"\xe5\"");
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
"wrong return val (%d)\n", r);
- r = MsiEvaluateConditionW(hpkg, cond3);
+ r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"<>\"\xe5\"");
ok( r == MSICONDITION_TRUE || broken(r == MSICONDITION_FALSE),
"wrong return val (%d)\n", r);
- r = MsiEvaluateConditionW(hpkg, cond4);
+ r = MsiEvaluateConditionW(hpkg, L"\"a\x30a\"=\"\xe5\"");
ok( r == MSICONDITION_FALSE || broken(r == MSICONDITION_TRUE),
"wrong return val (%d)\n", r);
@@ -2161,9 +2154,6 @@ static void check_prop(MSIHANDLE hpkg, const char *prop, const char *expect, int
static void test_props(void)
{
- static const WCHAR booW[] = {'b','o','o',0};
- static const WCHAR xyzW[] = {'x','y','z',0};
- static const WCHAR xyW[] = {'x','y',0};
MSIHANDLE hpkg, hdb;
UINT r;
DWORD sz;
@@ -2296,36 +2286,36 @@ static void test_props(void)
ok(sz == 3, "got size %u\n", sz);
sz = 0;
- r = MsiGetPropertyW(hpkg, booW, NULL, &sz);
+ r = MsiGetPropertyW(hpkg, L"boo", NULL, &sz);
ok(!r, "got %u\n", r);
ok(sz == 3, "got size %u\n", sz);
sz = 0;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hpkg, booW, bufferW, &sz);
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz);
ok(r == ERROR_MORE_DATA, "got %u\n", r);
- ok(!lstrcmpW(bufferW, booW), "got %s\n", wine_dbgstr_w(bufferW));
+ ok(!lstrcmpW(bufferW, L"boo"), "got %s\n", wine_dbgstr_w(bufferW));
ok(sz == 3, "got size %u\n", sz);
sz = 1;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hpkg, booW, bufferW, &sz );
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz );
ok(r == ERROR_MORE_DATA, "got %u\n", r);
ok(!bufferW[0], "got %s\n", wine_dbgstr_w(bufferW));
ok(sz == 3, "got size %u\n", sz);
sz = 3;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hpkg, booW, bufferW, &sz );
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz );
ok(r == ERROR_MORE_DATA, "got %u\n", r);
- ok(!lstrcmpW(bufferW, xyW), "got %s\n", wine_dbgstr_w(bufferW));
+ ok(!lstrcmpW(bufferW, L"xy"), "got %s\n", wine_dbgstr_w(bufferW));
ok(sz == 3, "got size %u\n", sz);
sz = 4;
- lstrcpyW(bufferW, booW);
- r = MsiGetPropertyW(hpkg, booW, bufferW, &sz );
+ lstrcpyW(bufferW, L"boo");
+ r = MsiGetPropertyW(hpkg, L"boo", bufferW, &sz );
ok(!r, "got %u\n", r);
- ok(!lstrcmpW(bufferW, xyzW), "got %s\n", wine_dbgstr_w(bufferW));
+ ok(!lstrcmpW(bufferW, L"xyz"), "got %s\n", wine_dbgstr_w(bufferW));
ok(sz == 3, "got size %u\n", sz);
/* properties are case-sensitive */
@@ -3074,12 +3064,9 @@ static void test_states(void)
static const char msifile2[] = "winetest2-package.msi";
static const char msifile3[] = "winetest3-package.msi";
static const char msifile4[] = "winetest4-package.msi";
- static const WCHAR msifile2W[] =
- {'w','i','n','e','t','e','s','t','2','-','p','a','c','k','a','g','e','.','m','s','i',0};
- static const WCHAR msifile3W[] =
- {'w','i','n','e','t','e','s','t','3','-','p','a','c','k','a','g','e','.','m','s','i',0};
- static const WCHAR msifile4W[] =
- {'w','i','n','e','t','e','s','t','4','-','p','a','c','k','a','g','e','.','m','s','i',0};
+ static const WCHAR msifile2W[] = L"winetest2-package.msi";
+ static const WCHAR msifile3W[] = L"winetest3-package.msi";
+ static const WCHAR msifile4W[] = L"winetest4-package.msi";
char msi_cache_file[MAX_PATH];
DWORD cache_file_name_len;
INSTALLSTATE state;
@@ -4011,7 +3998,7 @@ static void test_removefiles(void)
ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
ok(DeleteFileA("hydrogen.txt"), "Expected hydrogen.txt to exist\n");
- ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
+ ok(DeleteFileA("lithium.txt"), "Expected lithium.txt to exist\n");
ok(DeleteFileA("beryllium.txt"), "Expected beryllium.txt to exist\n");
ok(DeleteFileA("carbon.txt"), "Expected carbon.txt to exist\n");
ok(DeleteFileA("helium.txt"), "Expected helium.txt to exist\n");
@@ -7959,11 +7946,6 @@ static void test_emptypackage(void)
static void test_MsiGetProductProperty(void)
{
- static const WCHAR prodcode_propW[] = {'P','r','o','d','u','c','t','C','o','d','e',0};
- static const WCHAR nonexistentW[] = {'I','D','o','n','t','E','x','i','s','t',0};
- static const WCHAR newpropW[] = {'N','e','w','P','r','o','p','e','r','t','y',0};
- static const WCHAR appleW[] = {'a','p','p','l','e',0};
- static const WCHAR emptyW[] = {0};
WCHAR valW[MAX_PATH];
MSIHANDLE hprod, hdb;
CHAR val[MAX_PATH];
@@ -8069,11 +8051,11 @@ static void test_MsiGetProductProperty(void)
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(0xdeadbeef, prodcode_propW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(0xdeadbeef, L"ProductCode", valW, &size);
ok(r == ERROR_INVALID_HANDLE,
"Expected ERROR_INVALID_HANDLE, got %d\n", r);
- ok(!lstrcmpW(valW, appleW),
+ ok(!lstrcmpW(valW, L"apple"),
"Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW));
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
@@ -8088,11 +8070,11 @@ static void test_MsiGetProductProperty(void)
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
+ lstrcpyW(valW, L"apple");
r = MsiGetProductPropertyW(hprod, NULL, valW, &size);
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
- ok(!lstrcmpW(valW, appleW),
+ ok(!lstrcmpW(valW, L"apple"),
"Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW));
ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size);
@@ -8105,8 +8087,8 @@ static void test_MsiGetProductProperty(void)
ok(size == 0, "Expected 0, got %d\n", size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, emptyW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"", valW, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(*valW == 0, "Expected \"\", got %s\n", wine_dbgstr_w(valW));
ok(size == 0, "Expected 0, got %d\n", size);
@@ -8122,8 +8104,8 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %d\n", lstrlenA(prodcode), size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpW(valW, prodcodeW),
"Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
@@ -8138,7 +8120,7 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %d\n", lstrlenA(prodcode), size);
size = MAX_PATH;
- r = MsiGetProductPropertyW(hprod, prodcode_propW, NULL, &size);
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", NULL, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(size == lstrlenW(prodcodeW),
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
@@ -8153,11 +8135,11 @@ static void test_MsiGetProductProperty(void)
ok(size == lstrlenA(prodcode),
"Expected %d, got %d\n", lstrlenA(prodcode), size);
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, NULL);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, NULL);
ok(r == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %d\n", r);
- ok(!lstrcmpW(valW, appleW),
+ ok(!lstrcmpW(valW, L"apple"),
"Expected val to be unchanged, got %s\n", wine_dbgstr_w(valW));
ok(size == lstrlenW(prodcodeW),
"Expected %d, got %d\n", lstrlenW(prodcodeW), size);
@@ -8173,8 +8155,8 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %d\n", lstrlenA(prodcode), size);
size = 4;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size);
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
ok(!memcmp(valW, prodcodeW, 3 * sizeof(WCHAR)),
"Expected first 3 chars of %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
@@ -8192,8 +8174,8 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %d\n", lstrlenA(prodcode), size);
size = lstrlenW(prodcodeW);
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size);
ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r);
ok(!memcmp(valW, prodcodeW, lstrlenW(prodcodeW) - 1),
"Expected first 37 chars of %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
@@ -8211,8 +8193,8 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %d\n", lstrlenA(prodcode), size);
size = lstrlenW(prodcodeW) + 1;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpW(valW, prodcodeW),
"Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
@@ -8228,10 +8210,10 @@ static void test_MsiGetProductProperty(void)
ok(size == 0, "Expected 0, got %d\n", size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, nonexistentW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"IDontExist", valW, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpW(valW, emptyW), "Expected \"\", got %s\n", wine_dbgstr_w(valW));
+ ok(!lstrcmpW(valW, L""), "Expected \"\", got %s\n", wine_dbgstr_w(valW));
ok(size == 0, "Expected 0, got %d\n", size);
r = MsiSetPropertyA(hprod, "NewProperty", "value");
@@ -8246,10 +8228,10 @@ static void test_MsiGetProductProperty(void)
ok(size == 0, "Expected 0, got %d\n", size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, newpropW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"NewProperty", valW, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
- ok(!lstrcmpW(valW, emptyW), "Expected \"\", got %s\n", wine_dbgstr_w(valW));
+ ok(!lstrcmpW(valW, L""), "Expected \"\", got %s\n", wine_dbgstr_w(valW));
ok(size == 0, "Expected 0, got %d\n", size);
r = MsiSetPropertyA(hprod, "ProductCode", "value");
@@ -8266,8 +8248,8 @@ static void test_MsiGetProductProperty(void)
"Expected %d, got %d\n", lstrlenA(prodcode), size);
size = MAX_PATH;
- lstrcpyW(valW, appleW);
- r = MsiGetProductPropertyW(hprod, prodcode_propW, valW, &size);
+ lstrcpyW(valW, L"apple");
+ r = MsiGetProductPropertyW(hprod, L"ProductCode", valW, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpW(valW, prodcodeW),
"Expected %s, got %s\n", wine_dbgstr_w(prodcodeW), wine_dbgstr_w(valW));
diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c
index 87f64d6c835..65b3a5f1d48 100644
--- a/dlls/msi/tests/patch.c
+++ b/dlls/msi/tests/patch.c
@@ -39,10 +39,8 @@ static UINT (WINAPI *pMsiEnumPatchesExA)( LPCSTR, LPCSTR, DWORD, DWORD, DWORD, L
static const char *msifile = "winetest-patch.msi";
static const char *mspfile = "winetest-patch.msp";
-static const WCHAR msifileW[] =
- {'w','i','n','e','t','e','s','t','-','p','a','t','c','h','.','m','s','i',0};
-static const WCHAR mspfileW[] =
- {'w','i','n','e','t','e','s','t','-','p','a','t','c','h','.','m','s','p',0};
+static const WCHAR msifileW[] = L"winetest-patch.msi";
+static const WCHAR mspfileW[] = L"winetest-patch.msp";
static char CURR_DIR[MAX_PATH];
static char PROG_FILES_DIR[MAX_PATH];
@@ -1001,14 +999,11 @@ static UINT find_entry( MSIHANDLE hdb, const char *table, const char *entry )
static UINT find_entryW( MSIHANDLE hdb, const WCHAR *table, const WCHAR *entry )
{
- static const WCHAR fmt[] =
- {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','%','s','`',' ',
- 'W','H','E','R','E',' ','`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
WCHAR query[0x100];
MSIHANDLE hview, hrec;
UINT r;
- wsprintfW( query, fmt, table, entry );
+ wsprintfW( query, L"SELECT * FROM `%s` WHERE `Name` = '%s'", table, entry );
r = MsiDatabaseOpenViewW( hdb, query, &hview );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
@@ -1086,8 +1081,6 @@ static char *get_string( MSIHANDLE hdb, UINT field, const char *query)
static void test_system_tables( void )
{
static const char patchsource[] = "MSPSRC0F96CDC04CDF4304B2837B9264889EF7";
- static const WCHAR streamsW[] = {'_','S','t','r','e','a','m','s',0};
- static const WCHAR CAB_msitest_encodedW[] = {0x3a8c,0x47cb,0x45b0,0x45ec,0x45a8,0x4837,0};
UINT r;
char *cr;
const char *query;
@@ -1193,7 +1186,7 @@ static void test_system_tables( void )
r = find_entry( hdb, "_Streams", "\5SummaryInformation" );
ok( r == ERROR_SUCCESS, "failed to find entry %u\n", r );
- r = find_entryW( hdb, streamsW, CAB_msitest_encodedW );
+ r = find_entryW( hdb, L"_Streams", L"\x3a8c\x47cb\x45b0\x45ec\x45a8\x4837" );
ok( r == ERROR_NO_MORE_ITEMS, "failed to find entry %u\n", r );
query = "SELECT * FROM `_Storages`";
diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c
index d0ad15b8fef..8e4c2df4294 100644
--- a/dlls/msi/tests/record.c
+++ b/dlls/msi/tests/record.c
@@ -25,8 +25,7 @@
#include "wine/test.h"
static const char *msifile = "winetest-record.msi";
-static const WCHAR msifileW[] =
- {'w','i','n','e','t','e','s','t','-','r','e','c','o','r','d','.','m','s','i',0};
+static const WCHAR msifileW[] = L"winetest-record.msi";
static BOOL create_temp_file(char *name)
{
@@ -34,7 +33,7 @@ static BOOL create_temp_file(char *name)
unsigned char buffer[26], i;
DWORD sz;
HANDLE handle;
-
+
r = GetTempFileNameA(".", "msitest",0,name);
if(!r)
return r;
@@ -338,7 +337,7 @@ static void test_msirecord(void)
ok(r == ERROR_SUCCESS, "Failed to close handle\n");
/* now try streams in a new record - need to create a file to play with */
- r = create_temp_file(filename);
+ r = create_temp_file(filename);
if(!r)
return;
diff --git a/dlls/msi/tests/suminfo.c b/dlls/msi/tests/suminfo.c
index 8c2e292ab8f..1ef18310206 100644
--- a/dlls/msi/tests/suminfo.c
+++ b/dlls/msi/tests/suminfo.c
@@ -64,8 +64,7 @@
#define PID_MSIRESTRICT PID_CHARCOUNT
static const char *msifile = "winetest-suminfo.msi";
-static const WCHAR msifileW[] = {
- 'w','i','n','e','t','e','s','t','-','s','u','m','i','n','f','o','.','m','s','i',0 };
+static const WCHAR msifileW[] = L"winetest-suminfo.msi";
static void test_suminfo(void)
{
--
2.28.0
1
0