Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
Re: [PATCH 2/7] wsdapi: Add critical section around notification sinks.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
June 14, 2018
Re: [PATCH 1/7] wsdapi: Add support for listening for UDP multicast broadcasts.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
June 14, 2018
Re: [PATCH 2/4] ntdll: Report logical cores per physical core through mask.
by Roderick Colenbrander
Please still review the series for overall. I just realized though the
code can be slightly simplified if I still submit 'core_id' to
logical_proc_info_add_by_id. The lookup code within that function
doesn't have to parse the masks (ProcessorMask or GroupMask[0]) and it
is cleaner and more future proof that way.
Thanks,
Roderick
On Wed, Jun 13, 2018 at 10:48 PM, Roderick Colenbrander
<thunderbird2k(a)gmail.com> wrote:
> Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com>
> ---
> dlls/ntdll/nt.c | 28 ++++++++++++++++++++++------
> 1 file changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
> index e6458b98f2..0b69f7de44 100644
> --- a/dlls/ntdll/nt.c
> +++ b/dlls/ntdll/nt.c
> @@ -1325,8 +1325,16 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
> (*pdata)[i].ProcessorMask |= mask;
> return TRUE;
> }
> - }else
> - i = *len;
> + }
> + else
> + {
> + for(i=0; i<*len; i++)
> + {
> + if ((*pdata)[i].Relationship==rel && (*pdata)[i].ProcessorMask==mask &&
> + (*pdata)[i].u.Reserved[1]==id)
> + return TRUE;
> + }
> + }
>
> while(*len == *pmax_len)
> {
> @@ -1352,6 +1360,11 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
> dataex->u.Processor.GroupMask[0].Mask |= mask;
> return TRUE;
> }
> + else if (rel == RelationProcessorCore && dataex->Relationship == rel &&
> + dataex->u.Processor.GroupMask[0].Mask == mask && dataex->u.Processor.Reserved[1] == id)
> + {
> + return TRUE;
> + }
> ofs += dataex->Size;
> }
>
> @@ -1548,6 +1561,8 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
>
> for(i=beg; i<=end; i++)
> {
> + ULONG_PTR thread_mask = 0;
> +
> if(i > 8*sizeof(ULONG_PTR))
> {
> FIXME("skipping logical processor %d\n", i);
> @@ -1568,15 +1583,16 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
> return STATUS_NO_MEMORY;
> }
>
> - sprintf(name, core_info, i, "core_id");
> + /* Mask of logical threads sharing same physical core. */
> + sprintf(name, core_info, i, "thread_siblings");
> f = fopen(name, "r");
> if(f)
> {
> - fscanf(f, "%u", &r);
> + fscanf(f, "%lx", &thread_mask);
> fclose(f);
> }
> - else r = i;
> - if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, r, (ULONG_PTR)1 << i))
> + else thread_mask = 1<<i;
> + if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, r, thread_mask))
> {
> fclose(fcpu_list);
> return STATUS_NO_MEMORY;
> --
> 2.14.4
>
June 14, 2018
[PATCH 4/4] ntdll: GetLogicalProcessorInformation report LPT_PC_SMT for SMT cores.
by Roderick Colenbrander
Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com>
---
dlls/ntdll/nt.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 9d50ad1891..f866091c38 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1355,7 +1355,8 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
(*pdata)[i].Relationship = rel;
(*pdata)[i].ProcessorMask = mask;
- /* TODO: set processor core flags */
+ if (rel == RelationProcessorCore)
+ (*pdata)[i].u.ProcessorCore.Flags = count_bits(mask) > 1 ? LTP_PC_SMT : 0;
(*pdata)[i].u.Reserved[0] = 0;
(*pdata)[i].u.Reserved[1] = id;
*len = i+1;
--
2.14.4
June 14, 2018
[PATCH 3/4] ntdll: GetLogicalProcessorInformationEx report LTP_PC_SMT for SMT cores.
by Roderick Colenbrander
Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com>
---
dlls/ntdll/nt.c | 27 +++++++++++++++------------
include/winnt.h | 2 ++
2 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 0b69f7de44..9d50ad1891 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1309,6 +1309,17 @@ static DWORD log_proc_ex_size_plus(DWORD size)
return sizeof(LOGICAL_PROCESSOR_RELATIONSHIP) + sizeof(DWORD) + size;
}
+static DWORD count_bits(ULONG_PTR mask)
+{
+ DWORD count = 0;
+ while (mask > 0)
+ {
+ mask >>= 1;
+ count++;
+ }
+ return count;
+}
+
static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **pdata,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX **pdataex, DWORD *len, DWORD *pmax_len,
LOGICAL_PROCESSOR_RELATIONSHIP rel, DWORD id, ULONG_PTR mask)
@@ -1381,7 +1392,10 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
dataex->Relationship = rel;
dataex->Size = log_proc_ex_size_plus(sizeof(PROCESSOR_RELATIONSHIP));
- dataex->u.Processor.Flags = 0; /* TODO */
+ if (rel == RelationProcessorCore)
+ dataex->u.Processor.Flags = count_bits(mask) > 1 ? LTP_PC_SMT : 0;
+ else
+ dataex->u.Processor.Flags = 0;
dataex->u.Processor.EfficiencyClass = 0;
dataex->u.Processor.GroupCount = 1;
dataex->u.Processor.GroupMask[0].Mask = mask;
@@ -1524,17 +1538,6 @@ static inline BOOL logical_proc_info_add_group(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
}
#ifdef linux
-static DWORD count_bits(ULONG_PTR mask)
-{
- DWORD count = 0;
- while (mask > 0)
- {
- mask >>= 1;
- count++;
- }
- return count;
-}
-
/* for 'data', max_len is the array count. for 'dataex', max_len is in bytes */
static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **data,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX **dataex, DWORD *max_len)
diff --git a/include/winnt.h b/include/winnt.h
index 54bf11dabd..862cc45291 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -5982,6 +5982,8 @@ typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
RelationAll = 0xffff
} LOGICAL_PROCESSOR_RELATIONSHIP;
+#define LTP_PC_SMT 0x1
+
typedef enum _PROCESSOR_CACHE_TYPE
{
CacheUnified,
--
2.14.4
June 14, 2018
[PATCH 2/4] ntdll: Report logical cores per physical core through mask.
by Roderick Colenbrander
Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com>
---
dlls/ntdll/nt.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index e6458b98f2..0b69f7de44 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1325,8 +1325,16 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
(*pdata)[i].ProcessorMask |= mask;
return TRUE;
}
- }else
- i = *len;
+ }
+ else
+ {
+ for(i=0; i<*len; i++)
+ {
+ if ((*pdata)[i].Relationship==rel && (*pdata)[i].ProcessorMask==mask &&
+ (*pdata)[i].u.Reserved[1]==id)
+ return TRUE;
+ }
+ }
while(*len == *pmax_len)
{
@@ -1352,6 +1360,11 @@ static inline BOOL logical_proc_info_add_by_id(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
dataex->u.Processor.GroupMask[0].Mask |= mask;
return TRUE;
}
+ else if (rel == RelationProcessorCore && dataex->Relationship == rel &&
+ dataex->u.Processor.GroupMask[0].Mask == mask && dataex->u.Processor.Reserved[1] == id)
+ {
+ return TRUE;
+ }
ofs += dataex->Size;
}
@@ -1548,6 +1561,8 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
for(i=beg; i<=end; i++)
{
+ ULONG_PTR thread_mask = 0;
+
if(i > 8*sizeof(ULONG_PTR))
{
FIXME("skipping logical processor %d\n", i);
@@ -1568,15 +1583,16 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
return STATUS_NO_MEMORY;
}
- sprintf(name, core_info, i, "core_id");
+ /* Mask of logical threads sharing same physical core. */
+ sprintf(name, core_info, i, "thread_siblings");
f = fopen(name, "r");
if(f)
{
- fscanf(f, "%u", &r);
+ fscanf(f, "%lx", &thread_mask);
fclose(f);
}
- else r = i;
- if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, r, (ULONG_PTR)1 << i))
+ else thread_mask = 1<<i;
+ if(!logical_proc_info_add_by_id(data, dataex, &len, max_len, RelationProcessorCore, r, thread_mask))
{
fclose(fcpu_list);
return STATUS_NO_MEMORY;
--
2.14.4
June 14, 2018
[PATCH 1/4] ntdll: Derive number of logical CPU cores from core mask.
by Roderick Colenbrander
Signed-off-by: Roderick Colenbrander <thunderbird2k(a)gmail.com>
---
dlls/ntdll/nt.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index dc0ce04f42..e6458b98f2 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1511,6 +1511,17 @@ static inline BOOL logical_proc_info_add_group(SYSTEM_LOGICAL_PROCESSOR_INFORMAT
}
#ifdef linux
+static DWORD count_bits(ULONG_PTR mask)
+{
+ DWORD count = 0;
+ while (mask > 0)
+ {
+ mask >>= 1;
+ count++;
+ }
+ return count;
+}
+
/* for 'data', max_len is the array count. for 'dataex', max_len is in bytes */
static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **data,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX **dataex, DWORD *max_len)
@@ -1643,7 +1654,6 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
for(i=0; i<len; i++){
if((*data)[i].Relationship == RelationProcessorCore){
all_cpus_mask |= (*data)[i].ProcessorMask;
- ++num_cpus;
}
}
}else{
@@ -1651,11 +1661,11 @@ static NTSTATUS create_logical_proc_info(SYSTEM_LOGICAL_PROCESSOR_INFORMATION **
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *infoex = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *)(((char *)*dataex) + i);
if(infoex->Relationship == RelationProcessorCore){
all_cpus_mask |= infoex->u.Processor.GroupMask[0].Mask;
- ++num_cpus;
}
i += infoex->Size;
}
}
+ num_cpus = count_bits(all_cpus_mask);
fnuma_list = fopen("/sys/devices/system/node/online", "r");
if(!fnuma_list)
--
2.14.4
June 14, 2018
[PATCH 0/4] ntdll: Improve logical core reporting on Linux
by Roderick Colenbrander
Hi all,
Recently I was helping a user troubleshoot some Ryzen performance issues.
As part of that still unresolved bug (Bugzilla 43277), I found out or CPU
core reporting code on Linux is not correct.
The summary is that we report all logical cores as if they were physical
CPU cores. Applications also can't determine whether they are dealing
with SMT / HyperThreaded cores. Essentially applications think there are
twice the number of physical cores.
The issue can easily be observed through various sample applications:
- Sysinternals core info application uses GetLogicalProcessorInformationEx:
https://docs.microsoft.com/en-us/sysinternals/downloads/coreinfo
- Example application on GetLogicalProcessorInformation:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683194(v=vs.85).…
The root cause of the issue is in how we enumerated CPU cores. We do so
by walking all logical cores in sysfs (/sys/devices/system/cpuX). Each core
we report as a physical core. We are not parsing the 'thread_siblings'
file, which tells us the mask of logical cores sharing a physical core.
This causes us to count cores twice. This happens both on AMD and Intel.
The patch series adjusts how we enumerate logical cores on Linux by
parsing 'thread_siblings' and making sure we don't add a new physical
core if a sibling earlier added a physical core for the same mask
and package. The cache parsing logic does something similar by parsing
'shared_cpu_map' and logical_proc_add_cache_info ignores already reported
caches as well.
In addition, we are now also reporting SMT capabilities to Flags of
GetLogicalProcessorInformation(Ex).
Thanks,
Roderick
Roderick Colenbrander (4):
ntdll: Derive number of logical CPU cores from core mask.
ntdll: Report logical cores per physical core through mask.
ntdll: GetLogicalProcessorInformationEx report LTP_PC_SMT for SMT
cores.
ntdll: GetLogicalProcessorInformation report LPT_PC_SMT for SMT cores.
dlls/ntdll/nt.c | 50 ++++++++++++++++++++++++++++++++++++++++----------
include/winnt.h | 2 ++
2 files changed, 42 insertions(+), 10 deletions(-)
--
2.14.4
June 14, 2018
Re: [PATCH 3/3] winedbg: Always start the interactive debugger in 64-bit mode if in a 64-bit prefix.
by Zebediah Figura
On 06/13/2018 04:34 PM, Zebediah Figura wrote:
> Fixes https://bugs.winehq.org/show_bug.cgi?id=45109
>
> Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
> ---
> programs/winedbg/winedbg.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
It occurs to me we don't want to do this until Mach-O support is
implemented for WoW64 in dbghelp. Please disregard this patch until then.
June 13, 2018
[PATCH 3/3] winedbg: Always start the interactive debugger in 64-bit mode if in a 64-bit prefix.
by Zebediah Figura
Fixes https://bugs.winehq.org/show_bug.cgi?id=45109
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/winedbg.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index 1ac4187..0e45186 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -632,6 +632,35 @@ static LONG CALLBACK top_filter( EXCEPTION_POINTERS *ptr )
return EXCEPTION_EXECUTE_HANDLER;
}
+static void restart_if_wow64(void)
+{
+ BOOL is_wow64;
+
+ if (IsWow64Process( GetCurrentProcess(), &is_wow64 ) && is_wow64)
+ {
+ STARTUPINFOW si;
+ PROCESS_INFORMATION pi;
+ WCHAR filename[MAX_PATH];
+ void *redir;
+ DWORD exit_code;
+
+ memset( &si, 0, sizeof(si) );
+ si.cb = sizeof(si);
+ GetModuleFileNameW( 0, filename, MAX_PATH );
+
+ Wow64DisableWow64FsRedirection( &redir );
+ if (CreateProcessW( filename, GetCommandLineW(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ))
+ {
+ WINE_TRACE( "restarting %s\n", wine_dbgstr_w(filename) );
+ WaitForSingleObject( pi.hProcess, INFINITE );
+ GetExitCodeProcess( pi.hProcess, &exit_code );
+ ExitProcess( exit_code );
+ }
+ else WINE_ERR( "failed to restart 64-bit %s, err %d\n", wine_dbgstr_w(filename), GetLastError() );
+ Wow64RevertWow64FsRedirection( redir );
+ }
+}
+
int main(int argc, char** argv)
{
int retv = 0;
@@ -654,6 +683,7 @@ int main(int argc, char** argv)
if (argc && !strcmp(argv[0], "--gdb"))
{
+ restart_if_wow64();
retv = gdb_main(argc, argv);
if (retv == -1) dbg_winedbg_usage(FALSE);
return retv;
@@ -727,6 +757,8 @@ int main(int argc, char** argv)
case start_error_init: return -1;
}
+ restart_if_wow64();
+
dbg_start_interactive(hFile);
return 0;
--
2.7.4
June 13, 2018
[PATCH 2/3] winedbg/gdbproxy: Store the register map inside the be_cpu struct.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/be_arm.c | 24 +++
programs/winedbg/be_arm64.c | 41 ++++++
programs/winedbg/be_cpu.h | 10 ++
programs/winedbg/be_i386.c | 48 ++++++
programs/winedbg/be_ppc.c | 80 ++++++++++
programs/winedbg/be_x86_64.c | 64 ++++++++
programs/winedbg/debugger.h | 2 +
programs/winedbg/gdbproxy.c | 343 +++++--------------------------------------
8 files changed, 306 insertions(+), 306 deletions(-)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c
index 9883476..0c65757 100644
--- a/programs/winedbg/be_arm.c
+++ b/programs/winedbg/be_arm.c
@@ -1904,6 +1904,28 @@ static BOOL be_arm_set_context(HANDLE thread, const dbg_ctx_t *ctx)
return SetThreadContext(thread, &ctx->ctx);
}
+#define REG(r,gs) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs}
+
+static struct gdb_register be_arm_gdb_register_map[] = {
+ REG(R0, 4),
+ REG(R1, 4),
+ REG(R2, 4),
+ REG(R3, 4),
+ REG(R4, 4),
+ REG(R5, 4),
+ REG(R6, 4),
+ REG(R7, 4),
+ REG(R8, 4),
+ REG(R9, 4),
+ REG(R10, 4),
+ REG(R11, 4),
+ REG(R12, 4),
+ REG(Sp, 4),
+ REG(Lr, 4),
+ REG(Pc, 4),
+ REG(Cpsr, 4),
+};
+
struct backend_cpu be_arm =
{
IMAGE_FILE_MACHINE_ARMNT,
@@ -1931,5 +1953,7 @@ struct backend_cpu be_arm =
be_arm_fetch_float,
be_arm_store_integer,
be_arm_get_context,
+ be_arm_gdb_register_map,
+ ARRAY_SIZE(be_arm_gdb_register_map),
};
#endif
diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c
index 418d6e0..40ef96b 100644
--- a/programs/winedbg/be_arm64.c
+++ b/programs/winedbg/be_arm64.c
@@ -293,6 +293,45 @@ static BOOL be_arm64_set_context(HANDLE thread, const dbg_ctx_t *ctx)
return SetThreadContext(thread, &ctx->ctx);
}
+#define REG(r,gs) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs}
+
+static struct gdb_register be_arm64_gdb_register_map[] = {
+ REG(Cpsr, 4),
+ REG(u.s.X0, 8),
+ REG(u.s.X1, 8),
+ REG(u.s.X2, 8),
+ REG(u.s.X3, 8),
+ REG(u.s.X4, 8),
+ REG(u.s.X5, 8),
+ REG(u.s.X6, 8),
+ REG(u.s.X7, 8),
+ REG(u.s.X8, 8),
+ REG(u.s.X9, 8),
+ REG(u.s.X10, 8),
+ REG(u.s.X11, 8),
+ REG(u.s.X12, 8),
+ REG(u.s.X13, 8),
+ REG(u.s.X14, 8),
+ REG(u.s.X15, 8),
+ REG(u.s.X16, 8),
+ REG(u.s.X17, 8),
+ REG(u.s.X18, 8),
+ REG(u.s.X19, 8),
+ REG(u.s.X20, 8),
+ REG(u.s.X21, 8),
+ REG(u.s.X22, 8),
+ REG(u.s.X23, 8),
+ REG(u.s.X24, 8),
+ REG(u.s.X25, 8),
+ REG(u.s.X26, 8),
+ REG(u.s.X27, 8),
+ REG(u.s.X28, 8),
+ REG(u.s.Fp, 8),
+ REG(u.s.Lr, 8),
+ REG(Sp, 8),
+ REG(Pc, 8),
+};
+
struct backend_cpu be_arm64 =
{
IMAGE_FILE_MACHINE_ARM64,
@@ -320,5 +359,7 @@ struct backend_cpu be_arm64 =
be_arm64_fetch_float,
be_arm64_store_integer,
be_arm64_get_context,
+ be_arm64_gdb_register_map,
+ ARRAY_SIZE(be_arm64_gdb_register_map),
};
#endif
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index 1a67c06..ea559b4 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -22,6 +22,13 @@ enum be_cpu_addr {be_cpu_addr_pc, be_cpu_addr_stack, be_cpu_addr_frame};
enum be_xpoint_type {be_xpoint_break, be_xpoint_watch_exec, be_xpoint_watch_read,
be_xpoint_watch_write, be_xpoint_free=-1};
+struct gdb_register
+{
+ size_t ctx_offset;
+ size_t ctx_length;
+ size_t gdb_length;
+};
+
struct backend_cpu
{
const DWORD machine;
@@ -118,6 +125,9 @@ struct backend_cpu
BOOL (*get_context)(HANDLE thread, dbg_ctx_t *ctx);
BOOL (*set_context)(HANDLE thread, const dbg_ctx_t *ctx);
+
+ const struct gdb_register *gdb_register_map;
+ const size_t gdb_num_regs;
};
/* some handy functions for non segmented CPUs */
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index 4e279ec..3a2b91a 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -866,6 +866,52 @@ static BOOL be_i386_set_context(HANDLE thread, const dbg_ctx_t *ctx)
return Wow64SetThreadContext(thread, &ctx->x86);
}
+#define REG(r,gs) {FIELD_OFFSET(WOW64_CONTEXT, r), sizeof(((WOW64_CONTEXT*)NULL)->r), gs}
+
+static struct gdb_register be_i386_gdb_register_map[] = {
+ REG(Eax, 4),
+ REG(Ecx, 4),
+ REG(Edx, 4),
+ REG(Ebx, 4),
+ REG(Esp, 4),
+ REG(Ebp, 4),
+ REG(Esi, 4),
+ REG(Edi, 4),
+ REG(Eip, 4),
+ REG(EFlags, 4),
+ REG(SegCs, 4),
+ REG(SegSs, 4),
+ REG(SegDs, 4),
+ REG(SegEs, 4),
+ REG(SegFs, 4),
+ REG(SegGs, 4),
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[ 0]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[10]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[20]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[30]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[40]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[50]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[60]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[70]), 10, 10 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.ControlWord), 2, 4 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.StatusWord), 2, 4 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.TagWord), 2, 4 },
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.ErrorSelector), 2, 4 },
+ REG(FloatSave.ErrorOffset, 4 ),
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.DataSelector), 2, 4 },
+ REG(FloatSave.DataOffset, 4 ),
+ { FIELD_OFFSET(WOW64_CONTEXT, FloatSave.ErrorSelector)+2, 2, 4 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[0]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[1]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[2]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[3]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[4]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[5]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[6]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[7]), 16, 16 },
+ { FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, MxCsr), 4, 4 },
+};
+
struct backend_cpu be_i386 =
{
IMAGE_FILE_MACHINE_I386,
@@ -894,5 +940,7 @@ struct backend_cpu be_i386 =
be_i386_store_integer,
be_i386_get_context,
be_i386_set_context,
+ be_i386_gdb_register_map,
+ ARRAY_SIZE(be_i386_gdb_register_map),
};
#endif
diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c
index 40aee55..b0e6f92 100644
--- a/programs/winedbg/be_ppc.c
+++ b/programs/winedbg/be_ppc.c
@@ -195,6 +195,84 @@ static BOOL be_ppc_set_context(HANDLE thread, const dbg_ctx_t *ctx)
return SetThreadContext(thread, &ctx->ctx);
}
+#define REG(r,gs,m) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs, m}
+
+static struct gdb_register be_ppc_gdb_register_map[] = {
+ REG(Gpr0, 4),
+ REG(Gpr1, 4),
+ REG(Gpr2, 4),
+ REG(Gpr3, 4),
+ REG(Gpr4, 4),
+ REG(Gpr5, 4),
+ REG(Gpr6, 4),
+ REG(Gpr7, 4),
+ REG(Gpr8, 4),
+ REG(Gpr9, 4),
+ REG(Gpr10, 4),
+ REG(Gpr11, 4),
+ REG(Gpr12, 4),
+ REG(Gpr13, 4),
+ REG(Gpr14, 4),
+ REG(Gpr15, 4),
+ REG(Gpr16, 4),
+ REG(Gpr17, 4),
+ REG(Gpr18, 4),
+ REG(Gpr19, 4),
+ REG(Gpr20, 4),
+ REG(Gpr21, 4),
+ REG(Gpr22, 4),
+ REG(Gpr23, 4),
+ REG(Gpr24, 4),
+ REG(Gpr25, 4),
+ REG(Gpr26, 4),
+ REG(Gpr27, 4),
+ REG(Gpr28, 4),
+ REG(Gpr29, 4),
+ REG(Gpr30, 4),
+ REG(Gpr31, 4),
+ REG(Fpr0, 4),
+ REG(Fpr1, 4),
+ REG(Fpr2, 4),
+ REG(Fpr3, 4),
+ REG(Fpr4, 4),
+ REG(Fpr5, 4),
+ REG(Fpr6, 4),
+ REG(Fpr7, 4),
+ REG(Fpr8, 4),
+ REG(Fpr9, 4),
+ REG(Fpr10, 4),
+ REG(Fpr11, 4),
+ REG(Fpr12, 4),
+ REG(Fpr13, 4),
+ REG(Fpr14, 4),
+ REG(Fpr15, 4),
+ REG(Fpr16, 4),
+ REG(Fpr17, 4),
+ REG(Fpr18, 4),
+ REG(Fpr19, 4),
+ REG(Fpr20, 4),
+ REG(Fpr21, 4),
+ REG(Fpr22, 4),
+ REG(Fpr23, 4),
+ REG(Fpr24, 4),
+ REG(Fpr25, 4),
+ REG(Fpr26, 4),
+ REG(Fpr27, 4),
+ REG(Fpr28, 4),
+ REG(Fpr29, 4),
+ REG(Fpr30, 4),
+ REG(Fpr31, 4),
+
+ REG(Iar, 4),
+ REG(Msr, 4),
+ REG(Cr, 4),
+ REG(Lr, 4),
+ REG(Ctr, 4),
+ REG(Xer, 4),
+ /* FIXME: MQ is missing? FIELD_OFFSET(CONTEXT, Mq), */
+ /* see gdb/nlm/ppc.c */
+};
+
struct backend_cpu be_ppc =
{
IMAGE_FILE_MACHINE_POWERPC,
@@ -223,5 +301,7 @@ struct backend_cpu be_ppc =
be_ppc_store_integer,
be_ppc_get_context,
be_ppc_set_context,
+ be_ppc_gdb_register_map,
+ ARRAY_SIZE(be_ppc_gdb_register_map),
};
#endif
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 15f84a6..b7f75c6 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -689,6 +689,68 @@ static BOOL be_x86_64_set_context(HANDLE thread, const dbg_ctx_t *ctx)
return SetThreadContext(thread, &ctx->ctx);
}
+#define REG(r,gs) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs}
+
+static struct gdb_register be_x86_64_gdb_register_map[] = {
+ REG(Rax, 8),
+ REG(Rbx, 8),
+ REG(Rcx, 8),
+ REG(Rdx, 8),
+ REG(Rsi, 8),
+ REG(Rdi, 8),
+ REG(Rbp, 8),
+ REG(Rsp, 8),
+ REG(R8, 8),
+ REG(R9, 8),
+ REG(R10, 8),
+ REG(R11, 8),
+ REG(R12, 8),
+ REG(R13, 8),
+ REG(R14, 8),
+ REG(R15, 8),
+ REG(Rip, 8),
+ REG(EFlags, 4),
+ REG(SegCs, 4),
+ REG(SegSs, 4),
+ REG(SegDs, 4),
+ REG(SegEs, 4),
+ REG(SegFs, 4),
+ REG(SegGs, 4),
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 0]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 1]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 2]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 3]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 4]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 5]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 6]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 7]), 10, 10 },
+ REG(u.FltSave.ControlWord, 4),
+ REG(u.FltSave.StatusWord, 4),
+ REG(u.FltSave.TagWord, 4),
+ REG(u.FltSave.ErrorSelector, 4),
+ REG(u.FltSave.ErrorOffset, 4),
+ REG(u.FltSave.DataSelector, 4),
+ REG(u.FltSave.DataOffset, 4),
+ REG(u.FltSave.ErrorOpcode, 4),
+ REG(u.s.Xmm0, 16),
+ REG(u.s.Xmm1, 16),
+ REG(u.s.Xmm2, 16),
+ REG(u.s.Xmm3, 16),
+ REG(u.s.Xmm4, 16),
+ REG(u.s.Xmm5, 16),
+ REG(u.s.Xmm6, 16),
+ REG(u.s.Xmm7, 16),
+ REG(u.s.Xmm8, 16),
+ REG(u.s.Xmm9, 16),
+ REG(u.s.Xmm10, 16),
+ REG(u.s.Xmm11, 16),
+ REG(u.s.Xmm12, 16),
+ REG(u.s.Xmm13, 16),
+ REG(u.s.Xmm14, 16),
+ REG(u.s.Xmm15, 16),
+ REG(u.FltSave.MxCsr, 4),
+};
+
struct backend_cpu be_x86_64 =
{
IMAGE_FILE_MACHINE_AMD64,
@@ -717,5 +779,7 @@ struct backend_cpu be_x86_64 =
be_x86_64_store_integer,
be_x86_64_get_context,
be_x86_64_set_context,
+ be_x86_64_gdb_register_map,
+ ARRAY_SIZE(be_x86_64_gdb_register_map),
};
#endif
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index 490bd06..3fc8daa 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -39,6 +39,8 @@
#include "oaidl.h"
#include <wine/list.h>
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
#define ADDRSIZE (dbg_curr_process->be_cpu->pointer_size)
#define ADDRWIDTH (ADDRSIZE * 2)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 81cd7de..869d56b 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -183,233 +183,12 @@ static unsigned char checksum(const char* ptr, int len)
return cksum;
}
-/* =============================================== *
- * C P U H A N D L E R S *
- * =============================================== *
- */
-
-/* This struct helps us to manage the different representations of a register:
- * ctx_offset and ctx_length are the location and size in Win32 CONTEXT
- * gdb_length is the length gdb expects on the wire
- * As the two sizes could be different, we have to convert between the two
- * (for example, on x86_64, Seg?s are 4 bytes on the wire and 2 in CONTEXT)
- */
-struct cpu_register
-{
- size_t ctx_offset;
- size_t ctx_length;
- size_t gdb_length;
-};
-
-#define REG(r,gs) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs}
-
#ifdef __i386__
-typedef struct DECLSPEC_ALIGN(16) _M128A {
- ULONGLONG Low;
- LONGLONG High;
-} M128A, *PM128A;
-
-typedef struct _XMM_SAVE_AREA32 {
- WORD ControlWord; /* 000 */
- WORD StatusWord; /* 002 */
- BYTE TagWord; /* 004 */
- BYTE Reserved1; /* 005 */
- WORD ErrorOpcode; /* 006 */
- DWORD ErrorOffset; /* 008 */
- WORD ErrorSelector; /* 00c */
- WORD Reserved2; /* 00e */
- DWORD DataOffset; /* 010 */
- WORD DataSelector; /* 014 */
- WORD Reserved3; /* 016 */
- DWORD MxCsr; /* 018 */
- DWORD MxCsr_Mask; /* 01c */
- M128A FloatRegisters[8]; /* 020 */
- M128A XmmRegisters[16]; /* 0a0 */
- BYTE Reserved4[96]; /* 1a0 */
-} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
-
static const char target_xml[] = "";
-static struct cpu_register cpu_register_map[] = {
- REG(Eax, 4),
- REG(Ecx, 4),
- REG(Edx, 4),
- REG(Ebx, 4),
- REG(Esp, 4),
- REG(Ebp, 4),
- REG(Esi, 4),
- REG(Edi, 4),
- REG(Eip, 4),
- REG(EFlags, 4),
- REG(SegCs, 4),
- REG(SegSs, 4),
- REG(SegDs, 4),
- REG(SegEs, 4),
- REG(SegFs, 4),
- REG(SegGs, 4),
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[ 0]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[10]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[20]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[30]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[40]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[50]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[60]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[70]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, FloatSave.ControlWord), 2, 4 },
- { FIELD_OFFSET(CONTEXT, FloatSave.StatusWord), 2, 4 },
- { FIELD_OFFSET(CONTEXT, FloatSave.TagWord), 2, 4 },
- { FIELD_OFFSET(CONTEXT, FloatSave.ErrorSelector), 2, 4 },
- REG(FloatSave.ErrorOffset, 4 ),
- { FIELD_OFFSET(CONTEXT, FloatSave.DataSelector), 2, 4 },
- REG(FloatSave.DataOffset, 4 ),
- { FIELD_OFFSET(CONTEXT, FloatSave.ErrorSelector)+2, 2, 4 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[0]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[1]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[2]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[3]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[4]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[5]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[6]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[7]), 16, 16 },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, MxCsr), 4, 4 },
-};
#elif defined(__powerpc__)
static const char target_xml[] = "";
-static struct cpu_register cpu_register_map[] = {
- REG(Gpr0, 4),
- REG(Gpr1, 4),
- REG(Gpr2, 4),
- REG(Gpr3, 4),
- REG(Gpr4, 4),
- REG(Gpr5, 4),
- REG(Gpr6, 4),
- REG(Gpr7, 4),
- REG(Gpr8, 4),
- REG(Gpr9, 4),
- REG(Gpr10, 4),
- REG(Gpr11, 4),
- REG(Gpr12, 4),
- REG(Gpr13, 4),
- REG(Gpr14, 4),
- REG(Gpr15, 4),
- REG(Gpr16, 4),
- REG(Gpr17, 4),
- REG(Gpr18, 4),
- REG(Gpr19, 4),
- REG(Gpr20, 4),
- REG(Gpr21, 4),
- REG(Gpr22, 4),
- REG(Gpr23, 4),
- REG(Gpr24, 4),
- REG(Gpr25, 4),
- REG(Gpr26, 4),
- REG(Gpr27, 4),
- REG(Gpr28, 4),
- REG(Gpr29, 4),
- REG(Gpr30, 4),
- REG(Gpr31, 4),
- REG(Fpr0, 4),
- REG(Fpr1, 4),
- REG(Fpr2, 4),
- REG(Fpr3, 4),
- REG(Fpr4, 4),
- REG(Fpr5, 4),
- REG(Fpr6, 4),
- REG(Fpr7, 4),
- REG(Fpr8, 4),
- REG(Fpr9, 4),
- REG(Fpr10, 4),
- REG(Fpr11, 4),
- REG(Fpr12, 4),
- REG(Fpr13, 4),
- REG(Fpr14, 4),
- REG(Fpr15, 4),
- REG(Fpr16, 4),
- REG(Fpr17, 4),
- REG(Fpr18, 4),
- REG(Fpr19, 4),
- REG(Fpr20, 4),
- REG(Fpr21, 4),
- REG(Fpr22, 4),
- REG(Fpr23, 4),
- REG(Fpr24, 4),
- REG(Fpr25, 4),
- REG(Fpr26, 4),
- REG(Fpr27, 4),
- REG(Fpr28, 4),
- REG(Fpr29, 4),
- REG(Fpr30, 4),
- REG(Fpr31, 4),
-
- REG(Iar, 4),
- REG(Msr, 4),
- REG(Cr, 4),
- REG(Lr, 4),
- REG(Ctr, 4),
- REG(Xer, 4),
- /* FIXME: MQ is missing? FIELD_OFFSET(CONTEXT, Mq), */
- /* see gdb/nlm/ppc.c */
-};
#elif defined(__x86_64__)
static const char target_xml[] = "";
-static struct cpu_register cpu_register_map[] = {
- REG(Rax, 8),
- REG(Rbx, 8),
- REG(Rcx, 8),
- REG(Rdx, 8),
- REG(Rsi, 8),
- REG(Rdi, 8),
- REG(Rbp, 8),
- REG(Rsp, 8),
- REG(R8, 8),
- REG(R9, 8),
- REG(R10, 8),
- REG(R11, 8),
- REG(R12, 8),
- REG(R13, 8),
- REG(R14, 8),
- REG(R15, 8),
- REG(Rip, 8),
- REG(EFlags, 4),
- REG(SegCs, 4),
- REG(SegSs, 4),
- REG(SegDs, 4),
- REG(SegEs, 4),
- REG(SegFs, 4),
- REG(SegGs, 4),
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 0]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 1]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 2]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 3]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 4]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 5]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 6]), 10, 10 },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 7]), 10, 10 },
- REG(u.FltSave.ControlWord, 4),
- REG(u.FltSave.StatusWord, 4),
- REG(u.FltSave.TagWord, 4),
- REG(u.FltSave.ErrorSelector, 4),
- REG(u.FltSave.ErrorOffset, 4),
- REG(u.FltSave.DataSelector, 4),
- REG(u.FltSave.DataOffset, 4),
- REG(u.FltSave.ErrorOpcode, 4),
- REG(u.s.Xmm0, 16),
- REG(u.s.Xmm1, 16),
- REG(u.s.Xmm2, 16),
- REG(u.s.Xmm3, 16),
- REG(u.s.Xmm4, 16),
- REG(u.s.Xmm5, 16),
- REG(u.s.Xmm6, 16),
- REG(u.s.Xmm7, 16),
- REG(u.s.Xmm8, 16),
- REG(u.s.Xmm9, 16),
- REG(u.s.Xmm10, 16),
- REG(u.s.Xmm11, 16),
- REG(u.s.Xmm12, 16),
- REG(u.s.Xmm13, 16),
- REG(u.s.Xmm14, 16),
- REG(u.s.Xmm15, 16),
- REG(u.FltSave.MxCsr, 4),
-};
#elif defined(__arm__)
static const char target_xml[] =
"l <target><architecture>arm</architecture>\n"
@@ -432,96 +211,43 @@ static const char target_xml[] =
" <reg name=\"pc\" bitsize=\"32\" type=\"code_ptr\"/>\n"
" <reg name=\"cpsr\" bitsize=\"32\"/>\n"
"</feature></target>\n";
-
-static struct cpu_register cpu_register_map[] = {
- REG(R0, 4),
- REG(R1, 4),
- REG(R2, 4),
- REG(R3, 4),
- REG(R4, 4),
- REG(R5, 4),
- REG(R6, 4),
- REG(R7, 4),
- REG(R8, 4),
- REG(R9, 4),
- REG(R10, 4),
- REG(R11, 4),
- REG(R12, 4),
- REG(Sp, 4),
- REG(Lr, 4),
- REG(Pc, 4),
- REG(Cpsr, 4),
-};
#elif defined(__aarch64__)
static const char target_xml[] = "";
-static struct cpu_register cpu_register_map[] = {
- REG(Cpsr, 4),
- REG(u.s.X0, 8),
- REG(u.s.X1, 8),
- REG(u.s.X2, 8),
- REG(u.s.X3, 8),
- REG(u.s.X4, 8),
- REG(u.s.X5, 8),
- REG(u.s.X6, 8),
- REG(u.s.X7, 8),
- REG(u.s.X8, 8),
- REG(u.s.X9, 8),
- REG(u.s.X10, 8),
- REG(u.s.X11, 8),
- REG(u.s.X12, 8),
- REG(u.s.X13, 8),
- REG(u.s.X14, 8),
- REG(u.s.X15, 8),
- REG(u.s.X16, 8),
- REG(u.s.X17, 8),
- REG(u.s.X18, 8),
- REG(u.s.X19, 8),
- REG(u.s.X20, 8),
- REG(u.s.X21, 8),
- REG(u.s.X22, 8),
- REG(u.s.X23, 8),
- REG(u.s.X24, 8),
- REG(u.s.X25, 8),
- REG(u.s.X26, 8),
- REG(u.s.X27, 8),
- REG(u.s.X28, 8),
- REG(u.s.Fp, 8),
- REG(u.s.Lr, 8),
- REG(Sp, 8),
- REG(Pc, 8),
-};
#else
# error Define the registers map for your CPU
#endif
-#undef REG
-static const size_t cpu_num_regs = (sizeof(cpu_register_map) / sizeof(cpu_register_map[0]));
-
-static inline void* cpu_register_ptr(dbg_ctx_t *ctx, unsigned idx)
+static inline void* cpu_register_ptr(struct gdb_context *gdbctx,
+ dbg_ctx_t *ctx, unsigned idx)
{
- assert(idx < cpu_num_regs);
- return (char*)ctx + cpu_register_map[idx].ctx_offset;
+ assert(idx < gdbctx->process->be_cpu->gdb_num_regs);
+ return (char*)ctx + gdbctx->process->be_cpu->gdb_register_map[idx].ctx_offset;
}
-static inline DWORD64 cpu_register(dbg_ctx_t *ctx, unsigned idx)
+static inline DWORD64 cpu_register(struct gdb_context *gdbctx,
+ dbg_ctx_t *ctx, unsigned idx)
{
- switch (cpu_register_map[idx].ctx_length)
+ switch (gdbctx->process->be_cpu->gdb_register_map[idx].ctx_length)
{
- case 1: return *(BYTE*)cpu_register_ptr(ctx, idx);
- case 2: return *(WORD*)cpu_register_ptr(ctx, idx);
- case 4: return *(DWORD*)cpu_register_ptr(ctx, idx);
- case 8: return *(DWORD64*)cpu_register_ptr(ctx, idx);
+ case 1: return *(BYTE*)cpu_register_ptr(gdbctx, ctx, idx);
+ case 2: return *(WORD*)cpu_register_ptr(gdbctx, ctx, idx);
+ case 4: return *(DWORD*)cpu_register_ptr(gdbctx, ctx, idx);
+ case 8: return *(DWORD64*)cpu_register_ptr(gdbctx, ctx, idx);
default:
- fprintf(stderr, "got unexpected size: %u\n", (unsigned)cpu_register_map[idx].ctx_length);
+ fprintf(stderr, "got unexpected size: %u\n",
+ (unsigned)gdbctx->process->be_cpu->gdb_register_map[idx].ctx_length);
assert(0);
return 0;
}
}
-static inline void cpu_register_hex_from(dbg_ctx_t* ctx, unsigned idx, const char **phex)
+static inline void cpu_register_hex_from(struct gdb_context *gdbctx,
+ dbg_ctx_t* ctx, unsigned idx, const char **phex)
{
+ const struct gdb_register *cpu_register_map = gdbctx->process->be_cpu->gdb_register_map;
+
if (cpu_register_map[idx].gdb_length == cpu_register_map[idx].ctx_length)
- hex_from(cpu_register_ptr(ctx, idx), *phex, cpu_register_map[idx].gdb_length);
+ hex_from(cpu_register_ptr(gdbctx, ctx, idx), *phex, cpu_register_map[idx].gdb_length);
else
{
DWORD64 val = 0;
@@ -536,10 +262,10 @@ static inline void cpu_register_hex_from(dbg_ctx_t* ctx, unsigned idx, const cha
}
switch (cpu_register_map[idx].ctx_length)
{
- case 1: *(BYTE*)cpu_register_ptr(ctx, idx) = (BYTE)val; break;
- case 2: *(WORD*)cpu_register_ptr(ctx, idx) = (WORD)val; break;
- case 4: *(DWORD*)cpu_register_ptr(ctx, idx) = (DWORD)val; break;
- case 8: *(DWORD64*)cpu_register_ptr(ctx, idx) = val; break;
+ case 1: *(BYTE*)cpu_register_ptr(gdbctx, ctx, idx) = (BYTE)val; break;
+ case 2: *(WORD*)cpu_register_ptr(gdbctx, ctx, idx) = (WORD)val; break;
+ case 4: *(DWORD*)cpu_register_ptr(gdbctx, ctx, idx) = (DWORD)val; break;
+ case 8: *(DWORD64*)cpu_register_ptr(gdbctx, ctx, idx) = val; break;
default: assert(0);
}
}
@@ -1078,11 +804,14 @@ static enum packet_return packet_reply_error(struct gdb_context* gdbctx, int err
static inline void packet_reply_register_hex_to(struct gdb_context* gdbctx, unsigned idx)
{
+ const struct gdb_register *cpu_register_map = gdbctx->process->be_cpu->gdb_register_map;
+
if (cpu_register_map[idx].gdb_length == cpu_register_map[idx].ctx_length)
- packet_reply_hex_to(gdbctx, cpu_register_ptr(&gdbctx->context, idx), cpu_register_map[idx].gdb_length);
+ packet_reply_hex_to(gdbctx, cpu_register_ptr(gdbctx, &gdbctx->context, idx),
+ cpu_register_map[idx].gdb_length);
else
{
- DWORD64 val = cpu_register(&gdbctx->context, idx);
+ DWORD64 val = cpu_register(gdbctx, &gdbctx->context, idx);
unsigned i;
for (i = 0; i < cpu_register_map[idx].gdb_length; i++)
@@ -1117,7 +846,7 @@ static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
packet_reply_val(gdbctx, dbg_curr_thread->tid, 4);
packet_reply_catc(gdbctx, ';');
- for (i = 0; i < cpu_num_regs; i++)
+ for (i = 0; i < gdbctx->process->be_cpu->gdb_num_regs; i++)
{
/* FIXME: this call will also grow the buffer...
* unneeded, but not harmful
@@ -1453,14 +1182,16 @@ static enum packet_return packet_read_registers(struct gdb_context* gdbctx)
}
packet_reply_open(gdbctx);
- for (i = 0; i < cpu_num_regs; i++)
+ for (i = 0; i < gdbctx->process->be_cpu->gdb_num_regs; i++)
packet_reply_register_hex_to(gdbctx, i);
+
packet_reply_close(gdbctx);
return packet_done;
}
static enum packet_return packet_write_registers(struct gdb_context* gdbctx)
{
+ const size_t cpu_num_regs = gdbctx->process->be_cpu->gdb_num_regs;
unsigned i;
dbg_ctx_t ctx;
dbg_ctx_t *pctx = &gdbctx->context;
@@ -1476,7 +1207,7 @@ static enum packet_return packet_write_registers(struct gdb_context* gdbctx)
ptr = gdbctx->in_packet;
for (i = 0; i < cpu_num_regs; i++)
- cpu_register_hex_from(pctx, i, &ptr);
+ cpu_register_hex_from(gdbctx, pctx, i, &ptr);
if (pctx != &gdbctx->context &&
!gdbctx->process->be_cpu->set_context(gdbctx->other_thread->handle, pctx))
@@ -1621,7 +1352,7 @@ static enum packet_return packet_read_register(struct gdb_context* gdbctx)
assert(gdbctx->in_trap);
reg = hex_to_int(gdbctx->in_packet, gdbctx->in_packet_len);
- if (reg >= cpu_num_regs)
+ if (reg >= gdbctx->process->be_cpu->gdb_num_regs)
{
if (gdbctx->trace & GDBPXY_TRC_COMMAND_ERROR)
fprintf(stderr, "Register out of bounds %x\n", reg);
@@ -1634,9 +1365,9 @@ static enum packet_return packet_read_register(struct gdb_context* gdbctx)
}
if (gdbctx->trace & GDBPXY_TRC_COMMAND)
{
- if (cpu_register_map[reg].ctx_length <= sizeof(DWORD64))
+ if (gdbctx->process->be_cpu->gdb_register_map[reg].ctx_length <= sizeof(DWORD64))
fprintf(stderr, "Read register %x => %08x%08x\n", reg,
- (unsigned)(cpu_register(pctx, reg) >> 32), (unsigned)cpu_register(pctx, reg));
+ (unsigned)(cpu_register(gdbctx, pctx, reg) >> 32), (unsigned)cpu_register(gdbctx, pctx, reg));
else
fprintf(stderr, "Read register %x\n", reg);
}
@@ -1656,7 +1387,7 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
assert(gdbctx->in_trap);
reg = strtoul(gdbctx->in_packet, &ptr, 16);
- if (ptr == NULL || reg >= cpu_num_regs || *ptr++ != '=')
+ if (ptr == NULL || reg >= gdbctx->process->be_cpu->gdb_num_regs || *ptr++ != '=')
{
if (gdbctx->trace & GDBPXY_TRC_COMMAND_ERROR)
fprintf(stderr, "Invalid register index %s\n", gdbctx->in_packet);
@@ -1677,7 +1408,7 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
return packet_error;
}
- cpu_register_hex_from(pctx, reg, (const char**)&ptr);
+ cpu_register_hex_from(gdbctx, pctx, reg, (const char**)&ptr);
if (pctx != &gdbctx->context &&
!gdbctx->process->be_cpu->set_context(gdbctx->other_thread->handle, pctx))
{
--
2.7.4
June 13, 2018
[PATCH 1/3] winedbg: Implement debugging 32-bit processes on x86_64.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/be_i386.c | 22 ++++++++++++----------
programs/winedbg/db_disasm.c | 4 ++--
programs/winedbg/winedbg.c | 21 ++++++++-------------
3 files changed, 22 insertions(+), 25 deletions(-)
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index f46ebb1..4e279ec 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -21,7 +21,7 @@
#include "debugger.h"
#include "wine/debug.h"
-#ifdef __i386__
+#if defined(__i386__) || defined(__x86_64__)
WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
@@ -33,6 +33,7 @@ extern void be_i386_disasm_one_insn(ADDRESS64* addr, int display);
#define IS_VM86_MODE(ctx) (ctx->EFlags & V86_FLAG)
+#ifndef __x86_64__
typedef struct DECLSPEC_ALIGN(16) _M128A {
ULONGLONG Low;
LONGLONG High;
@@ -56,6 +57,7 @@ typedef struct _XMM_SAVE_AREA32 {
M128A XmmRegisters[16]; /* 0a0 */
BYTE Reserved4[96]; /* 1a0 */
} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
+#endif
static ADDRESS_MODE get_selector_type(HANDLE hThread, const WOW64_CONTEXT *ctx, WORD sel)
{
@@ -77,18 +79,18 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
switch (addr->Mode)
{
case AddrModeReal:
- return (void*)((DWORD)(LOWORD(addr->Segment) << 4) + (DWORD)addr->Offset);
+ return (void*)((DWORD_PTR)(LOWORD(addr->Segment) << 4) + (DWORD_PTR)addr->Offset);
case AddrMode1632:
if (!(addr->Segment & 4) || ((addr->Segment >> 3) < 17))
- return (void*)(DWORD)addr->Offset;
+ return (void*)(DWORD_PTR)addr->Offset;
/* fall through */
case AddrMode1616:
if (!dbg_curr_process->process_io->get_selector(hThread, addr->Segment, &le)) return NULL;
return (void*)((le.HighWord.Bits.BaseHi << 24) +
(le.HighWord.Bits.BaseMid << 16) + le.BaseLow +
- (DWORD)addr->Offset);
+ (DWORD_PTR)addr->Offset);
case AddrModeFlat:
- return (void*)(DWORD)addr->Offset;
+ return (void*)(DWORD_PTR)addr->Offset;
}
return NULL;
}
@@ -502,7 +504,7 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
if (!fetch_value((const char*)insn + 1, operand_size, &delta))
return FALSE;
callee->Segment = dbg_context.x86.SegCs;
- callee->Offset = (DWORD)insn + 1 + (operand_size / 8) + delta;
+ callee->Offset = (DWORD_PTR)insn + 1 + (operand_size / 8) + delta;
return TRUE;
case 0x9a: /* absolute far call */
@@ -589,11 +591,11 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
}
if (((ch >> 3) & 0x07) == 0x03) /* LCALL */
{
- if (!dbg_read_memory((const char*)dst + operand_size, &segment, sizeof(segment)))
+ if (!dbg_read_memory((const char*)(UINT_PTR)dst + operand_size, &segment, sizeof(segment)))
return FALSE;
}
else segment = dbg_context.x86.SegCs;
- if (!dbg_read_memory((const char*)dst, &delta, sizeof(delta)))
+ if (!dbg_read_memory((const char*)(UINT_PTR)dst, &delta, sizeof(delta)))
return FALSE;
callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context.x86,
segment);
@@ -643,7 +645,7 @@ static BOOL be_i386_is_jump(const void* insn, ADDRESS64* jumpee)
if (!fetch_value((const char*)insn + 1, operand_size, &delta))
return FALSE;
jumpee->Segment = dbg_context.x86.SegCs;
- jumpee->Offset = (DWORD)insn + 1 + (operand_size / 8) + delta;
+ jumpee->Offset = (DWORD_PTR)insn + 1 + (operand_size / 8) + delta;
return TRUE;
default: WINE_FIXME("unknown %x\n", ch); return FALSE;
}
@@ -733,7 +735,7 @@ static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* p
bits = DR7_RW_WRITE;
hw_bp:
if ((reg = be_i386_get_unused_DR(ctx, &pr)) == -1) return FALSE;
- *pr = (DWORD)addr;
+ *pr = (DWORD_PTR)addr;
if (type != be_xpoint_watch_exec) switch (size)
{
case 4: bits |= DR7_LEN_4; break;
diff --git a/programs/winedbg/db_disasm.c b/programs/winedbg/db_disasm.c
index 9bdfb90..f57f009 100644
--- a/programs/winedbg/db_disasm.c
+++ b/programs/winedbg/db_disasm.c
@@ -64,7 +64,7 @@
#include "debugger.h"
-#ifdef __i386__
+#if defined(__i386__) || defined(__x86_64__)
/*
* Switch to disassemble 16-bit code.
@@ -1225,7 +1225,7 @@ static void db_print_address(const char *seg, int size, struct i_addr *addrp, in
void* a2;
dbg_printf("0x%x -> ", addrp->disp);
- if (!dbg_read_memory((void*)addrp->disp, &a1, sizeof(a1))) {
+ if (!dbg_read_memory((void*)(INT_PTR)addrp->disp, &a1, sizeof(a1))) {
dbg_printf("(invalid source)");
} else if (!dbg_read_memory(a1, &a2, sizeof(a2))) {
dbg_printf("(invalid destination)");
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index b5ffd76..1ac4187 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -284,6 +284,7 @@ extern struct backend_cpu be_i386;
#elif defined(__powerpc__)
extern struct backend_cpu be_ppc;
#elif defined(__x86_64__)
+extern struct backend_cpu be_i386;
extern struct backend_cpu be_x86_64;
#elif defined(__arm__) && !defined(__ARMEB__)
extern struct backend_cpu be_arm;
@@ -296,21 +297,13 @@ extern struct backend_cpu be_arm64;
struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h)
{
struct dbg_process* p;
+ BOOL wow64;
if ((p = dbg_get_process(pid)))
- {
- if (p->handle != 0)
- {
- WINE_ERR("Process (%04x) is already defined\n", pid);
- }
- else
- {
- p->handle = h;
- p->process_io = pio;
- p->imageName = NULL;
- }
return p;
- }
+
+ if (!h)
+ h = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if (!(p = HeapAlloc(GetProcessHeap(), 0, sizeof(struct dbg_process)))) return NULL;
p->handle = h;
@@ -333,12 +326,14 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
list_add_head(&dbg_process_list, &p->entry);
+ IsWow64Process(h, &wow64);
+
#ifdef __i386__
p->be_cpu = &be_i386;
#elif defined(__powerpc__)
p->be_cpu = &be_ppc;
#elif defined(__x86_64__)
- p->be_cpu = &be_x86_64;
+ p->be_cpu = wow64 ? &be_i386 : &be_x86_64;
#elif defined(__arm__) && !defined(__ARMEB__)
p->be_cpu = &be_arm;
#elif defined(__aarch64__) && !defined(__AARCH64EB__)
--
2.7.4
June 13, 2018
Re: [PATCH 2/5] wined3d: Get rid of unnecessary enum wined3d_data_type values.
by Józef Kucia
On Wed, Jun 13, 2018 at 8:29 PM, Matteo Bruni <matteo.mystral(a)gmail.com> wrote:
> 2018-06-13 10:37 GMT+02:00 Józef Kucia <joseph.kucia(a)gmail.com>:
>> On Tue, Jun 12, 2018 at 6:41 PM, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
>>> diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
>>> index 20d4f0773dd..a2c3f00559a 100644
>>> --- a/dlls/wined3d/shader.c
>>> +++ b/dlls/wined3d/shader.c
>>> @@ -2134,14 +2134,6 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
>>> shader_addline(buffer, " (uint)");
>>> break;
>>>
>>> - case WINED3D_DATA_UNORM:
>>> - shader_addline(buffer, " (unorm)");
>>> - break;
>>> -
>>> - case WINED3D_DATA_SNORM:
>>> - shader_addline(buffer, " (snorm)");
>>> - break;
>>> -
>>
>> I don't like that it won't print the correct data type for
>> declarations. For example, after the patch "dcl_uav_typed_texture2d
>> (snorm) u0" is "dcl_uav_typed_texture2d (float) u0".
>
> Yeah, it's a downside of the "simplification". Would printing
> something more generic like "(float / unorm / snorm)" work for you?
> Any other idea?
Perhaps it's possible to keep wined3d_data_type for
wined3d_shader_semantic, or preserve the type information in
wined3d_shader_semantic differently.
June 13, 2018
Re: [PATCH 6/6] dxgi: Get supported feature levels from wined3d caps.
by Józef Kucia
On Wed, Jun 13, 2018 at 8:31 PM, Matteo Bruni <matteo.mystral(a)gmail.com> wrote:
> 2018-06-13 12:24 GMT+02:00 Józef Kucia <jkucia(a)codeweavers.com>:
>
>> On a side note, handling of feature levels 9_x appears to be incorrect
>> (AFAIK feature levels 9_x always use SM2 shaders).
>
> True, but it's complicated...
> Looking around https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).…
> you can see that feature level 9_3 e.g. mandates support for max
> texture size >= 4096, which is only guaranteed by SM3-level hardware
> (https://msdn.microsoft.com/en-us/library/windows/desktop/bb219845(v=vs.85).…)
> IIRC there were a few of those, which is why I decided to require SM3
> for 9_3 even though the shaders themselves are going to be SM2 only.
>
Right, feature level checks should not be based solely on shader model versions.
June 13, 2018
[PATCH] winex11.drv: Refcount the vulkan surface window
by Andrew Eikum
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
---
Modeled after the opengl refcounting. This prevents us getting X
errors from using client_window after it's been destroyed.
dlls/winex11.drv/vulkan.c | 61 ++++++++++++++++++++++++++++++++++-----
dlls/winex11.drv/window.c | 1 +
dlls/winex11.drv/x11drv.h | 1 +
3 files changed, 55 insertions(+), 8 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 7e252326b5..7eca31bdea 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -41,11 +41,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
#ifdef SONAME_LIBVULKAN
+static CRITICAL_SECTION context_section;
+static CRITICAL_SECTION_DEBUG critsect_debug =
+{
+ 0, 0, &context_section,
+ { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
+ 0, 0, { (DWORD_PTR)(__FILE__ ": context_section") }
+};
+static CRITICAL_SECTION context_section = { &critsect_debug, -1, 0, 0, 0, 0 };
+
+static XContext vulkan_hwnd_context;
+
typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
#define VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR 1000004000
struct wine_vk_surface
{
+ LONG ref;
Window window;
VkSurfaceKHR surface; /* native surface */
};
@@ -115,6 +127,8 @@ static BOOL WINAPI wine_vk_init(INIT_ONCE *once, void *param, void **context)
LOAD_FUNCPTR(vkQueuePresentKHR)
#undef LOAD_FUNCPTR
+ vulkan_hwnd_context = XUniqueContext();
+
return TRUE;
fail:
@@ -171,20 +185,35 @@ static VkResult wine_vk_instance_convert_create_info(const VkInstanceCreateInfo
return VK_SUCCESS;
}
-static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface *surface)
+static struct wine_vk_surface *wine_vk_surface_grab(struct wine_vk_surface *surface)
{
- if (!surface)
+ InterlockedIncrement(&surface->ref);
+ return surface;
+}
+
+static void wine_vk_surface_release(struct wine_vk_surface *surface)
+{
+ if (InterlockedDecrement(&surface->ref))
return;
- /* vkDestroySurfaceKHR must handle VK_NULL_HANDLE (0) for surface. */
- pvkDestroySurfaceKHR(instance, surface->surface, NULL /* allocator */);
-
if (surface->window)
XDestroyWindow(gdi_display, surface->window);
heap_free(surface);
}
+void wine_vk_surface_destroy(HWND hwnd)
+{
+ struct wine_vk_surface *surface;
+ EnterCriticalSection(&context_section);
+ if (!XFindContext(gdi_display, (XID)hwnd, vulkan_hwnd_context, (char **)&surface))
+ {
+ wine_vk_surface_release(surface);
+ }
+ XDeleteContext(gdi_display, (XID)hwnd, vulkan_hwnd_context);
+ LeaveCriticalSection(&context_section);
+}
+
static VkResult X11DRV_vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain,
uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *index)
{
@@ -245,7 +274,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
{
VkResult res;
VkXlibSurfaceCreateInfoKHR create_info_host;
- struct wine_vk_surface *x11_surface;
+ struct wine_vk_surface *x11_surface, *prev;
TRACE("%p %p %p %p\n", instance, create_info, allocator, surface);
@@ -263,6 +292,8 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
if (!x11_surface)
return VK_ERROR_OUT_OF_HOST_MEMORY;
+ x11_surface->ref = 1;
+
x11_surface->window = create_client_window(create_info->hwnd, &default_visual);
if (!x11_surface->window)
{
@@ -286,13 +317,21 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
goto err;
}
+ EnterCriticalSection(&context_section);
+ if (!XFindContext(gdi_display, (XID)create_info->hwnd, vulkan_hwnd_context, (char **)&prev))
+ {
+ wine_vk_surface_release(prev);
+ }
+ XSaveContext(gdi_display, (XID)create_info->hwnd, vulkan_hwnd_context, (char *)wine_vk_surface_grab(x11_surface));
+ LeaveCriticalSection(&context_section);
+
*surface = (uintptr_t)x11_surface;
TRACE("Created surface=0x%s\n", wine_dbgstr_longlong(*surface));
return VK_SUCCESS;
err:
- wine_vk_surface_destroy(instance, x11_surface);
+ wine_vk_surface_release(x11_surface);
return res;
}
@@ -316,7 +355,13 @@ static void X11DRV_vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface
if (allocator)
FIXME("Support for allocation callbacks not implemented yet\n");
- wine_vk_surface_destroy(instance, x11_surface);
+ /* vkDestroySurfaceKHR must handle VK_NULL_HANDLE (0) for surface. */
+ if (x11_surface)
+ {
+ pvkDestroySurfaceKHR(instance, x11_surface->surface, NULL /* allocator */);
+
+ wine_vk_surface_release(x11_surface);
+ }
}
static void X11DRV_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain,
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 5fecd9a17b..a848dc61e1 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1719,6 +1719,7 @@ void CDECL X11DRV_DestroyWindow( HWND hwnd )
release_win_data( data );
HeapFree( GetProcessHeap(), 0, data );
destroy_gl_drawable( hwnd );
+ wine_vk_surface_destroy( hwnd );
}
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 85a05a904a..939c2e7f3b 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -586,6 +586,7 @@ extern XIC X11DRV_get_ic( HWND hwnd ) DECLSPEC_HIDDEN;
extern void sync_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
extern void set_gl_drawable_parent( HWND hwnd, HWND parent ) DECLSPEC_HIDDEN;
extern void destroy_gl_drawable( HWND hwnd ) DECLSPEC_HIDDEN;
+extern void wine_vk_surface_destroy( HWND hwnd ) DECLSPEC_HIDDEN;
extern void wait_for_withdrawn_state( HWND hwnd, BOOL set ) DECLSPEC_HIDDEN;
extern Window init_clip_window(void) DECLSPEC_HIDDEN;
--
2.17.1
June 13, 2018
Re: [PATCH 1/2] winmm/tests: Avoid and ARRAY_SIZE-like macro
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39112
Your paranoid android.
=== w8 (32 bit mmio) ===
TestBot process got stuck or died unexpectedly
The previous 1 run(s) terminated abnormally
June 13, 2018
Re: [PATCH 1/2] dsound/tests: Avoid ARRAY_SIZE-like macros
by Michael Stefaniuc
On 06/13/2018 08:54 PM, Marvin wrote:
> While running your changed tests on Windows, I think I found new failures.
> Being a bot and all I'm not very good at pattern recognition, so I might be
> wrong, but could you please double-check?
> Full results can be found at
> https://testbot.winehq.org/JobDetails.pl?Key=39109
>
> Your paranoid android.
>
>
> === w8 (32 bit ds3d8) ===
> TestBot process got stuck or died unexpectedly
> The previous 1 run(s) terminated abnormally
Testbot issue, looks like the start time is missing:
0e90:ds3d8: 757 tests executed (0 marked as todo, 0 failures), 0 skipped.
dsound:ds3d8:0e90 done (0) in 0s
bye
michael
June 13, 2018
Re: [PATCH 1/2] dsound/tests: Avoid ARRAY_SIZE-like macros
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39109
Your paranoid android.
=== w8 (32 bit ds3d8) ===
TestBot process got stuck or died unexpectedly
The previous 1 run(s) terminated abnormally
June 13, 2018
Re: [PATCH 6/6] dxgi: Get supported feature levels from wined3d caps.
by Matteo Bruni
2018-06-13 12:24 GMT+02:00 Józef Kucia <jkucia(a)codeweavers.com>:
> On a side note, handling of feature levels 9_x appears to be incorrect
> (AFAIK feature levels 9_x always use SM2 shaders).
True, but it's complicated...
Looking around https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).…
you can see that feature level 9_3 e.g. mandates support for max
texture size >= 4096, which is only guaranteed by SM3-level hardware
(https://msdn.microsoft.com/en-us/library/windows/desktop/bb219845(v=vs.85).…)
IIRC there were a few of those, which is why I decided to require SM3
for 9_3 even though the shaders themselves are going to be SM2 only.
June 13, 2018
[PATCH 2/2] winmm/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/winmm/tests/joystick.c | 4 ++--
dlls/winmm/tests/midi.c | 2 +-
dlls/winmm/tests/mmio.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/winmm/tests/joystick.c b/dlls/winmm/tests/joystick.c
index 5714001315..7531bd6481 100644
--- a/dlls/winmm/tests/joystick.c
+++ b/dlls/winmm/tests/joystick.c
@@ -139,7 +139,7 @@ static void test_api(void)
/* Try some unusual period values for joySetCapture and unusual threshold values for joySetThreshold.
* Windows XP allows almost all test values, Windows 8 will return error on most test values, Windows
* 98 allows anything but cuts the values to their maximum supported values internally. */
- for (i = 0; i < sizeof(period) / sizeof(period[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(period); i++)
{
ret = joySetCapture(window, joyid, period[i], FALSE);
if (win8 && ((1 << i) & period_win8_error))
@@ -190,7 +190,7 @@ static void test_api(void)
ok(ret == JOYERR_NOERROR, "Expected %d, got %d\n", JOYERR_NOERROR, ret);
infoex.ex.dwSize = sizeof(infoex.ex);
- for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(flags); i++)
{
infoex.ex.dwFlags = flags[i];
ret = joyGetPosEx(joyid, &infoex.ex);
diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c
index fe3cc5c876..3b8bd2287d 100644
--- a/dlls/winmm/tests/midi.c
+++ b/dlls/winmm/tests/midi.c
@@ -549,7 +549,7 @@ static void CALLBACK time_stamp_callback(HMIDIOUT hmo, UINT msg, DWORD_PTR insta
struct time_stamp_records *records = (struct time_stamp_records *)instance;
switch (msg) {
case MM_MOM_POSITIONCB:
- if (records->count < sizeof(records->time_stamp)/sizeof(records->time_stamp[0]))
+ if (records->count < ARRAY_SIZE(records->time_stamp))
records->time_stamp[records->count] = GetTickCount();
records->count++;
break;
diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c
index 48367ee6d9..5501c319c5 100644
--- a/dlls/winmm/tests/mmio.c
+++ b/dlls/winmm/tests/mmio.c
@@ -606,7 +606,7 @@ static LRESULT CALLBACK mmio_test_IOProc(LPSTR lpMMIOInfo, UINT uMessage, LPARAM
case MMIOM_OPEN:
if (lpInfo->fccIOProc == FOURCC_DOS)
lpInfo->fccIOProc = mmioFOURCC('F', 'A', 'I', 'L');
- for (i = 0; i < sizeof(lpInfo->adwInfo) / sizeof(*lpInfo->adwInfo); i++)
+ for (i = 0; i < ARRAY_SIZE(lpInfo->adwInfo); i++)
ok(lpInfo->adwInfo[i] == 0, "[%d] Expected 0, got %u\n", i, lpInfo->adwInfo[i]);
return MMSYSERR_NOERROR;
case MMIOM_CLOSE:
--
2.14.4
June 13, 2018
[PATCH 1/2] winmm/tests: Avoid and ARRAY_SIZE-like macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/winmm/tests/capture.c | 2 +-
dlls/winmm/tests/wave.c | 2 +-
dlls/winmm/tests/winmm_test.h | 1 -
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/winmm/tests/capture.c b/dlls/winmm/tests/capture.c
index fd4005cdab..ba71f9ca80 100644
--- a/dlls/winmm/tests/capture.c
+++ b/dlls/winmm/tests/capture.c
@@ -398,7 +398,7 @@ static void wave_in_test_device(UINT_PTR device)
HeapFree(GetProcessHeap(), 0, nameA);
- for (f=0;f<NB_WIN_FORMATS;f++) {
+ for (f = 0; f < ARRAY_SIZE(win_formats); f++) {
format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=win_formats[f][3];
format.wBitsPerSample=win_formats[f][2];
diff --git a/dlls/winmm/tests/wave.c b/dlls/winmm/tests/wave.c
index 8d7dfd6b68..b402e21917 100644
--- a/dlls/winmm/tests/wave.c
+++ b/dlls/winmm/tests/wave.c
@@ -1041,7 +1041,7 @@ static void wave_out_test_device(UINT_PTR device)
CALLBACK_EVENT,&capsA,TRUE,FALSE,FALSE);
}
- for (f=0;f<NB_WIN_FORMATS;f++) {
+ for (f = 0; f < ARRAY_SIZE(win_formats); f++) {
format.wFormatTag=WAVE_FORMAT_PCM;
format.nChannels=win_formats[f][3];
format.wBitsPerSample=win_formats[f][2];
diff --git a/dlls/winmm/tests/winmm_test.h b/dlls/winmm/tests/winmm_test.h
index 177dc2e837..d5fb70afbd 100644
--- a/dlls/winmm/tests/winmm_test.h
+++ b/dlls/winmm/tests/winmm_test.h
@@ -68,7 +68,6 @@ static const unsigned int win_formats[][4] = {
{WAVE_FORMAT_96M16, 96000, 16, 1},
{WAVE_FORMAT_96S16, 96000, 16, 2}
};
-#define NB_WIN_FORMATS (sizeof(win_formats)/sizeof(*win_formats))
extern const char* dev_name(int);
extern const char* wave_open_flags(DWORD);
--
2.14.4
June 13, 2018
[PATCH] ole32/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/ole32/tests/compobj.c | 6 +++---
dlls/ole32/tests/dragdrop.c | 2 +-
dlls/ole32/tests/marshal.c | 4 ++--
dlls/ole32/tests/moniker.c | 19 ++++++++++---------
dlls/ole32/tests/ole2.c | 8 ++++----
dlls/ole32/tests/ole_server.c | 2 +-
dlls/ole32/tests/propvariant.c | 2 +-
dlls/ole32/tests/storage32.c | 6 +++---
8 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index c43e86c605..352cfbf4e9 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -197,7 +197,7 @@ static BOOL create_manifest_file(const char *filename, const char *manifest)
WCHAR path[MAX_PATH];
MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
- GetFullPathNameW(path, sizeof(manifest_path)/sizeof(WCHAR), manifest_path, NULL);
+ GetFullPathNameW(path, ARRAY_SIZE(manifest_path), manifest_path, NULL);
manifest_len = strlen(manifest);
file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
@@ -2334,7 +2334,7 @@ static void test_OleRegGetUserType(void)
}
/* test using registered CLSID */
- StringFromGUID2(&CLSID_non_existent, clsidW, sizeof(clsidW)/sizeof(clsidW[0]));
+ StringFromGUID2(&CLSID_non_existent, clsidW, ARRAY_SIZE(clsidW));
ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsidkeyW, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &clsidhkey, &disposition);
if (!ret)
@@ -2522,7 +2522,7 @@ static void flush_messages(void)
static LRESULT CALLBACK cowait_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
- if(cowait_msgs_last < sizeof(cowait_msgs)/sizeof(*cowait_msgs))
+ if(cowait_msgs_last < ARRAY_SIZE(cowait_msgs))
cowait_msgs[cowait_msgs_last++] = msg;
if(msg == WM_DDE_FIRST)
return 6;
diff --git a/dlls/ole32/tests/dragdrop.c b/dlls/ole32/tests/dragdrop.c
index 09112b8f0d..77e47d723d 100644
--- a/dlls/ole32/tests/dragdrop.c
+++ b/dlls/ole32/tests/dragdrop.c
@@ -701,7 +701,7 @@ static void test_DoDragDrop(void)
GetWindowRect(hwnd, &rect);
ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n");
- for (seq = 0; seq < sizeof(call_lists) / sizeof(call_lists[0]); seq++)
+ for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++)
{
DWORD effect_in;
trace("%d\n", seq);
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index 39867394fb..c1d53942da 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -3941,8 +3941,8 @@ static const char *debugstr_iid(REFIID riid)
WCHAR bufferW[39];
char buffer[39];
LONG name_size = sizeof(name);
- StringFromGUID2(riid, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
- WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL);
+ StringFromGUID2(riid, bufferW, ARRAY_SIZE(bufferW));
+ WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL);
if (RegOpenKeyExA(HKEY_CLASSES_ROOT, "Interface", 0, KEY_QUERY_VALUE, &hkeyInterface) != ERROR_SUCCESS)
{
memcpy(name, buffer, sizeof(buffer));
diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c
index 7b67dfdb95..7302ab0f21 100644
--- a/dlls/ole32/tests/moniker.c
+++ b/dlls/ole32/tests/moniker.c
@@ -38,7 +38,6 @@
#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
#define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks)
#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
-#define COUNTOF(x) (sizeof(x) / sizeof(x[0]))
#define CHECK_EXPECTED_METHOD(method_name) \
do { \
@@ -905,7 +904,7 @@ static void test_MkParseDisplayName(void)
hr = CreateBindCtx(0, &pbc);
ok_ole_success(hr, CreateBindCtx);
- for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
{
eaten = 0xdeadbeef;
pmk = (IMoniker *)0xdeadbeef;
@@ -947,7 +946,7 @@ static void test_MkParseDisplayName(void)
pmk = NULL;
hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
ok_ole_success(hr, MkParseDisplayName);
- ok(eaten == sizeof(wszDisplayName)/sizeof(WCHAR) - 1,
+ ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
"Processed character count should have been 43 instead of %u\n", eaten);
if (pmk)
{
@@ -969,7 +968,7 @@ static void test_MkParseDisplayName(void)
pmk = NULL;
hr = MkParseDisplayName(pbc, wszDisplayNameRunning, &eaten, &pmk);
ok_ole_success(hr, MkParseDisplayName);
- ok(eaten == sizeof(wszDisplayNameRunning)/sizeof(WCHAR) - 1,
+ ok(eaten == ARRAY_SIZE(wszDisplayNameRunning) - 1,
"Processed character count should have been 15 instead of %u\n", eaten);
if (pmk)
{
@@ -987,7 +986,7 @@ static void test_MkParseDisplayName(void)
expected_display_name = wszDisplayNameProgId1;
hr = MkParseDisplayName(pbc, wszDisplayNameProgId1, &eaten, &pmk);
ok_ole_success(hr, MkParseDisplayName);
- ok(eaten == sizeof(wszDisplayNameProgId1)/sizeof(WCHAR) - 1,
+ ok(eaten == ARRAY_SIZE(wszDisplayNameProgId1) - 1,
"Processed character count should have been 8 instead of %u\n", eaten);
if (pmk)
{
@@ -999,7 +998,7 @@ static void test_MkParseDisplayName(void)
expected_display_name = wszDisplayNameProgId2;
hr = MkParseDisplayName(pbc, wszDisplayNameProgId2, &eaten, &pmk);
ok_ole_success(hr, MkParseDisplayName);
- ok(eaten == sizeof(wszDisplayNameProgId2)/sizeof(WCHAR) - 1,
+ ok(eaten == ARRAY_SIZE(wszDisplayNameProgId2) - 1,
"Processed character count should have been 8 instead of %u\n", eaten);
if (pmk)
{
@@ -1021,7 +1020,8 @@ static void test_MkParseDisplayName(void)
GetSystemDirectoryA(szDisplayNameFile, sizeof(szDisplayNameFile));
strcat(szDisplayNameFile, "\\kernel32.dll");
- len = MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile, sizeof(wszDisplayNameFile)/sizeof(wszDisplayNameFile[0]));
+ len = MultiByteToWideChar(CP_ACP, 0, szDisplayNameFile, -1, wszDisplayNameFile,
+ ARRAY_SIZE(wszDisplayNameFile));
hr = MkParseDisplayName(pbc, wszDisplayNameFile, &eaten, &pmk);
ok_ole_success(hr, MkParseDisplayName);
ok(eaten == len - 1, "Processed character count should have been %d instead of %u\n", len - 1, eaten);
@@ -1034,7 +1034,8 @@ static void test_MkParseDisplayName(void)
hr = MkParseDisplayName(pbc, wszDisplayName, &eaten, &pmk);
ok_ole_success(hr, MkParseDisplayName);
- ok(eaten == sizeof(wszDisplayName)/sizeof(WCHAR) - 1, "Processed character count should have been 43 instead of %u\n", eaten);
+ ok(eaten == ARRAY_SIZE(wszDisplayName) - 1,
+ "Processed character count should have been 43 instead of %u\n", eaten);
if (pmk)
{
@@ -1550,7 +1551,7 @@ static void test_file_monikers(void)
trace("ACP is %u\n", GetACP());
- for (i = 0; i < COUNTOF(wszFile); ++i)
+ for (i = 0; i < ARRAY_SIZE(wszFile); ++i)
{
int j ;
if (i == 2)
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index 74dadd4048..48c9e0cbab 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -1728,7 +1728,7 @@ static void test_data_cache(void)
{ NULL, 0 }
};
- GetSystemDirectoryA(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0]));
+ GetSystemDirectoryA(szSystemDir, ARRAY_SIZE(szSystemDir));
expected_method_list = methods_cacheinitnew;
@@ -1860,7 +1860,7 @@ static void test_data_cache(void)
hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
ok_ole_success(hr, "IOleCache_Cache");
- MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, sizeof(wszPath)/sizeof(wszPath[0]));
+ MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, ARRAY_SIZE(wszPath));
memcpy(wszPath+lstrlenW(wszPath), wszShell32, sizeof(wszShell32));
fmtetc.cfFormat = CF_METAFILEPICT;
@@ -2490,7 +2490,7 @@ static void test_data_cache_init(void)
{ &CLSID_Picture_EnhMetafile, 3, 1 }
};
- for (i = 0; i < sizeof(data) / sizeof(data[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(data); i++)
{
hr = CreateDataCache( NULL, data[i].clsid, &IID_IOleCache2, (void **)&cache );
ok( hr == S_OK, "got %08x\n", hr );
@@ -4541,7 +4541,7 @@ static void test_data_cache_contents(void)
{ &stg_def_9, &stg_def_9_saved },
};
- for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_data); i++)
{
if (winetest_debug > 1)
trace("start testing storage def %d\n", i);
diff --git a/dlls/ole32/tests/ole_server.c b/dlls/ole32/tests/ole_server.c
index 77abda47aa..f5c845de26 100644
--- a/dlls/ole32/tests/ole_server.c
+++ b/dlls/ole32/tests/ole_server.c
@@ -69,7 +69,7 @@ static const char *debugstr_guid(const GUID *guid)
if (!guid) return "(null)";
- for (i = 0; i < sizeof(guid_name)/sizeof(guid_name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid_name); i++)
{
if (IsEqualIID(guid, guid_name[i].guid))
return guid_name[i].name;
diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c
index ade45fbd42..97c4eec4ca 100644
--- a/dlls/ole32/tests/propvariant.c
+++ b/dlls/ole32/tests/propvariant.c
@@ -189,7 +189,7 @@ static void test_validtypes(void)
ok(U(propvar).uhVal.QuadPart == 0, "expected 0, got %#x/%#x\n",
U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart);
- for (i = 0; i < sizeof(valid_types)/sizeof(valid_types[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(valid_types); i++)
{
VARTYPE vt;
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 43c0c28ad5..9d2c970e86 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -2084,9 +2084,9 @@ static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD
{
int i, j, idx = 0;
- for (i = 0; i < sizeof(access_modes)/sizeof(access_modes[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(access_modes); i++)
{
- for (j = 0; j < sizeof(share_modes)/sizeof(share_modes[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(share_modes); j++)
{
DWORD lasterr;
HANDLE hfile;
@@ -3490,7 +3490,7 @@ static void test_locking(void)
IStorage *stg;
HRESULT hr;
- for (i=0; i<sizeof(lock_tests)/sizeof(lock_tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(lock_tests); i++)
{
const struct lock_test *current = &lock_tests[i];
BOOL any_failure = FALSE;
--
2.14.4
June 13, 2018
[PATCH 2/2] dsound/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dsound/tests/ds3d.c | 2 +-
dlls/dsound/tests/dsound.c | 15 ++++++---------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c
index d4356c2b6c..1b44afff8d 100644
--- a/dlls/dsound/tests/ds3d.c
+++ b/dlls/dsound/tests/ds3d.c
@@ -139,7 +139,7 @@ const char * getDSBCAPS(DWORD xmask) {
buffer[0] = 0;
- for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++) {
+ for (i = 0; i < ARRAY_SIZE(flags); i++) {
if ((flags[i].mask & xmask) == flags[i].mask) {
if (first)
first = FALSE;
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 375abc8761..0807d43788 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -1004,8 +1004,8 @@ static HRESULT test_frequency(LPGUID lpGuid)
if (rc!=DS_OK)
goto EXIT1;
- for (f=0;f<sizeof(fmts)/sizeof(fmts[0]);f++) {
- for (r=0;r<sizeof(rates)/sizeof(rates[0]);r++) {
+ for (f = 0; f < ARRAY_SIZE(fmts); f++) {
+ for (r = 0; r < ARRAY_SIZE(rates); r++) {
init_format(&wfx,WAVE_FORMAT_PCM,11025,fmts[f].bits,
fmts[f].channels);
secondary=NULL;
@@ -1135,7 +1135,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
int i;
/* Prepare notify events */
- for (i=0;i<sizeof(event)/sizeof(event[0]);i++) {
+ for (i = 0; i < ARRAY_SIZE(event); i++) {
event[i] = CreateEventW(NULL, FALSE, FALSE, NULL);
}
@@ -1174,8 +1174,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
"IDirectSound_DuplicateSoundBuffer failed %08x\n",rc);
trace("testing duplicated buffer without notifications.\n");
- test_notify(duplicated,sizeof(event)/sizeof(event[0]),
- event,WAIT_TIMEOUT);
+ test_notify(duplicated, ARRAY_SIZE(event), event, WAIT_TIMEOUT);
rc=IDirectSoundBuffer_QueryInterface(duplicated,
&IID_IDirectSoundNotify,
@@ -1192,8 +1191,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
"failed %08x\n",rc);
trace("testing duplicated buffer with a notification.\n");
- test_notify(duplicated,sizeof(event)/sizeof(event[0]),
- event,WAIT_OBJECT_0+1);
+ test_notify(duplicated, ARRAY_SIZE(event), event, WAIT_OBJECT_0 + 1);
ref=IDirectSoundNotify_Release(dup_notify);
ok(ref==0,"IDirectSoundNotify_Release() has %d references, "
@@ -1204,8 +1202,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
"should have 0\n",ref);
trace("testing original buffer with a notification.\n");
- test_notify(original,sizeof(event)/sizeof(event[0]),
- event,WAIT_OBJECT_0);
+ test_notify(original, ARRAY_SIZE(event), event, WAIT_OBJECT_0);
ref=IDirectSoundBuffer_Release(duplicated);
ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
--
2.14.4
June 13, 2018
[PATCH 1/2] dsound/tests: Avoid ARRAY_SIZE-like macros
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dsound/tests/capture.c | 2 +-
dlls/dsound/tests/dsound.c | 8 ++++----
dlls/dsound/tests/dsound8.c | 8 ++++----
dlls/dsound/tests/dsound_test.h | 2 --
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
index a23d1eb6f6..dada067956 100644
--- a/dlls/dsound/tests/capture.c
+++ b/dlls/dsound/tests/capture.c
@@ -549,7 +549,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
"should have 0\n",ref);
}
- for (f=0;f<NB_FORMATS;f++) {
+ for (f = 0; f < ARRAY_SIZE(formats); f++) {
dscbo=NULL;
init_format(&wfx,WAVE_FORMAT_PCM,formats[f][0],formats[f][1],
formats[f][2]);
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 07c8908add..375abc8761 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -571,8 +571,8 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
"IDirectSound_CreateSoundBuffer() failed to create a primary buffer %08x\n",rc);
if (rc==DS_OK && primary!=NULL) {
- for (f=0;f<NB_FORMATS;f++) {
- for (tag=0;tag<NB_TAGS;tag++) {
+ for (f = 0; f < ARRAY_SIZE(formats); f++) {
+ for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
/* if float, we only want to test 32-bit */
if ((format_tags[tag] == WAVE_FORMAT_IEEE_FLOAT) && (formats[f][1] != 32))
continue;
@@ -718,8 +718,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
if (rc!=DS_OK)
goto EXIT1;
- for (f=0;f<NB_FORMATS;f++) {
- for (tag=0;tag<NB_TAGS;tag++) {
+ for (f = 0; f < ARRAY_SIZE(formats); f++) {
+ for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
WAVEFORMATEXTENSIBLE wfxe;
/* if float, we only want to test 32-bit */
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index a6e3f12ae3..fabd8a037e 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -581,8 +581,8 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
"%08x\n",rc);
if (rc==DS_OK && primary!=NULL) {
- for (f=0;f<NB_FORMATS;f++) {
- for (tag=0;tag<NB_TAGS;tag++) {
+ for (f = 0; f < ARRAY_SIZE(formats); f++) {
+ for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
/* if float, we only want to test 32-bit */
if ((format_tags[tag] == WAVE_FORMAT_IEEE_FLOAT) && (formats[f][1] != 32))
continue;
@@ -727,8 +727,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
if (rc!=DS_OK)
goto EXIT1;
- for (f=0;f<NB_FORMATS;f++) {
- for (tag=0;tag<NB_TAGS;tag++) {
+ for (f = 0; f < ARRAY_SIZE(formats); f++) {
+ for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
WAVEFORMATEXTENSIBLE wfxe;
/* if float, we only want to test 32-bit */
diff --git a/dlls/dsound/tests/dsound_test.h b/dlls/dsound/tests/dsound_test.h
index 8a8f2498d0..04f995e359 100644
--- a/dlls/dsound/tests/dsound_test.h
+++ b/dlls/dsound/tests/dsound_test.h
@@ -71,10 +71,8 @@ static const unsigned int formats[][4]={
{96000, 32, 1, 0 },
{96000, 32, 2, 0 }
};
-#define NB_FORMATS (sizeof(formats)/sizeof(*formats))
static const unsigned int format_tags[] = {WAVE_FORMAT_PCM, WAVE_FORMAT_IEEE_FLOAT};
-#define NB_TAGS (sizeof(format_tags)/sizeof(*format_tags))
/* The time slice determines how often we will service the buffer */
#define TIME_SLICE 31
--
2.14.4
June 13, 2018
Re: [PATCH 2/5] wined3d: Get rid of unnecessary enum wined3d_data_type values.
by Matteo Bruni
2018-06-13 10:37 GMT+02:00 Józef Kucia <joseph.kucia(a)gmail.com>:
> On Tue, Jun 12, 2018 at 6:41 PM, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
>> diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
>> index 20d4f0773dd..a2c3f00559a 100644
>> --- a/dlls/wined3d/shader.c
>> +++ b/dlls/wined3d/shader.c
>> @@ -2134,14 +2134,6 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
>> shader_addline(buffer, " (uint)");
>> break;
>>
>> - case WINED3D_DATA_UNORM:
>> - shader_addline(buffer, " (unorm)");
>> - break;
>> -
>> - case WINED3D_DATA_SNORM:
>> - shader_addline(buffer, " (snorm)");
>> - break;
>> -
>
> I don't like that it won't print the correct data type for
> declarations. For example, after the patch "dcl_uav_typed_texture2d
> (snorm) u0" is "dcl_uav_typed_texture2d (float) u0".
Yeah, it's a downside of the "simplification". Would printing
something more generic like "(float / unorm / snorm)" work for you?
Any other idea?
June 13, 2018
[PATCH 7/7] wsdapi: Build types list when parsing Probe message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 91
++++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/tests/discovery.c | 2 +-
dlls/wsdapi/wsdapi_internal.h | 1 +
dlls/wsdapi/xml.c | 16 ++++++++
4 files changed, 108 insertions(+), 2 deletions(-)
June 13, 2018
[PATCH 6/7] wsdapi: Implement probe message parsing.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 40
+++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/tests/discovery.c | 4 ++--
2 files changed, 41 insertions(+), 3 deletions(-)
June 13, 2018
[PATCH 5/7] wsdapi: Return "any" headers in read_message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 40
++++++++++++++++++++++++++++++++++++++++
dlls/wsdapi/tests/discovery.c | 2 +-
2 files changed, 41 insertions(+), 1 deletion(-)
June 13, 2018
[PATCH 4/7] wsdapi: Add initial support for reading messages; identify Probe message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 388
+++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/tests/discovery.c | 6 +-
2 files changed, 389 insertions(+), 5 deletions(-)
June 13, 2018
[PATCH 3/7] wsdapi: Add stub for Probe message parsing, prepare notification sink message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/network.c | 60
++++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/soap.c | 6 +++++
dlls/wsdapi/wsdapi_internal.h | 5 ++++
3 files changed, 70 insertions(+), 1 deletion(-)
June 13, 2018
[PATCH 2/7] wsdapi: Add critical section around notification sinks.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/discovery.c | 9 +++++++++
dlls/wsdapi/wsdapi_internal.h | 1 +
2 files changed, 10 insertions(+)
June 13, 2018
[PATCH 1/7] wsdapi: Add support for listening for UDP multicast broadcasts.
by Owen Rudge
v2: Ensure thread handles are closed in terminate_networking
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/network.c | 287
+++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/wsdapi_internal.h | 4 +
2 files changed, 290 insertions(+), 1 deletion(-)
June 13, 2018
Re: [PATCH v2 1/4] kernel32: Return BIOS info from GetSystemFirmwareTable on Linux
by Alex Henrie
On Wed, Jun 13, 2018 at 9:36 AM Huw Davies <huw(a)codeweavers.com> wrote:
>
> On 13 Jun 2018, at 15:32, Alex Henrie <alexhenrie24(a)gmail.com> wrote:
> > On Thu, Jun 7, 2018 at 7:25 AM Huw Davies <huw(a)codeweavers.com> wrote:
> >>
> >> On Mon, May 28, 2018 at 10:05:26PM -0600, Alex Henrie wrote:
> >>> /***********************************************************************
> >>> * GetSystemFirmwareTable (KERNEL32.@)
> >>> */
> >>> UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD size)
> >>> {
> >>> - FIXME("(%d %d %p %d):stub\n", provider, id, buffer, size);
> >>> + FIXME("(%08x %08x %p %d): semi-stub\n", provider, id, buffer, size);
> >>
> >> This should probably be forwarded to
> >> NtQuerySystemInformation(SystemFirmwareTableInformation, ...).
> >
> > NtQuerySystemInformation(SystemFirmwareTableInformation, ...) just
> > returns STATUS_NOT_IMPLEMENTED on Windows.
>
> You’re probably not calling it correctly. See:
> https://testbot.winehq.org/JobDetails.pl?Key=39104
You're right, thanks for the example! I was getting
STATUS_NOT_IMPLEMENTED because I had not filled in the
_SYSTEM_FIRMWARE_TABLE_INFORMATION struct. In fact, I didn't even know
that anyone had figured out that struct's definition. Looks like you
got it from <http://www.exploit-monday.com/2013_06_16_archive.html>.
I'll send a revised patch set tonight.
-Alex
June 13, 2018
Re: [PATCH 1/2 v2] winex11.drv: Clean up client window pointer when destroying Vulkan surface
by Andrew Eikum
Hm, I guess this breaks the case where the whole window is destroyed
before the client window, since the HWND is no longer valid. I'll keep
working on it.
Andrew
On Wed, Jun 13, 2018 at 10:05:18AM -0500, Andrew Eikum wrote:
> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
> ---
>
> v2: Use gdi_display during XDestroyWindow to mirror the XCreateWindow
> in create_client_window. Patch 2/2 is unchanged.
>
> Without this, we destroy the client_window but leave the client_window
> pointer dangling in the win_data struct. Later, during
> destroy_whole_window, we try to re-parent the destroyed client_window,
> causing a BadWindow X error.
>
> We do store the HWND for the client_window with XSaveContext, but it
> is saved on the per-thread win_data->display handle. Since we might
> not be on that same thread during destroy_client_window, we can't use
> it to look up the HWND for the given client_window. So instead we have
> to store the HWND in the Vulkan struct, unfortunately. The same goes
> for OpenGL in the next patch.
>
> dlls/winex11.drv/vulkan.c | 15 +++++++++------
> dlls/winex11.drv/window.c | 16 ++++++++++++++++
> dlls/winex11.drv/x11drv.h | 1 +
> 3 files changed, 26 insertions(+), 6 deletions(-)
>
> diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
> index 7e252326b5..d67ad1a564 100644
> --- a/dlls/winex11.drv/vulkan.c
> +++ b/dlls/winex11.drv/vulkan.c
> @@ -46,7 +46,7 @@ typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
>
> struct wine_vk_surface
> {
> - Window window;
> + HWND hwnd;
> VkSurfaceKHR surface; /* native surface */
> };
>
> @@ -179,8 +179,8 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface
> /* vkDestroySurfaceKHR must handle VK_NULL_HANDLE (0) for surface. */
> pvkDestroySurfaceKHR(instance, surface->surface, NULL /* allocator */);
>
> - if (surface->window)
> - XDestroyWindow(gdi_display, surface->window);
> + if (surface->hwnd)
> + destroy_client_window(surface->hwnd);
>
> heap_free(surface);
> }
> @@ -246,6 +246,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
> VkResult res;
> VkXlibSurfaceCreateInfoKHR create_info_host;
> struct wine_vk_surface *x11_surface;
> + Window window;
>
> TRACE("%p %p %p %p\n", instance, create_info, allocator, surface);
>
> @@ -263,8 +264,8 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
> if (!x11_surface)
> return VK_ERROR_OUT_OF_HOST_MEMORY;
>
> - x11_surface->window = create_client_window(create_info->hwnd, &default_visual);
> - if (!x11_surface->window)
> + window = create_client_window(create_info->hwnd, &default_visual);
> + if (!window)
> {
> ERR("Failed to allocate client window for hwnd=%p\n", create_info->hwnd);
>
> @@ -273,11 +274,13 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
> goto err;
> }
>
> + x11_surface->hwnd = create_info->hwnd;
> +
> create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
> create_info_host.pNext = NULL;
> create_info_host.flags = 0; /* reserved */
> create_info_host.dpy = gdi_display;
> - create_info_host.window = x11_surface->window;
> + create_info_host.window = window;
>
> res = pvkCreateXlibSurfaceKHR(instance, &create_info_host, NULL /* allocator */, &x11_surface->surface);
> if (res != VK_SUCCESS)
> diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
> index 5fecd9a17b..f16964cdac 100644
> --- a/dlls/winex11.drv/window.c
> +++ b/dlls/winex11.drv/window.c
> @@ -1497,6 +1497,22 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual )
> }
>
>
> +/**********************************************************************
> + * destroy_client_window
> + */
> +void destroy_client_window( HWND hwnd )
> +{
> + struct x11drv_win_data *data = get_win_data( hwnd );
> + if (data)
> + {
> + XDeleteContext( data->display, data->client_window, winContext );
> + XDestroyWindow( gdi_display, data->client_window );
> + data->client_window = 0;
> + release_win_data( data );
> + }
> +}
> +
> +
> /**********************************************************************
> * create_whole_window
> *
> diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
> index 85a05a904a..a4df2b2fab 100644
> --- a/dlls/winex11.drv/x11drv.h
> +++ b/dlls/winex11.drv/x11drv.h
> @@ -594,6 +594,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data )
> extern void update_net_wm_states( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
> extern void make_window_embedded( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
> extern Window create_client_window( HWND hwnd, const XVisualInfo *visual ) DECLSPEC_HIDDEN;
> +extern void destroy_client_window( HWND hwnd ) DECLSPEC_HIDDEN;
> extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ) DECLSPEC_HIDDEN;
> extern void change_systray_owner( Display *display, Window systray_window ) DECLSPEC_HIDDEN;
> extern void update_systray_balloon_position(void) DECLSPEC_HIDDEN;
> --
> 2.17.1
>
>
>
>
June 13, 2018
Re: [PATCH v2 1/4] kernel32: Return BIOS info from GetSystemFirmwareTable on Linux
by Huw Davies
On 13 Jun 2018, at 15:32, Alex Henrie <alexhenrie24(a)gmail.com> wrote:
> On Thu, Jun 7, 2018 at 7:25 AM Huw Davies <huw(a)codeweavers.com> wrote:
>>
>> On Mon, May 28, 2018 at 10:05:26PM -0600, Alex Henrie wrote:
>>> /***********************************************************************
>>> * GetSystemFirmwareTable (KERNEL32.@)
>>> */
>>> UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD size)
>>> {
>>> - FIXME("(%d %d %p %d):stub\n", provider, id, buffer, size);
>>> + FIXME("(%08x %08x %p %d): semi-stub\n", provider, id, buffer, size);
>>
>> This should probably be forwarded to
>> NtQuerySystemInformation(SystemFirmwareTableInformation, ...).
>
> NtQuerySystemInformation(SystemFirmwareTableInformation, ...) just
> returns STATUS_NOT_IMPLEMENTED on Windows.
You’re probably not calling it correctly. See:
https://testbot.winehq.org/JobDetails.pl?Key=39104
(for some reason the 32-bit tests crash before my change,
but you should get the idea).
Huw.
June 13, 2018
[PATCH 1/2 v2] winex11.drv: Clean up client window pointer when destroying Vulkan surface
by Andrew Eikum
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
---
v2: Use gdi_display during XDestroyWindow to mirror the XCreateWindow
in create_client_window. Patch 2/2 is unchanged.
Without this, we destroy the client_window but leave the client_window
pointer dangling in the win_data struct. Later, during
destroy_whole_window, we try to re-parent the destroyed client_window,
causing a BadWindow X error.
We do store the HWND for the client_window with XSaveContext, but it
is saved on the per-thread win_data->display handle. Since we might
not be on that same thread during destroy_client_window, we can't use
it to look up the HWND for the given client_window. So instead we have
to store the HWND in the Vulkan struct, unfortunately. The same goes
for OpenGL in the next patch.
dlls/winex11.drv/vulkan.c | 15 +++++++++------
dlls/winex11.drv/window.c | 16 ++++++++++++++++
dlls/winex11.drv/x11drv.h | 1 +
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 7e252326b5..d67ad1a564 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -46,7 +46,7 @@ typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
struct wine_vk_surface
{
- Window window;
+ HWND hwnd;
VkSurfaceKHR surface; /* native surface */
};
@@ -179,8 +179,8 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface
/* vkDestroySurfaceKHR must handle VK_NULL_HANDLE (0) for surface. */
pvkDestroySurfaceKHR(instance, surface->surface, NULL /* allocator */);
- if (surface->window)
- XDestroyWindow(gdi_display, surface->window);
+ if (surface->hwnd)
+ destroy_client_window(surface->hwnd);
heap_free(surface);
}
@@ -246,6 +246,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
VkResult res;
VkXlibSurfaceCreateInfoKHR create_info_host;
struct wine_vk_surface *x11_surface;
+ Window window;
TRACE("%p %p %p %p\n", instance, create_info, allocator, surface);
@@ -263,8 +264,8 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
if (!x11_surface)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- x11_surface->window = create_client_window(create_info->hwnd, &default_visual);
- if (!x11_surface->window)
+ window = create_client_window(create_info->hwnd, &default_visual);
+ if (!window)
{
ERR("Failed to allocate client window for hwnd=%p\n", create_info->hwnd);
@@ -273,11 +274,13 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
goto err;
}
+ x11_surface->hwnd = create_info->hwnd;
+
create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
create_info_host.pNext = NULL;
create_info_host.flags = 0; /* reserved */
create_info_host.dpy = gdi_display;
- create_info_host.window = x11_surface->window;
+ create_info_host.window = window;
res = pvkCreateXlibSurfaceKHR(instance, &create_info_host, NULL /* allocator */, &x11_surface->surface);
if (res != VK_SUCCESS)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 5fecd9a17b..f16964cdac 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1497,6 +1497,22 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual )
}
+/**********************************************************************
+ * destroy_client_window
+ */
+void destroy_client_window( HWND hwnd )
+{
+ struct x11drv_win_data *data = get_win_data( hwnd );
+ if (data)
+ {
+ XDeleteContext( data->display, data->client_window, winContext );
+ XDestroyWindow( gdi_display, data->client_window );
+ data->client_window = 0;
+ release_win_data( data );
+ }
+}
+
+
/**********************************************************************
* create_whole_window
*
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 85a05a904a..a4df2b2fab 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -594,6 +594,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data )
extern void update_net_wm_states( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern void make_window_embedded( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern Window create_client_window( HWND hwnd, const XVisualInfo *visual ) DECLSPEC_HIDDEN;
+extern void destroy_client_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ) DECLSPEC_HIDDEN;
extern void change_systray_owner( Display *display, Window systray_window ) DECLSPEC_HIDDEN;
extern void update_systray_balloon_position(void) DECLSPEC_HIDDEN;
--
2.17.1
June 13, 2018
[PATCH 2/2] winex11.drv: Clean up client window pointer when destroying GL drawable
by Andrew Eikum
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
---
dlls/winex11.drv/opengl.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 7aa6448fed..8e74ad4114 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -242,6 +242,7 @@ struct gl_drawable
LONG ref; /* reference count */
enum dc_gl_type type; /* type of GL surface */
GLXDrawable drawable; /* drawable for rendering with GL */
+ HWND hwnd;
Window window; /* window if drawable is a GLXWindow */
Pixmap pixmap; /* base pixmap if drawable is a GLXPixmap */
const struct wgl_pixel_format *format; /* pixel format for the drawable */
@@ -1207,9 +1208,9 @@ static void release_gl_drawable( struct gl_drawable *gl )
{
case DC_GL_WINDOW:
case DC_GL_CHILD_WIN:
- TRACE( "destroying %lx drawable %lx\n", gl->window, gl->drawable );
+ TRACE( "destroying %p/%lx drawable %lx\n", gl->hwnd, gl->window, gl->drawable );
pglXDestroyWindow( gdi_display, gl->drawable );
- XDestroyWindow( gdi_display, gl->window );
+ destroy_client_window( gl->hwnd );
break;
case DC_GL_PIXMAP_WIN:
TRACE( "destroying pixmap %lx drawable %lx\n", gl->pixmap, gl->drawable );
@@ -1370,6 +1371,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel
gl->refresh_swap_interval = TRUE;
gl->format = format;
gl->ref = 1;
+ gl->hwnd = hwnd;
if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) /* top-level window */
{
--
2.17.1
June 13, 2018
[PATCH 1/2] winex11.drv: Clean up client window pointer when destroying Vulkan surface
by Andrew Eikum
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
---
Without this, we destroy the client_window but leave the client_window
pointer dangling in the win_data struct. Later, during
destroy_whole_window, we try to re-parent the destroyed client_window,
causing a BadWindow X error.
We do store the HWND for the client_window with XSaveContext, but it
is saved on the per-thread win_data->display handle. Since we might
not be on that same thread during destroy_client_window, we can't use
it to look up the HWND for the given client_window. So instead we have
to store the HWND in the Vulkan struct, unfortunately. The same goes
for OpenGL in the next patch.
dlls/winex11.drv/vulkan.c | 15 +++++++++------
dlls/winex11.drv/window.c | 16 ++++++++++++++++
dlls/winex11.drv/x11drv.h | 1 +
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
index 7e252326b5..d67ad1a564 100644
--- a/dlls/winex11.drv/vulkan.c
+++ b/dlls/winex11.drv/vulkan.c
@@ -46,7 +46,7 @@ typedef VkFlags VkXlibSurfaceCreateFlagsKHR;
struct wine_vk_surface
{
- Window window;
+ HWND hwnd;
VkSurfaceKHR surface; /* native surface */
};
@@ -179,8 +179,8 @@ static void wine_vk_surface_destroy(VkInstance instance, struct wine_vk_surface
/* vkDestroySurfaceKHR must handle VK_NULL_HANDLE (0) for surface. */
pvkDestroySurfaceKHR(instance, surface->surface, NULL /* allocator */);
- if (surface->window)
- XDestroyWindow(gdi_display, surface->window);
+ if (surface->hwnd)
+ destroy_client_window(surface->hwnd);
heap_free(surface);
}
@@ -246,6 +246,7 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
VkResult res;
VkXlibSurfaceCreateInfoKHR create_info_host;
struct wine_vk_surface *x11_surface;
+ Window window;
TRACE("%p %p %p %p\n", instance, create_info, allocator, surface);
@@ -263,8 +264,8 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
if (!x11_surface)
return VK_ERROR_OUT_OF_HOST_MEMORY;
- x11_surface->window = create_client_window(create_info->hwnd, &default_visual);
- if (!x11_surface->window)
+ window = create_client_window(create_info->hwnd, &default_visual);
+ if (!window)
{
ERR("Failed to allocate client window for hwnd=%p\n", create_info->hwnd);
@@ -273,11 +274,13 @@ static VkResult X11DRV_vkCreateWin32SurfaceKHR(VkInstance instance,
goto err;
}
+ x11_surface->hwnd = create_info->hwnd;
+
create_info_host.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
create_info_host.pNext = NULL;
create_info_host.flags = 0; /* reserved */
create_info_host.dpy = gdi_display;
- create_info_host.window = x11_surface->window;
+ create_info_host.window = window;
res = pvkCreateXlibSurfaceKHR(instance, &create_info_host, NULL /* allocator */, &x11_surface->surface);
if (res != VK_SUCCESS)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 5fecd9a17b..58a5bd7c5f 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -1497,6 +1497,22 @@ Window create_client_window( HWND hwnd, const XVisualInfo *visual )
}
+/**********************************************************************
+ * destroy_client_window
+ */
+void destroy_client_window( HWND hwnd )
+{
+ struct x11drv_win_data *data = get_win_data( hwnd );
+ if (data)
+ {
+ XDeleteContext( data->display, data->client_window, winContext );
+ XDestroyWindow( data->display, data->client_window );
+ data->client_window = 0;
+ release_win_data( data );
+ }
+}
+
+
/**********************************************************************
* create_whole_window
*
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 85a05a904a..a4df2b2fab 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -594,6 +594,7 @@ extern void read_net_wm_states( Display *display, struct x11drv_win_data *data )
extern void update_net_wm_states( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern void make_window_embedded( struct x11drv_win_data *data ) DECLSPEC_HIDDEN;
extern Window create_client_window( HWND hwnd, const XVisualInfo *visual ) DECLSPEC_HIDDEN;
+extern void destroy_client_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern void set_window_visual( struct x11drv_win_data *data, const XVisualInfo *vis, BOOL use_alpha ) DECLSPEC_HIDDEN;
extern void change_systray_owner( Display *display, Window systray_window ) DECLSPEC_HIDDEN;
extern void update_systray_balloon_position(void) DECLSPEC_HIDDEN;
--
2.17.1
June 13, 2018
Re: [PATCH v2 1/4] kernel32: Return BIOS info from GetSystemFirmwareTable on Linux
by Alex Henrie
On Thu, Jun 7, 2018 at 7:25 AM Huw Davies <huw(a)codeweavers.com> wrote:
>
> On Mon, May 28, 2018 at 10:05:26PM -0600, Alex Henrie wrote:
> > /***********************************************************************
> > * GetSystemFirmwareTable (KERNEL32.@)
> > */
> > UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD size)
> > {
> > - FIXME("(%d %d %p %d):stub\n", provider, id, buffer, size);
> > + FIXME("(%08x %08x %p %d): semi-stub\n", provider, id, buffer, size);
>
> This should probably be forwarded to
> NtQuerySystemInformation(SystemFirmwareTableInformation, ...).
NtQuerySystemInformation(SystemFirmwareTableInformation, ...) just
returns STATUS_NOT_IMPLEMENTED on Windows.
-Alex
June 13, 2018
[PATCH v3 4/4] kernel32: Return chassis info from GetSystemFirmwareTable on Linux
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/kernel32/cpu.c | 53 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index d231f9b903..c3d19587ab 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -88,6 +88,17 @@ struct smbios_board {
BYTE serial;
};
+struct smbios_chassis {
+ BYTE type;
+ BYTE length;
+ WORD handle;
+ BYTE manufacturer;
+ BYTE shape;
+ BYTE version;
+ BYTE serial;
+ BYTE asset_tag;
+};
+
#include "poppack.h"
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000)
@@ -436,12 +447,15 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
size_t system_manufacturer_size, system_product_size, system_version_size, system_serial_size;
char *board_manufacturer, *board_product, *board_version, *board_serial;
size_t board_manufacturer_size, board_product_size, board_version_size, board_serial_size;
+ char *chassis_manufacturer, *chassis_version, *chassis_serial, *chassis_asset_tag;
+ size_t chassis_manufacturer_size, chassis_version_size, chassis_serial_size, chassis_asset_tag_size;
size_t required_size = sizeof(struct smbios_prologue);
BYTE string_count;
struct smbios_prologue *prologue;
struct smbios_bios *bios;
struct smbios_system *system;
struct smbios_board *board;
+ struct smbios_chassis *chassis;
bios_manufacturer = get_smbios_string("/sys/class/dmi/id/bios_vendor", &bios_manufacturer_size);
bios_version = get_smbios_string("/sys/class/dmi/id/bios_version", &bios_version_size);
@@ -454,6 +468,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
board_product = get_smbios_string("/sys/class/dmi/id/board_name", &board_product_size);
board_version = get_smbios_string("/sys/class/dmi/id/board_version", &board_version_size);
board_serial = get_smbios_string("/sys/class/dmi/id/board_serial", &board_serial_size);
+ chassis_manufacturer = get_smbios_string("/sys/class/dmi/id/chassis_vendor", &chassis_manufacturer_size);
+ chassis_version = get_smbios_string("/sys/class/dmi/id/chassis_version", &chassis_version_size);
+ chassis_serial = get_smbios_string("/sys/class/dmi/id/chassis_serial", &chassis_serial_size);
+ chassis_asset_tag = get_smbios_string("/sys/class/dmi/id/chassis_tag", &chassis_asset_tag_size);
required_size += sizeof(struct smbios_bios);
required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2);
@@ -466,6 +484,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
required_size += max(board_manufacturer_size + board_product_size + board_version_size +
board_serial_size + 1, 2);
+ required_size += sizeof(struct smbios_chassis);
+ required_size += max(chassis_manufacturer_size + chassis_version_size + chassis_serial_size +
+ chassis_asset_tag_size + 1, 2);
+
if (required_size > size)
return required_size;
@@ -548,6 +570,33 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
copy_smbios_string(&buffer, board_version, board_version_size);
copy_smbios_string(&buffer, board_serial, board_serial_size);
memset(buffer, 0, 1);
+ buffer = (char*)buffer + 1;
+ }
+ else
+ {
+ memset(buffer, 0, 2);
+ buffer = (char*)buffer + 2;
+ }
+
+ string_count = 0;
+ chassis = (struct smbios_chassis*)buffer;
+ chassis->type = 3;
+ chassis->length = sizeof(struct smbios_chassis);
+ chassis->handle = 0;
+ chassis->manufacturer = chassis_manufacturer ? ++string_count : 0;
+ chassis->shape = 0x2; /* unknown */
+ chassis->version = chassis_version ? ++string_count : 0;
+ chassis->serial = chassis_serial ? ++string_count : 0;
+ chassis->asset_tag = chassis_asset_tag ? ++string_count : 0;
+ buffer = (char*)buffer + sizeof(struct smbios_chassis);
+
+ if (string_count)
+ {
+ copy_smbios_string(&buffer, chassis_manufacturer, chassis_manufacturer_size);
+ copy_smbios_string(&buffer, chassis_version, chassis_version_size);
+ copy_smbios_string(&buffer, chassis_serial, chassis_serial_size);
+ copy_smbios_string(&buffer, chassis_asset_tag, chassis_asset_tag_size);
+ memset(buffer, 0, 1);
}
else
{
@@ -565,6 +614,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
free(board_product);
free(board_version);
free(board_serial);
+ free(chassis_manufacturer);
+ free(chassis_version);
+ free(chassis_serial);
+ free(chassis_asset_tag);
return required_size;
#endif
--
2.17.1
June 13, 2018
[PATCH v3 3/4] kernel32: Return board info from GetSystemFirmwareTable on Linux
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/kernel32/cpu.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index 95eea25a57..d231f9b903 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -78,6 +78,16 @@ struct smbios_system {
BYTE serial;
};
+struct smbios_board {
+ BYTE type;
+ BYTE length;
+ WORD handle;
+ BYTE manufacturer;
+ BYTE product;
+ BYTE version;
+ BYTE serial;
+};
+
#include "poppack.h"
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000)
@@ -424,11 +434,14 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
size_t bios_manufacturer_size, bios_version_size, bios_date_size;
char *system_manufacturer, *system_product, *system_version, *system_serial;
size_t system_manufacturer_size, system_product_size, system_version_size, system_serial_size;
+ char *board_manufacturer, *board_product, *board_version, *board_serial;
+ size_t board_manufacturer_size, board_product_size, board_version_size, board_serial_size;
size_t required_size = sizeof(struct smbios_prologue);
BYTE string_count;
struct smbios_prologue *prologue;
struct smbios_bios *bios;
struct smbios_system *system;
+ struct smbios_board *board;
bios_manufacturer = get_smbios_string("/sys/class/dmi/id/bios_vendor", &bios_manufacturer_size);
bios_version = get_smbios_string("/sys/class/dmi/id/bios_version", &bios_version_size);
@@ -437,6 +450,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
system_product = get_smbios_string("/sys/class/dmi/id/product", &system_product_size);
system_version = get_smbios_string("/sys/class/dmi/id/product_version", &system_version_size);
system_serial = get_smbios_string("/sys/class/dmi/id/product_serial", &system_serial_size);
+ board_manufacturer = get_smbios_string("/sys/class/dmi/id/board_vendor", &board_manufacturer_size);
+ board_product = get_smbios_string("/sys/class/dmi/id/board_name", &board_product_size);
+ board_version = get_smbios_string("/sys/class/dmi/id/board_version", &board_version_size);
+ board_serial = get_smbios_string("/sys/class/dmi/id/board_serial", &board_serial_size);
required_size += sizeof(struct smbios_bios);
required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2);
@@ -445,6 +462,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
required_size += max(system_manufacturer_size + system_product_size + system_version_size +
system_serial_size + 1, 2);
+ required_size += sizeof(struct smbios_board);
+ required_size += max(board_manufacturer_size + board_product_size + board_version_size +
+ board_serial_size + 1, 2);
+
if (required_size > size)
return required_size;
@@ -501,6 +522,32 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
copy_smbios_string(&buffer, system_version, system_version_size);
copy_smbios_string(&buffer, system_serial, system_serial_size);
memset(buffer, 0, 1);
+ buffer = (char*)buffer + 1;
+ }
+ else
+ {
+ memset(buffer, 0, 2);
+ buffer = (char*)buffer + 2;
+ }
+
+ string_count = 0;
+ board = (struct smbios_board*)buffer;
+ board->type = 2;
+ board->length = sizeof(struct smbios_board);
+ board->handle = 0;
+ board->manufacturer = board_manufacturer ? ++string_count : 0;
+ board->product = board_product ? ++string_count : 0;
+ board->version = board_version ? ++string_count : 0;
+ board->serial = board_serial ? ++string_count : 0;
+ buffer = (char*)buffer + sizeof(struct smbios_board);
+
+ if (string_count)
+ {
+ copy_smbios_string(&buffer, board_manufacturer, board_manufacturer_size);
+ copy_smbios_string(&buffer, board_product, board_product_size);
+ copy_smbios_string(&buffer, board_version, board_version_size);
+ copy_smbios_string(&buffer, board_serial, board_serial_size);
+ memset(buffer, 0, 1);
}
else
{
@@ -514,6 +561,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
free(system_product);
free(system_version);
free(system_serial);
+ free(board_manufacturer);
+ free(board_product);
+ free(board_version);
+ free(board_serial);
return required_size;
#endif
--
2.17.1
June 13, 2018
[PATCH v3 2/4] kernel32: Return system info from GetSystemFirmwareTable on Linux
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/kernel32/cpu.c | 51 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index 4dd9bb628a..95eea25a57 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -68,6 +68,16 @@ struct smbios_bios {
UINT64 characteristics;
};
+struct smbios_system {
+ BYTE type;
+ BYTE length;
+ WORD handle;
+ BYTE manufacturer;
+ BYTE product;
+ BYTE version;
+ BYTE serial;
+};
+
#include "poppack.h"
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000)
@@ -412,18 +422,29 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
#ifdef linux
char *bios_manufacturer, *bios_version, *bios_date;
size_t bios_manufacturer_size, bios_version_size, bios_date_size;
+ char *system_manufacturer, *system_product, *system_version, *system_serial;
+ size_t system_manufacturer_size, system_product_size, system_version_size, system_serial_size;
size_t required_size = sizeof(struct smbios_prologue);
BYTE string_count;
struct smbios_prologue *prologue;
struct smbios_bios *bios;
+ struct smbios_system *system;
bios_manufacturer = get_smbios_string("/sys/class/dmi/id/bios_vendor", &bios_manufacturer_size);
bios_version = get_smbios_string("/sys/class/dmi/id/bios_version", &bios_version_size);
bios_date = get_smbios_string("/sys/class/dmi/id/bios_date", &bios_date_size);
+ system_manufacturer = get_smbios_string("/sys/class/dmi/id/sys_vendor", &system_manufacturer_size);
+ system_product = get_smbios_string("/sys/class/dmi/id/product", &system_product_size);
+ system_version = get_smbios_string("/sys/class/dmi/id/product_version", &system_version_size);
+ system_serial = get_smbios_string("/sys/class/dmi/id/product_serial", &system_serial_size);
required_size += sizeof(struct smbios_bios);
required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2);
+ required_size += sizeof(struct smbios_system);
+ required_size += max(system_manufacturer_size + system_product_size + system_version_size +
+ system_serial_size + 1, 2);
+
if (required_size > size)
return required_size;
@@ -454,6 +475,32 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
copy_smbios_string(&buffer, bios_version, bios_version_size);
copy_smbios_string(&buffer, bios_date, bios_date_size);
memset(buffer, 0, 1);
+ buffer = (char*)buffer + 1;
+ }
+ else
+ {
+ memset(buffer, 0, 2);
+ buffer = (char*)buffer + 2;
+ }
+
+ string_count = 0;
+ system = (struct smbios_system*)buffer;
+ system->type = 1;
+ system->length = sizeof(struct smbios_system);
+ system->handle = 0;
+ system->manufacturer = system_manufacturer ? ++string_count : 0;
+ system->product = system_product ? ++string_count : 0;
+ system->version = system_version ? ++string_count : 0;
+ system->serial = system_serial ? ++string_count : 0;
+ buffer = (char*)buffer + sizeof(struct smbios_system);
+
+ if (string_count)
+ {
+ copy_smbios_string(&buffer, system_manufacturer, system_manufacturer_size);
+ copy_smbios_string(&buffer, system_product, system_product_size);
+ copy_smbios_string(&buffer, system_version, system_version_size);
+ copy_smbios_string(&buffer, system_serial, system_serial_size);
+ memset(buffer, 0, 1);
}
else
{
@@ -463,6 +510,10 @@ UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD
free(bios_manufacturer);
free(bios_version);
free(bios_date);
+ free(system_manufacturer);
+ free(system_product);
+ free(system_version);
+ free(system_serial);
return required_size;
#endif
--
2.17.1
June 13, 2018
[PATCH v3 1/4] kernel32: Return BIOS info from GetSystemFirmwareTable on Linux
by Alex Henrie
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
dlls/kernel32/cpu.c | 135 ++++++++++++++++++++++++++++++++++++++++
dlls/kernel32/process.c | 10 ---
2 files changed, 135 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index ec1fd0f90d..4dd9bb628a 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -46,8 +46,37 @@
WINE_DEFAULT_DEBUG_CHANNEL(reg);
+#include "pshpack1.h"
+
+struct smbios_prologue {
+ BYTE calling_method;
+ BYTE major_version;
+ BYTE minor_version;
+ BYTE revision;
+ DWORD length;
+};
+
+struct smbios_bios {
+ BYTE type;
+ BYTE length;
+ WORD handle;
+ BYTE manufacturer;
+ BYTE version;
+ WORD start;
+ BYTE date;
+ BYTE size;
+ UINT64 characteristics;
+};
+
+#include "poppack.h"
+
#define SHARED_DATA ((KSHARED_USER_DATA*)0x7ffe0000)
+/* Firmware table providers */
+#define ACPI 0x41435049
+#define FIRM 0x4649524D
+#define RSMB 0x52534D42
+
/****************************************************************************
* QueryPerformanceCounter (KERNEL32.@)
*
@@ -336,3 +365,109 @@ DWORD64 WINAPI GetEnabledXStateFeatures(void)
FIXME("\n");
return 0;
}
+
+static inline void copy_smbios_string(void **buffer, char *string, size_t string_size)
+{
+ if (!string) return;
+ strcpy(*buffer, string);
+ *buffer = (char*)(*buffer) + string_size;
+}
+
+#ifdef linux
+static char* get_smbios_string(const char *path, size_t *string_size)
+{
+ FILE *file = fopen(path, "r");
+ char *ret = NULL;
+ *string_size = 0;
+ if (file)
+ {
+ *string_size = getline(&ret, string_size, file) + 1;
+ fclose(file);
+ if (*string_size >= 2 && ret[*string_size - 2] == '\n')
+ {
+ ret[*string_size - 2] = 0;
+ (*string_size)--;
+ }
+ if (*string_size == 1)
+ {
+ free(ret);
+ ret = NULL;
+ *string_size = 0;
+ }
+ }
+ return ret;
+}
+#endif
+
+/***********************************************************************
+ * GetSystemFirmwareTable (KERNEL32.@)
+ */
+UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD size)
+{
+ FIXME("(%08x %08x %p %d): semi-stub\n", provider, id, buffer, size);
+ switch (provider)
+ {
+ case RSMB:
+ {
+#ifdef linux
+ char *bios_manufacturer, *bios_version, *bios_date;
+ size_t bios_manufacturer_size, bios_version_size, bios_date_size;
+ size_t required_size = sizeof(struct smbios_prologue);
+ BYTE string_count;
+ struct smbios_prologue *prologue;
+ struct smbios_bios *bios;
+
+ bios_manufacturer = get_smbios_string("/sys/class/dmi/id/bios_vendor", &bios_manufacturer_size);
+ bios_version = get_smbios_string("/sys/class/dmi/id/bios_version", &bios_version_size);
+ bios_date = get_smbios_string("/sys/class/dmi/id/bios_date", &bios_date_size);
+
+ required_size += sizeof(struct smbios_bios);
+ required_size += max(bios_manufacturer_size + bios_version_size + bios_date_size + 1, 2);
+
+ if (required_size > size)
+ return required_size;
+
+ prologue = (struct smbios_prologue*)buffer;
+ prologue->calling_method = 0;
+ prologue->major_version = 2;
+ prologue->minor_version = 0;
+ prologue->revision = 0;
+ prologue->length = required_size - sizeof(struct smbios_prologue);
+ buffer = (char*)buffer + sizeof(struct smbios_prologue);
+
+ string_count = 0;
+ bios = (struct smbios_bios*)buffer;
+ bios->type = 0;
+ bios->length = sizeof(struct smbios_bios);
+ bios->handle = 0;
+ bios->manufacturer = bios_manufacturer ? ++string_count : 0;
+ bios->version = bios_version ? ++string_count : 0;
+ bios->start = 0;
+ bios->date = bios_date ? ++string_count : 0;
+ bios->size = 0;
+ bios->characteristics = 0x4; /* not supported */
+ buffer = (char*)buffer + sizeof(struct smbios_bios);
+
+ if (string_count)
+ {
+ copy_smbios_string(&buffer, bios_manufacturer, bios_manufacturer_size);
+ copy_smbios_string(&buffer, bios_version, bios_version_size);
+ copy_smbios_string(&buffer, bios_date, bios_date_size);
+ memset(buffer, 0, 1);
+ }
+ else
+ {
+ memset(buffer, 0, 2);
+ }
+
+ free(bios_manufacturer);
+ free(bios_version);
+ free(bios_date);
+
+ return required_size;
+#endif
+ }
+ }
+ SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+ return 0;
+}
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index ff56e9a692..6adf08d257 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -4126,16 +4126,6 @@ HRESULT WINAPI UnregisterApplicationRestart(void)
return S_OK;
}
-/***********************************************************************
- * GetSystemFirmwareTable (KERNEL32.@)
- */
-UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, PVOID buffer, DWORD size)
-{
- FIXME("(%d %d %p %d):stub\n", provider, id, buffer, size);
- SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
- return 0;
-}
-
struct proc_thread_attr
{
DWORD_PTR attr;
--
2.17.1
June 13, 2018
[PATCH 2/2] mshtml.idl: Added IHTMLPerformance test.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/mshtml/tests/dom.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
June 13, 2018
[PATCH 1/2] mshtml.idl: Added IHTMLPerformance declaration.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
include/mshtmdid.h | 40 +++++++++++++++++
include/mshtml.idl | 129
+++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 169 insertions(+)
June 13, 2018
[v2 PATCH] user32: Fix returned class name for other process windows.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
---
Fixes https://bugs.winehq.org/show_bug.cgi?id=45156
v2: using existing request
dlls/user32/class.c | 14 +++++++++++++-
include/wine/server_protocol.h | 8 +++++---
server/class.c | 1 +
server/protocol.def | 5 +++--
server/request.h | 13 +++++++------
server/trace.c | 5 +++--
6 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c
index 2b2d07f888..07d36f05d7 100644
--- a/dlls/user32/class.c
+++ b/dlls/user32/class.c
@@ -1194,8 +1194,20 @@ INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count )
if (class == CLASS_OTHER_PROCESS)
{
WCHAR tmpbuf[MAX_ATOM_LEN + 1];
+ ATOM atom = 0;
- ret = GlobalGetAtomNameW( GetClassLongW( hwnd, GCW_ATOM ), tmpbuf, MAX_ATOM_LEN + 1 );
+ SERVER_START_REQ( set_class_info )
+ {
+ req->window = wine_server_user_handle( hwnd );
+ req->flags = 0;
+ req->extra_offset = -1;
+ req->extra_size = 0;
+ if (!wine_server_call_err( req ))
+ atom = reply->base_atom;
+ }
+ SERVER_END_REQ;
+
+ ret = GlobalGetAtomNameW( atom, tmpbuf, MAX_ATOM_LEN + 1 );
if (ret)
{
ret = min(count - 1, ret);
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index e4c2d92376..511ad5c628 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -4525,11 +4525,13 @@ struct set_class_info_reply
{
struct reply_header __header;
atom_t old_atom;
+ atom_t base_atom;
+ mod_handle_t old_instance;
+ lparam_t old_extra_value;
unsigned int old_style;
int old_extra;
int old_win_extra;
- mod_handle_t old_instance;
- lparam_t old_extra_value;
+ char __pad_44[4];
};
#define SET_CLASS_ATOM 0x0001
#define SET_CLASS_STYLE 0x0002
@@ -6512,6 +6514,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
-#define SERVER_PROTOCOL_VERSION 554
+#define SERVER_PROTOCOL_VERSION 555
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/class.c b/server/class.c
index d5f6712006..6a7de7843e 100644
--- a/server/class.c
+++ b/server/class.c
@@ -276,6 +276,7 @@ DECL_HANDLER(set_class_info)
reply->old_extra = class->nb_extra_bytes;
reply->old_win_extra = class->win_extra;
reply->old_instance = class->instance;
+ reply->base_atom = class->base_atom;
if (req->flags & SET_CLASS_ATOM)
{
diff --git a/server/protocol.def b/server/protocol.def
index c533f1b8eb..5d89c2b3ba 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3179,11 +3179,12 @@ enum caret_state
lparam_t extra_value; /* value to set in extra bytes */
@REPLY
atom_t old_atom; /* previous class atom */
+ atom_t base_atom; /* base class atom */
+ mod_handle_t old_instance; /* previous module instance */
+ lparam_t old_extra_value; /* old value in extra bytes */
unsigned int old_style; /* previous class style */
int old_extra; /* previous number of class extra bytes */
int old_win_extra; /* previous number of window extra bytes */
- mod_handle_t old_instance; /* previous module instance */
- lparam_t old_extra_value; /* old value in extra bytes */
@END
#define SET_CLASS_ATOM 0x0001
#define SET_CLASS_STYLE 0x0002
diff --git a/server/request.h b/server/request.h
index 8b823ba844..10fd850ec1 100644
--- a/server/request.h
+++ b/server/request.h
@@ -2056,12 +2056,13 @@ C_ASSERT( FIELD_OFFSET(struct set_class_info_request, extra_size) == 44 );
C_ASSERT( FIELD_OFFSET(struct set_class_info_request, extra_value) == 48 );
C_ASSERT( sizeof(struct set_class_info_request) == 56 );
C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_atom) == 8 );
-C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_style) == 12 );
-C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra) == 16 );
-C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_win_extra) == 20 );
-C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_instance) == 24 );
-C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra_value) == 32 );
-C_ASSERT( sizeof(struct set_class_info_reply) == 40 );
+C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, base_atom) == 12 );
+C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_instance) == 16 );
+C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra_value) == 24 );
+C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_style) == 32 );
+C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_extra) == 36 );
+C_ASSERT( FIELD_OFFSET(struct set_class_info_reply, old_win_extra) == 40 );
+C_ASSERT( sizeof(struct set_class_info_reply) == 48 );
C_ASSERT( FIELD_OFFSET(struct open_clipboard_request, window) == 12 );
C_ASSERT( sizeof(struct open_clipboard_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct open_clipboard_reply, owner) == 8 );
diff --git a/server/trace.c b/server/trace.c
index c6020433f1..e6ed964e16 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -3795,11 +3795,12 @@ static void dump_set_class_info_request( const struct set_class_info_request *re
static void dump_set_class_info_reply( const struct set_class_info_reply *req )
{
fprintf( stderr, " old_atom=%04x", req->old_atom );
+ fprintf( stderr, ", base_atom=%04x", req->base_atom );
+ dump_uint64( ", old_instance=", &req->old_instance );
+ dump_uint64( ", old_extra_value=", &req->old_extra_value );
fprintf( stderr, ", old_style=%08x", req->old_style );
fprintf( stderr, ", old_extra=%d", req->old_extra );
fprintf( stderr, ", old_win_extra=%d", req->old_win_extra );
- dump_uint64( ", old_instance=", &req->old_instance );
- dump_uint64( ", old_extra_value=", &req->old_extra_value );
}
static void dump_open_clipboard_request( const struct open_clipboard_request *req )
--
2.17.1
June 13, 2018
[PATCH 6/6] dxgi: Get supported feature levels from wined3d caps.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
Not much better yet...
The main idea behind the series is to separate feature level checks from
shader model checks in wined3d.
On a side note, handling of feature levels 9_x appears to be incorrect
(AFAIK feature levels 9_x always use SM2 shaders).
---
dlls/dxgi/utils.c | 34 ++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c
index a30528193162..aed62a4a3b36 100644
--- a/dlls/dxgi/utils.c
+++ b/dlls/dxgi/utils.c
@@ -626,21 +626,20 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory,
{
static const struct
{
- D3D_FEATURE_LEVEL feature_level;
- unsigned int sm;
+ D3D_FEATURE_LEVEL d3d;
+ enum wined3d_feature_level wined3d;
}
- feature_levels_sm[] =
+ wined3d_feature_levels[] =
{
- {D3D_FEATURE_LEVEL_11_1, 5},
- {D3D_FEATURE_LEVEL_11_0, 5},
- {D3D_FEATURE_LEVEL_10_1, 4},
- {D3D_FEATURE_LEVEL_10_0, 4},
- {D3D_FEATURE_LEVEL_9_3, 3},
- {D3D_FEATURE_LEVEL_9_2, 2},
- {D3D_FEATURE_LEVEL_9_1, 2},
+ {D3D_FEATURE_LEVEL_11_1, WINED3D_FEATURE_LEVEL_11},
+ {D3D_FEATURE_LEVEL_11_0, WINED3D_FEATURE_LEVEL_11},
+ {D3D_FEATURE_LEVEL_10_1, WINED3D_FEATURE_LEVEL_10},
+ {D3D_FEATURE_LEVEL_10_0, WINED3D_FEATURE_LEVEL_10},
+ {D3D_FEATURE_LEVEL_9_3, WINED3D_FEATURE_LEVEL_9_SM3},
+ {D3D_FEATURE_LEVEL_9_2, WINED3D_FEATURE_LEVEL_9_SM2},
+ {D3D_FEATURE_LEVEL_9_1, WINED3D_FEATURE_LEVEL_9_SM2},
};
D3D_FEATURE_LEVEL selected_feature_level = 0;
- unsigned int shader_model;
struct wined3d_caps caps;
unsigned int i, j;
HRESULT hr;
@@ -652,18 +651,17 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory,
if (FAILED(hr))
level_count = 0;
- shader_model = min(caps.VertexShaderVersion, caps.PixelShaderVersion);
for (i = 0; i < level_count; ++i)
{
- for (j = 0; j < ARRAY_SIZE(feature_levels_sm); ++j)
+ for (j = 0; j < ARRAY_SIZE(wined3d_feature_levels); ++j)
{
- if (feature_levels[i] == feature_levels_sm[j].feature_level)
+ if (feature_levels[i] == wined3d_feature_levels[j].d3d)
{
- if (shader_model >= feature_levels_sm[j].sm)
+ if (caps.max_feature_level >= wined3d_feature_levels[j].wined3d)
{
selected_feature_level = feature_levels[i];
- TRACE("Choosing supported feature level %s (SM%u).\n",
- debug_feature_level(selected_feature_level), feature_levels_sm[j].sm);
+ TRACE("Choosing supported feature level %s.\n",
+ debug_feature_level(selected_feature_level));
}
break;
}
@@ -671,7 +669,7 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory,
if (selected_feature_level)
break;
- if (j == ARRAY_SIZE(feature_levels_sm))
+ if (j == ARRAY_SIZE(wined3d_feature_levels))
FIXME("Unexpected feature level %#x.\n", feature_levels[i]);
else
TRACE("Feature level %s not supported, trying next fallback if available.\n",
--
2.16.4
June 13, 2018
[PATCH 5/6] wined3d: Expose feature level in wined3d caps.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/wined3d/directx.c | 2 ++
dlls/wined3d/wined3d_private.h | 13 -------------
include/wine/wined3d.h | 15 +++++++++++++++
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 7046060d5249..9ecc4ed71354 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -6190,6 +6190,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
caps->shader_double_precision = d3d_info->shader_double_precision;
+ caps->max_feature_level = d3d_info->feature_level;
+
return WINED3D_OK;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 01888469e7a8..9aa70817f5d1 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -184,19 +184,6 @@ struct wined3d_ffp_attrib_ops
wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT];
};
-enum wined3d_feature_level
-{
- WINED3D_FEATURE_LEVEL_5,
- WINED3D_FEATURE_LEVEL_6,
- WINED3D_FEATURE_LEVEL_7,
- WINED3D_FEATURE_LEVEL_8,
- WINED3D_FEATURE_LEVEL_9_SM2,
- WINED3D_FEATURE_LEVEL_9_SM3,
- WINED3D_FEATURE_LEVEL_10,
- WINED3D_FEATURE_LEVEL_11,
- WINED3D_FEATURE_LEVEL_COUNT
-};
-
struct wined3d_d3d_info
{
struct wined3d_d3d_limits limits;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0f388ab2a198..239ccd8ec62a 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -88,6 +88,19 @@ enum wined3d_device_type
WINED3D_DEVICE_TYPE_NULLREF = 4,
};
+enum wined3d_feature_level
+{
+ WINED3D_FEATURE_LEVEL_5,
+ WINED3D_FEATURE_LEVEL_6,
+ WINED3D_FEATURE_LEVEL_7,
+ WINED3D_FEATURE_LEVEL_8,
+ WINED3D_FEATURE_LEVEL_9_SM2,
+ WINED3D_FEATURE_LEVEL_9_SM3,
+ WINED3D_FEATURE_LEVEL_10,
+ WINED3D_FEATURE_LEVEL_11,
+ WINED3D_FEATURE_LEVEL_COUNT
+};
+
enum wined3d_degree_type
{
WINED3D_DEGREE_LINEAR = 1,
@@ -1962,6 +1975,8 @@ struct wined3d_caps
struct wined3d_ddraw_caps ddraw_caps;
BOOL shader_double_precision;
+
+ enum wined3d_feature_level max_feature_level;
};
struct wined3d_color_key
--
2.16.4
June 13, 2018
[PATCH 4/6] wined3d: Store feature level in d3d_info.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/wined3d/directx.c | 107 ++++++++++++++++++-----------------------
dlls/wined3d/wined3d_private.h | 14 ++++++
2 files changed, 62 insertions(+), 59 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index e64df4f75f75..7046060d5249 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -77,19 +77,6 @@ enum wined3d_gl_vendor
GL_VENDOR_NVIDIA,
};
-enum wined3d_d3d_level
-{
- WINED3D_D3D_LEVEL_5,
- WINED3D_D3D_LEVEL_6,
- WINED3D_D3D_LEVEL_7,
- WINED3D_D3D_LEVEL_8,
- WINED3D_D3D_LEVEL_9_SM2,
- WINED3D_D3D_LEVEL_9_SM3,
- WINED3D_D3D_LEVEL_10,
- WINED3D_D3D_LEVEL_11,
- WINED3D_D3D_LEVEL_COUNT
-};
-
/* The d3d device ID */
static const GUID IID_D3DDEVICE_D3DUID = { 0xaeb2cdd4, 0x6e41, 0x43ea, { 0x94,0x1c,0x83,0x61,0xcc,0x76,0x07,0x81 } };
@@ -1857,26 +1844,26 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s
return HW_VENDOR_NVIDIA;
}
-static enum wined3d_d3d_level d3d_level_from_caps(const struct shader_caps *shader_caps,
+static enum wined3d_feature_level feature_level_from_caps(const struct shader_caps *shader_caps,
const struct fragment_caps *fragment_caps)
{
if (shader_caps->vs_version >= 5)
- return WINED3D_D3D_LEVEL_11;
+ return WINED3D_FEATURE_LEVEL_11;
if (shader_caps->vs_version == 4)
- return WINED3D_D3D_LEVEL_10;
+ return WINED3D_FEATURE_LEVEL_10;
if (shader_caps->vs_version == 3)
- return WINED3D_D3D_LEVEL_9_SM3;
+ return WINED3D_FEATURE_LEVEL_9_SM3;
if (shader_caps->vs_version == 2)
- return WINED3D_D3D_LEVEL_9_SM2;
+ return WINED3D_FEATURE_LEVEL_9_SM2;
if (shader_caps->vs_version == 1)
- return WINED3D_D3D_LEVEL_8;
+ return WINED3D_FEATURE_LEVEL_8;
if (fragment_caps->TextureOpCaps & WINED3DTEXOPCAPS_DOTPRODUCT3)
- return WINED3D_D3D_LEVEL_7;
+ return WINED3D_FEATURE_LEVEL_7;
if (fragment_caps->MaxSimultaneousTextures > 1)
- return WINED3D_D3D_LEVEL_6;
+ return WINED3D_FEATURE_LEVEL_6;
- return WINED3D_D3D_LEVEL_5;
+ return WINED3D_FEATURE_LEVEL_5;
}
static const struct wined3d_renderer_table
@@ -2448,9 +2435,9 @@ card_fallback_intel[] =
CARD_INTEL_G45, /* D3D10 */
CARD_INTEL_IVBD, /* D3D11 */
};
-C_ASSERT(ARRAY_SIZE(card_fallback_nvidia) == WINED3D_D3D_LEVEL_COUNT);
-C_ASSERT(ARRAY_SIZE(card_fallback_amd) == WINED3D_D3D_LEVEL_COUNT);
-C_ASSERT(ARRAY_SIZE(card_fallback_intel) == WINED3D_D3D_LEVEL_COUNT);
+C_ASSERT(ARRAY_SIZE(card_fallback_nvidia) == WINED3D_FEATURE_LEVEL_COUNT);
+C_ASSERT(ARRAY_SIZE(card_fallback_amd) == WINED3D_FEATURE_LEVEL_COUNT);
+C_ASSERT(ARRAY_SIZE(card_fallback_intel) == WINED3D_FEATURE_LEVEL_COUNT);
static enum wined3d_pci_device select_card_handler(const struct gl_vendor_selection *table,
unsigned int table_size, enum wined3d_gl_vendor gl_vendor, const char *gl_renderer)
@@ -2483,7 +2470,7 @@ static const struct
const char *description; /* Description of the card selector i.e. Apple OS/X Intel */
const struct gl_vendor_selection *gl_vendor_selection;
unsigned int gl_vendor_count;
- const enum wined3d_pci_device *card_fallback; /* An array with D3D_LEVEL_COUNT elements */
+ const enum wined3d_pci_device *card_fallback; /* An array with FEATURE_LEVEL_COUNT elements */
}
card_vendor_table[] =
{
@@ -2501,9 +2488,9 @@ card_vendor_table[] =
card_fallback_intel},
};
-
-static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps,
- DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor, enum wined3d_pci_vendor *card_vendor)
+static enum wined3d_pci_device wined3d_guess_card(enum wined3d_feature_level feature_level,
+ DWORD glsl_version, const char *gl_renderer, enum wined3d_gl_vendor *gl_vendor,
+ enum wined3d_pci_vendor *card_vendor)
{
/* A Direct3D device object contains the PCI id (vendor + device) of the
* videocard which is used for rendering. Various applications use this
@@ -2555,7 +2542,6 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad
* memory behind our backs if really needed. Note that the amount of video
* memory can be overruled using a registry setting. */
- enum wined3d_d3d_level d3d_level = d3d_level_from_caps(shader_caps, fragment_caps);
enum wined3d_pci_device device;
unsigned int i;
@@ -2571,7 +2557,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad
return device;
TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer));
- return card_vendor_table[i].card_fallback[d3d_level];
+ return card_vendor_table[i].card_fallback[feature_level];
}
FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n",
@@ -2579,7 +2565,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad
/* Default to generic Nvidia hardware based on the supported OpenGL extensions. */
*card_vendor = HW_VENDOR_NVIDIA;
- return card_fallback_nvidia[d3d_level];
+ return card_fallback_nvidia[feature_level];
}
static const struct wined3d_vertex_pipe_ops *select_vertex_implementation(const struct wined3d_gl_info *gl_info,
@@ -3954,6 +3940,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
};
struct wined3d_driver_info *driver_info = &adapter->driver_info;
const char *gl_vendor_str, *gl_renderer_str, *gl_version_str;
+ struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
struct wined3d_gl_info *gl_info = &adapter->gl_info;
const struct gpu_description *gpu_description;
struct wined3d_vertex_caps vertex_caps;
@@ -3962,10 +3949,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
const char *WGL_Extensions = NULL;
enum wined3d_gl_vendor gl_vendor;
DWORD gl_version, gl_ext_emul_mask;
+ GLint context_profile = 0;
UINT64 vram_bytes = 0;
- HDC hdc;
unsigned int i, j;
- GLint context_profile = 0;
+ HDC hdc;
TRACE("adapter %p.\n", adapter);
@@ -4295,37 +4282,39 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
adapter->fragment_pipe = select_fragment_implementation(gl_info, adapter->shader_backend);
adapter->shader_backend->shader_get_caps(gl_info, &shader_caps);
- adapter->d3d_info.vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING;
- adapter->d3d_info.limits.vs_version = shader_caps.vs_version;
- adapter->d3d_info.limits.hs_version = shader_caps.hs_version;
- adapter->d3d_info.limits.ds_version = shader_caps.ds_version;
- adapter->d3d_info.limits.gs_version = shader_caps.gs_version;
- adapter->d3d_info.limits.ps_version = shader_caps.ps_version;
- adapter->d3d_info.limits.cs_version = shader_caps.cs_version;
- adapter->d3d_info.limits.vs_uniform_count = shader_caps.vs_uniform_count;
- adapter->d3d_info.limits.ps_uniform_count = shader_caps.ps_uniform_count;
- adapter->d3d_info.limits.varying_count = shader_caps.varying_count;
- adapter->d3d_info.shader_double_precision = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION;
+ d3d_info->vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING;
+ d3d_info->limits.vs_version = shader_caps.vs_version;
+ d3d_info->limits.hs_version = shader_caps.hs_version;
+ d3d_info->limits.ds_version = shader_caps.ds_version;
+ d3d_info->limits.gs_version = shader_caps.gs_version;
+ d3d_info->limits.ps_version = shader_caps.ps_version;
+ d3d_info->limits.cs_version = shader_caps.cs_version;
+ d3d_info->limits.vs_uniform_count = shader_caps.vs_uniform_count;
+ d3d_info->limits.ps_uniform_count = shader_caps.ps_uniform_count;
+ d3d_info->limits.varying_count = shader_caps.varying_count;
+ d3d_info->shader_double_precision = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION;
adapter->vertex_pipe->vp_get_caps(gl_info, &vertex_caps);
- adapter->d3d_info.xyzrhw = vertex_caps.xyzrhw;
- adapter->d3d_info.ffp_generic_attributes = vertex_caps.ffp_generic_attributes;
- adapter->d3d_info.limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices;
- adapter->d3d_info.limits.active_light_count = vertex_caps.max_active_lights;
- adapter->d3d_info.emulated_flatshading = vertex_caps.emulated_flatshading;
+ d3d_info->xyzrhw = vertex_caps.xyzrhw;
+ d3d_info->ffp_generic_attributes = vertex_caps.ffp_generic_attributes;
+ d3d_info->limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices;
+ d3d_info->limits.active_light_count = vertex_caps.max_active_lights;
+ d3d_info->emulated_flatshading = vertex_caps.emulated_flatshading;
adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
- adapter->d3d_info.limits.ffp_blend_stages = fragment_caps.MaxTextureBlendStages;
- adapter->d3d_info.limits.ffp_textures = fragment_caps.MaxSimultaneousTextures;
- adapter->d3d_info.shader_color_key = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY;
- adapter->d3d_info.wined3d_creation_flags = wined3d_creation_flags;
- TRACE("Max texture stages: %u.\n", adapter->d3d_info.limits.ffp_blend_stages);
+ d3d_info->limits.ffp_blend_stages = fragment_caps.MaxTextureBlendStages;
+ d3d_info->limits.ffp_textures = fragment_caps.MaxSimultaneousTextures;
+ d3d_info->shader_color_key = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY;
+ d3d_info->wined3d_creation_flags = wined3d_creation_flags;
+ d3d_info->feature_level = feature_level_from_caps(&shader_caps, &fragment_caps);
+
+ TRACE("Max texture stages: %u.\n", d3d_info->limits.ffp_blend_stages);
- adapter->d3d_info.valid_rt_mask = 0;
+ d3d_info->valid_rt_mask = 0;
for (i = 0; i < gl_info->limits.buffers; ++i)
- adapter->d3d_info.valid_rt_mask |= (1u << i);
+ d3d_info->valid_rt_mask |= (1u << i);
- if (!adapter->d3d_info.shader_color_key)
+ if (!d3d_info->shader_color_key)
{
/* We do not want to deal with re-creating immutable texture storage for color keying emulation. */
WARN("Disabling ARB_texture_storage because fragment pipe doesn't support color keying.\n");
@@ -4431,7 +4420,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
vendor = wined3d_guess_card_vendor(gl_vendor_str, gl_renderer_str);
TRACE("Guessed vendor PCI ID 0x%04x.\n", vendor);
- device = wined3d_guess_card(&shader_caps, &fragment_caps, gl_info->glsl_version,
+ device = wined3d_guess_card(d3d_info->feature_level, gl_info->glsl_version,
gl_renderer_str, &gl_vendor, &vendor);
TRACE("Guessed device PCI ID 0x%04x.\n", device);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d190f7ccfd68..01888469e7a8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -184,6 +184,19 @@ struct wined3d_ffp_attrib_ops
wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT];
};
+enum wined3d_feature_level
+{
+ WINED3D_FEATURE_LEVEL_5,
+ WINED3D_FEATURE_LEVEL_6,
+ WINED3D_FEATURE_LEVEL_7,
+ WINED3D_FEATURE_LEVEL_8,
+ WINED3D_FEATURE_LEVEL_9_SM2,
+ WINED3D_FEATURE_LEVEL_9_SM3,
+ WINED3D_FEATURE_LEVEL_10,
+ WINED3D_FEATURE_LEVEL_11,
+ WINED3D_FEATURE_LEVEL_COUNT
+};
+
struct wined3d_d3d_info
{
struct wined3d_d3d_limits limits;
@@ -196,6 +209,7 @@ struct wined3d_d3d_info
DWORD valid_rt_mask;
DWORD wined3d_creation_flags;
BOOL shader_double_precision;
+ enum wined3d_feature_level feature_level;
};
static const struct color_fixup_desc COLOR_FIXUP_IDENTITY =
--
2.16.4
June 13, 2018
[PATCH 3/6] wined3d: Remove "Reserved" fields from wined3d_caps.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
include/wine/wined3d.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index d1282d72873a..0f388ab2a198 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1944,7 +1944,6 @@ struct wined3d_caps
DWORD DevCaps2;
float MaxNpatchTessellationLevel;
- DWORD Reserved5; /* undocumented */
UINT MasterAdapterOrdinal;
UINT AdapterOrdinalInGroup;
@@ -1959,8 +1958,6 @@ struct wined3d_caps
DWORD MaxPShaderInstructionsExecuted;
DWORD MaxVertexShader30InstructionSlots;
DWORD MaxPixelShader30InstructionSlots;
- DWORD Reserved2; /* Not in the microsoft headers but documented */
- DWORD Reserved3;
struct wined3d_ddraw_caps ddraw_caps;
--
2.16.4
June 13, 2018
[PATCH 2/6] wined3d: Get rid of WINED3DCAPS typedef.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d11/device.c | 2 +-
dlls/d3d8/d3d8_private.h | 2 +-
dlls/d3d8/device.c | 4 ++--
dlls/d3d8/directx.c | 2 +-
dlls/d3d9/d3d9_private.h | 2 +-
dlls/d3d9/device.c | 6 +++---
dlls/d3d9/directx.c | 2 +-
dlls/ddraw/ddraw.c | 8 ++++----
dlls/dxgi/utils.c | 2 +-
dlls/wined3d/device.c | 2 +-
dlls/wined3d/directx.c | 2 +-
include/wine/wined3d.h | 8 ++++----
12 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index e7dd62cb3cd5..e6ba31c7c4b7 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -3411,7 +3411,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device2
void *feature_support_data, UINT feature_support_data_size)
{
struct d3d_device *device = impl_from_ID3D11Device2(iface);
- WINED3DCAPS wined3d_caps;
+ struct wined3d_caps wined3d_caps;
HRESULT hr;
TRACE("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u.\n",
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 3fbc096b2546..40a0f0a38d4e 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -42,7 +42,7 @@
/* CreateVertexShader can return > 0xFFFF */
#define VS_HIGHESTFIXEDFXF 0xF0000000
-void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN;
+void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d8
{
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 616886bcafa2..f0b36ee93c20 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -321,7 +321,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
return TRUE;
}
-void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const WINED3DCAPS *wined3d_caps)
+void d3dcaps_from_wined3dcaps(D3DCAPS8 *caps, const struct wined3d_caps *wined3d_caps)
{
caps->DeviceType = (D3DDEVTYPE)wined3d_caps->DeviceType;
caps->AdapterOrdinal = wined3d_caps->AdapterOrdinal;
@@ -671,7 +671,7 @@ static HRESULT WINAPI d3d8_device_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D
static HRESULT WINAPI d3d8_device_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *caps)
{
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
- WINED3DCAPS wined3d_caps;
+ struct wined3d_caps wined3d_caps;
HRESULT hr;
TRACE("iface %p, caps %p.\n", iface, caps);
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index 68300c0a655d..499e488b0618 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -324,7 +324,7 @@ static HRESULT WINAPI d3d8_CheckDepthStencilMatch(IDirect3D8 *iface, UINT adapte
static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS8 *caps)
{
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
- WINED3DCAPS wined3d_caps;
+ struct wined3d_caps wined3d_caps;
HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps);
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h
index c50aabf593f0..08ea73ccddf5 100644
--- a/dlls/d3d9/d3d9_private.h
+++ b/dlls/d3d9/d3d9_private.h
@@ -58,7 +58,7 @@ enum wined3d_format_id wined3dformat_from_d3dformat(D3DFORMAT format) DECLSPEC_H
unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDEN;
void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *present_parameters,
const struct wined3d_swapchain_desc *swapchain_desc, DWORD presentation_interval) DECLSPEC_HIDDEN;
-void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps) DECLSPEC_HIDDEN;
+void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps) DECLSPEC_HIDDEN;
struct d3d9
{
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 5d0f5071836c..5021ec75cf79 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -347,7 +347,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
return TRUE;
}
-void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const WINED3DCAPS *wined3d_caps)
+void d3dcaps_from_wined3dcaps(D3DCAPS9 *caps, const struct wined3d_caps *wined3d_caps)
{
static const DWORD ps_minor_version[] = {0, 4, 0, 0};
static const DWORD vs_minor_version[] = {0, 1, 0, 0};
@@ -664,7 +664,7 @@ static HRESULT WINAPI d3d9_device_GetDirect3D(IDirect3DDevice9Ex *iface, IDirect
static HRESULT WINAPI d3d9_device_GetDeviceCaps(IDirect3DDevice9Ex *iface, D3DCAPS9 *caps)
{
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
- WINED3DCAPS wined3d_caps;
+ struct wined3d_caps wined3d_caps;
HRESULT hr;
TRACE("iface %p, caps %p.\n", iface, caps);
@@ -4218,8 +4218,8 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode)
{
struct wined3d_swapchain_desc *swapchain_desc;
+ struct wined3d_caps caps;
unsigned i, count = 1;
- WINED3DCAPS caps;
HRESULT hr;
if (mode)
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c
index 98f4a99c4943..49da816564e1 100644
--- a/dlls/d3d9/directx.c
+++ b/dlls/d3d9/directx.c
@@ -355,7 +355,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT
static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps)
{
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
- WINED3DCAPS wined3d_caps;
+ struct wined3d_caps wined3d_caps;
HRESULT hr;
TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps);
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 32f01722630d..e60c5f345af6 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1244,7 +1244,7 @@ void ddraw_d3dcaps1_from_7(D3DDEVICEDESC *caps1, D3DDEVICEDESC7 *caps7)
HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
{
- WINED3DCAPS wined3d_caps;
+ struct wined3d_caps wined3d_caps;
HRESULT hr;
TRACE("ddraw %p, caps %p.\n", ddraw, caps);
@@ -1454,10 +1454,10 @@ HRESULT ddraw_get_d3dcaps(const struct ddraw *ddraw, D3DDEVICEDESC7 *caps)
static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DDCAPS *HELCaps)
{
struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
+ DDSCAPS2 ddscaps = {0, 0, 0, {0}};
+ struct wined3d_caps winecaps;
DDCAPS caps;
- WINED3DCAPS winecaps;
HRESULT hr;
- DDSCAPS2 ddscaps = {0, 0, 0, {0}};
TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, DriverCaps, HELCaps);
@@ -4911,7 +4911,7 @@ static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops =
HRESULT ddraw_init(struct ddraw *ddraw, DWORD flags, enum wined3d_device_type device_type)
{
- WINED3DCAPS caps;
+ struct wined3d_caps caps;
HRESULT hr;
ddraw->IDirectDraw7_iface.lpVtbl = &ddraw7_vtbl;
diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c
index 73c3cf2c5d62..a30528193162 100644
--- a/dlls/dxgi/utils.c
+++ b/dlls/dxgi/utils.c
@@ -641,8 +641,8 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory,
};
D3D_FEATURE_LEVEL selected_feature_level = 0;
unsigned int shader_model;
+ struct wined3d_caps caps;
unsigned int i, j;
- WINED3DCAPS caps;
HRESULT hr;
wined3d_mutex_lock();
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8ef74b6ef0f1..c0f7a1fc8ee4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3476,7 +3476,7 @@ struct wined3d_texture * CDECL wined3d_device_get_texture(const struct wined3d_d
return device->state.textures[stage];
}
-HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps)
+HRESULT CDECL wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps)
{
TRACE("device %p, caps %p.\n", device, caps);
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index baab2e9c1a31..e64df4f75f75 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -5626,7 +5626,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
}
HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx,
- enum wined3d_device_type device_type, WINED3DCAPS *caps)
+ enum wined3d_device_type device_type, struct wined3d_caps *caps)
{
const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 5f54826b5668..d1282d72873a 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1874,7 +1874,7 @@ struct wined3d_ddraw_caps
DWORD dds_caps;
};
-typedef struct _WINED3DCAPS
+struct wined3d_caps
{
enum wined3d_device_type DeviceType;
UINT AdapterOrdinal;
@@ -1965,7 +1965,7 @@ typedef struct _WINED3DCAPS
struct wined3d_ddraw_caps ddraw_caps;
BOOL shader_double_precision;
-} WINED3DCAPS;
+};
struct wined3d_color_key
{
@@ -2198,7 +2198,7 @@ UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT
HRESULT __cdecl wined3d_get_adapter_raster_status(const struct wined3d *wined3d, UINT adapter_idx,
struct wined3d_raster_status *raster_status);
HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx,
- enum wined3d_device_type device_type, WINED3DCAPS *caps);
+ enum wined3d_device_type device_type, struct wined3d_caps *caps);
HRESULT __cdecl wined3d_get_output_desc(const struct wined3d *wined3d, unsigned int adapter_idx,
struct wined3d_output_desc *desc);
ULONG __cdecl wined3d_incref(struct wined3d *wined3d);
@@ -2271,7 +2271,7 @@ struct wined3d_sampler * __cdecl wined3d_device_get_cs_sampler(const struct wine
struct wined3d_unordered_access_view * __cdecl wined3d_device_get_cs_uav(const struct wined3d_device *device,
unsigned int idx);
struct wined3d_rendertarget_view * __cdecl wined3d_device_get_depth_stencil_view(const struct wined3d_device *device);
-HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, WINED3DCAPS *caps);
+HRESULT __cdecl wined3d_device_get_device_caps(const struct wined3d_device *device, struct wined3d_caps *caps);
HRESULT __cdecl wined3d_device_get_display_mode(const struct wined3d_device *device, UINT swapchain_idx,
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);
struct wined3d_shader * __cdecl wined3d_device_get_domain_shader(const struct wined3d_device *device);
--
2.16.4
June 13, 2018
[PATCH 1/6] d3d11: Normalize 1D texture view descriptions.
by Józef Kucia
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d11/view.c | 53 +++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/dlls/d3d11/view.c b/dlls/d3d11/view.c
index 80c4888d7821..164a1839e633 100644
--- a/dlls/d3d11/view.c
+++ b/dlls/d3d11/view.c
@@ -132,6 +132,8 @@ static HRESULT normalize_dsv_desc(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11Res
{
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
+ const struct d3d_texture1d *texture;
+
if (desc->ViewDimension != D3D11_DSV_DIMENSION_TEXTURE1D
&& desc->ViewDimension != D3D11_DSV_DIMENSION_TEXTURE1DARRAY)
{
@@ -139,8 +141,15 @@ static HRESULT normalize_dsv_desc(D3D11_DEPTH_STENCIL_VIEW_DESC *desc, ID3D11Res
return E_INVALIDARG;
}
- FIXME("Unhandled 1D texture resource.\n");
- return S_OK;
+ if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource)))
+ {
+ ERR("Cannot get implementation from ID3D11Texture1D.\n");
+ return E_FAIL;
+ }
+
+ format = texture->desc.Format;
+ layer_count = texture->desc.ArraySize;
+ break;
}
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
@@ -344,6 +353,8 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
+ const struct d3d_texture1d *texture;
+
if (desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1D
&& desc->ViewDimension != D3D11_RTV_DIMENSION_TEXTURE1DARRAY)
{
@@ -351,8 +362,15 @@ static HRESULT normalize_rtv_desc(D3D11_RENDER_TARGET_VIEW_DESC *desc, ID3D11Res
return E_INVALIDARG;
}
- FIXME("Unhandled 1D texture resource.\n");
- return S_OK;
+ if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource)))
+ {
+ ERR("Cannot get implementation from ID3D11Texture1D.\n");
+ return E_FAIL;
+ }
+
+ format = texture->desc.Format;
+ layer_count = texture->desc.ArraySize;
+ break;
}
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
@@ -626,6 +644,8 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
+ const struct d3d_texture1d *texture;
+
if (desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1D
&& desc->ViewDimension != D3D11_SRV_DIMENSION_TEXTURE1DARRAY)
{
@@ -633,8 +653,16 @@ static HRESULT normalize_srv_desc(D3D11_SHADER_RESOURCE_VIEW_DESC *desc, ID3D11R
return E_INVALIDARG;
}
- FIXME("Unhandled 1D texture resource.\n");
- return S_OK;
+ if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource)))
+ {
+ ERR("Cannot get implementation from ID3D11Texture1D.\n");
+ return E_FAIL;
+ }
+
+ format = texture->desc.Format;
+ miplevel_count = texture->desc.MipLevels;
+ layer_count = texture->desc.ArraySize;
+ break;
}
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
@@ -871,6 +899,8 @@ static HRESULT normalize_uav_desc(D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
+ const struct d3d_texture1d *texture;
+
if (desc->ViewDimension != D3D11_UAV_DIMENSION_TEXTURE1D
&& desc->ViewDimension != D3D11_UAV_DIMENSION_TEXTURE1DARRAY)
{
@@ -878,8 +908,15 @@ static HRESULT normalize_uav_desc(D3D11_UNORDERED_ACCESS_VIEW_DESC *desc, ID3D11
return E_INVALIDARG;
}
- FIXME("Unhandled 1D texture resource.\n");
- return S_OK;
+ if (!(texture = unsafe_impl_from_ID3D11Texture1D((ID3D11Texture1D *)resource)))
+ {
+ ERR("Cannot get implementation from ID3D11Texture1D.\n");
+ return E_FAIL;
+ }
+
+ format = texture->desc.Format;
+ layer_count = texture->desc.ArraySize;
+ break;
}
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
--
2.16.4
June 13, 2018
[PATCH] testbot: Use FIXME to identify places that need fixing.
by Francois Gouget
The comment that follows should identify the nature of the required
fix.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/ObjectModel/CGI/CollectionBlock.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
index 155717aee..f675e6b26 100644
--- a/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
+++ b/testbot/lib/ObjectModel/CGI/CollectionBlock.pm
@@ -484,7 +484,7 @@ sub OnAction($$)
if ($Action eq "Cancel")
{
-#TODO
+ # FIXME Todo
}
elsif ($Action eq "Add " . $self->{Collection}->GetItemName())
{
--
2.17.1
June 13, 2018
[PATCH] testbot: Fix UpdateStatus() to handle empty jobs and steps.
by Francois Gouget
We should not have empty jobs and steps but if we do make sure they are
marked 'completed'.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/Jobs.pm | 1 +
testbot/lib/WineTestBot/Steps.pm | 1 +
2 files changed, 2 insertions(+)
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index a13b3468e..6951b98c5 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -229,6 +229,7 @@ sub UpdateStatus($)
my $StepStatus = $Step->UpdateStatus($Skip);
$Has{$StepStatus} = 1;
}
+ $Has{completed} = 1 if (!%Has); # This job has no step!
# Inherit the steps most significant status.
# Note that one or more tasks may have been requeued during the cleanup phase
diff --git a/testbot/lib/WineTestBot/Steps.pm b/testbot/lib/WineTestBot/Steps.pm
index 8afe79396..71e04471d 100644
--- a/testbot/lib/WineTestBot/Steps.pm
+++ b/testbot/lib/WineTestBot/Steps.pm
@@ -200,6 +200,7 @@ sub UpdateStatus($$)
my %Has;
map { $Has{$_->UpdateStatus($Skip)} = 1 } (@{$self->Tasks->Clone()->GetItems()});
+ $Has{completed} = 1 if (!%Has); # This step has no task!
# Inherit the tasks most significant status.
# Note that one or more tasks may have been requeued during the cleanup phase
--
2.17.1
June 13, 2018
[PATCH] testbot: Document the dependency on Procmail.
by Francois Gouget
It may be possible to do without it but it is used in the installation
instructions.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/doc/INSTALL.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/doc/INSTALL.txt b/testbot/doc/INSTALL.txt
index cb7c31b97..bae1e8254 100644
--- a/testbot/doc/INSTALL.txt
+++ b/testbot/doc/INSTALL.txt
@@ -5,7 +5,7 @@ Dependencies:
- Apache2 with mod_perl
- MySQL
- Perl DBD and DBI::mysql modules
-- Sendmail
+- Sendmail and Procmail
- Sys::Virt (libsys-virt-perl, see http://libvirt.org/)
- Image::Magick (perlmagick)
- Optional: IO::Socket::IP (for IPv6, libio-socket-ip-perl)
--
2.17.1
June 13, 2018
[PATCH] testbot/web: Let PatchUtils compute the test executable name for Submit.pl.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/web/Submit.pl | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index d5265a3b3..ac9a38488 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -588,7 +588,7 @@ sub DetermineFileType($$)
close FH;
- my ($ErrMessage, $DllBaseName, $TestUnit);
+ my ($ErrMessage, $ExeBase, $TestUnit);
if ($FileType eq "unknown")
{
my $Impacts = GetPatchImpact($FileName);
@@ -604,7 +604,7 @@ sub DetermineFileType($$)
{
my $TestInfo = (values %{$Impacts->{Tests}})[0];
$FileType = $TestInfo->{Type};
- $DllBaseName = $TestInfo->{Module};
+ $ExeBase = $TestInfo->{ExeBase};
$TestUnit = (keys %{$TestInfo->{Units}})[0];
}
}
@@ -614,7 +614,7 @@ sub DetermineFileType($$)
$FileType = "unknown";
}
- return ($ErrMessage, $FileType, $DllBaseName, $TestUnit);
+ return ($ErrMessage, $FileType, $ExeBase, $TestUnit);
}
sub OnPage1Next($)
@@ -644,7 +644,7 @@ sub OnPage1Next($)
}
close OUTFILE;
- my ($ErrMessage, $FileType, $DllBaseName, $TestUnit) = $self->DetermineFileType($StagingFile);
+ my ($ErrMessage, $FileType, $ExeBase, $TestUnit) = $self->DetermineFileType($StagingFile);
if (defined($ErrMessage))
{
$self->{ErrField} = "File";
@@ -661,14 +661,9 @@ sub OnPage1Next($)
$self->{FileName} = $BaseName;
$self->{FileType} = $FileType;
- if (defined($DllBaseName))
+ if (defined $ExeBase)
{
- $self->{TestExecutable} = $DllBaseName;
- if ($FileType eq "patchprograms")
- {
- $self->{TestExecutable} .= ".exe";
- }
- $self->{TestExecutable} .= "_test.exe";
+ $self->{TestExecutable} = "$ExeBase.exe";
}
if (defined($TestUnit))
{
--
2.17.1
June 13, 2018
[PATCH] testbot: Add some section headers to the scripts.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/Janitor.pl | 8 ++++++++
testbot/bin/WineRunBuild.pl | 4 ++++
testbot/bin/WineRunReconfig.pl | 4 ++++
testbot/bin/WineRunTask.pl | 9 +++++++++
testbot/bin/WineSendLog.pl | 10 ++++++++++
5 files changed, 35 insertions(+)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl
index f7a6e33b6..9fb38efde 100755
--- a/testbot/bin/Janitor.pl
+++ b/testbot/bin/Janitor.pl
@@ -53,6 +53,11 @@ use WineTestBot::Tasks;
use WineTestBot::Users;
use WineTestBot::VMs;
+
+#
+# Logging and error handling helpers
+#
+
my $LogOnly;
sub Trace(@)
{
@@ -67,6 +72,9 @@ sub Error(@)
}
+#
+# Setup and command line processing
+#
$ENV{PATH} = "/usr/bin:/bin";
delete $ENV{ENV};
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 61deb50a6..31decc107 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -49,6 +49,10 @@ use WineTestBot::Log;
use WineTestBot::Engine::Notify;
+#
+# Logging and error handling helpers
+#
+
my $Debug;
sub Debug(@)
{
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index 713712cec..99b73da6f 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -48,6 +48,10 @@ use WineTestBot::Log;
use WineTestBot::Engine::Notify;
+#
+# Logging and error handling helpers
+#
+
my $Debug;
sub Debug(@)
{
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index d75741757..3290b0bc6 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -47,6 +47,10 @@ use WineTestBot::Log;
use WineTestBot::Engine::Notify;
+#
+# Logging and error handling helpers
+#
+
my $Debug;
sub Debug(@)
{
@@ -60,6 +64,11 @@ sub Error(@)
LogMsg @_;
}
+
+#
+# Task helpers
+#
+
sub TakeScreenshot($$)
{
my ($VM, $FullScreenshotFileName) = @_;
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 2a8942701..e03395af1 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -501,6 +501,11 @@ EOF
}
}
+
+#
+# Setup and command line processing
+#
+
$ENV{PATH} = "/usr/bin:/bin";
delete $ENV{ENV};
@@ -528,6 +533,11 @@ if (! defined($Job))
exit(1);
}
+
+#
+# Analyze the log and notify the developer
+#
+
SendLog($Job);
LogMsg "Log for job $JobId sent\n";
--
2.17.1
June 13, 2018
[PATCH 3/3] testbot/build: Simplify logging.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/build/Build.pl | 29 ++++++++++++-----------------
testbot/bin/build/Reconfig.pl | 33 ++++++++++++++-------------------
2 files changed, 26 insertions(+), 36 deletions(-)
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index 001f5eb18..3fe0e14ea 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -43,32 +43,27 @@ sub BEGIN
use WineTestBot::Config;
use WineTestBot::PatchUtils;
+my $LogFileName = "$LogDir/Build.log";
+
sub InfoMsg(@)
{
my $OldUMask = umask(002);
- if (open LOGFILE, ">>$LogDir/Build.log")
+ if (open(my $Log, ">>", $LogFileName))
{
- print LOGFILE @_;
- close LOGFILE;
+ print $Log @_;
+ close($Log);
}
umask($OldUMask);
}
sub LogMsg(@)
{
- my $OldUMask = umask(002);
- if (open LOGFILE, ">>$LogDir/Build.log")
- {
- print LOGFILE "Build: ", @_;
- close LOGFILE;
- }
- umask($OldUMask);
+ InfoMsg "Build: ", @_;
}
sub FatalError(@)
{
LogMsg @_;
-
exit 1;
}
@@ -92,7 +87,7 @@ sub ApplyPatch($)
system("( cd $DataDir/wine && set -x && " .
" git apply --verbose $PatchFile && " .
" git add -A " .
- ") >> $LogDir/Build.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Patch failed to apply\n";
@@ -105,7 +100,7 @@ sub ApplyPatch($)
InfoMsg "\nRunning make_makefiles\n";
system("( cd $DataDir/wine && set -x && " .
" ./tools/make_makefiles " .
- ") >> $LogDir/Build.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "make_makefiles failed\n";
@@ -118,7 +113,7 @@ sub ApplyPatch($)
InfoMsg "\nRunning autoconf\n";
system("( cd $DataDir/wine && set -x && " .
" autoconf " .
- ") >>$LogDir/Build.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Autoconf failed\n";
@@ -136,7 +131,7 @@ sub BuildNative()
InfoMsg "\nRebuilding native tools\n";
system("( cd $DataDir/build-native && set -x && " .
" time make -j$ncpus __tooldeps__ " .
- ") >>$LogDir/Build.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Rebuild of native tools failed\n";
@@ -162,7 +157,7 @@ sub BuildTestExecutables($$)
InfoMsg "\nBuilding the $Bits-bit test executable(s)\n";
system("( cd $DataDir/build-mingw$Bits && set -x && " .
" time make -j$ncpus ". join(" ", sort @BuildDirs) .
- ") >>$LogDir/Build.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Rebuild of $Bits-bit crossbuild failed\n";
@@ -186,7 +181,7 @@ $ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
delete $ENV{ENV};
# Start with a clean logfile
-unlink("$LogDir/Build.log");
+unlink($LogFileName);
my ($PatchFile, $BitIndicators);
if (@ARGV == 2)
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl
index bc179951d..babc4a04b 100755
--- a/testbot/bin/build/Reconfig.pl
+++ b/testbot/bin/build/Reconfig.pl
@@ -42,32 +42,27 @@ sub BEGIN
use WineTestBot::Config;
+my $LogFileName = "$LogDir/Reconfig.log";
+
sub InfoMsg(@)
{
my $OldUMask = umask(002);
- if (open LOGFILE, ">>$LogDir/Reconfig.log")
+ if (open(my $Log, ">>", $LogFileName))
{
- print LOGFILE @_;
- close LOGFILE;
+ print $Log @_;
+ close($Log);
}
umask($OldUMask);
}
sub LogMsg(@)
{
- my $OldUMask = umask(002);
- if (open LOGFILE, ">>$LogDir/Reconfig.log")
- {
- print LOGFILE "Reconfig: ", @_;
- close LOGFILE;
- }
- umask($OldUMask);
+ InfoMsg "Reconfig: ", @_;
}
sub FatalError(@)
{
LogMsg @_;
-
exit 1;
}
@@ -92,7 +87,7 @@ sub BuildTestAgentd()
InfoMsg "\nBuilding the native testagentd\n";
system("( cd $::RootDir/src/testagentd && set -x && " .
" time make -j$ncpus build " .
- ") >>$LogDir/Reconfig.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Build testagentd failed\n";
@@ -103,7 +98,7 @@ sub BuildTestAgentd()
InfoMsg "\nRebuilding the Windows TestAgentd\n";
system("( cd $::RootDir/src/testagentd && set -x && " .
" time make -j$ncpus iso " .
- ") >>$LogDir/Reconfig.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Build winetestbot.iso failed\n";
@@ -118,7 +113,7 @@ sub BuildTestLauncher()
InfoMsg "\nRebuilding TestLauncher\n";
system("( cd $::RootDir/src/TestLauncher && set -x && " .
" time make -j$ncpus" .
- ") >>$LogDir/Reconfig.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Build TestLauncher failed\n";
@@ -131,7 +126,7 @@ sub BuildTestLauncher()
sub GitPull()
{
InfoMsg "Updating the Wine source\n";
- system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1");
+ system("cd $DataDir/wine && git pull >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Git pull failed\n";
@@ -167,7 +162,7 @@ sub BuildNative()
" rm -rf * && " .
" time ../wine/configure --enable-win64 --without-x --without-freetype --disable-winetest && " .
" time make -j$ncpus __tooldeps__ " .
- ") >>$LogDir/Reconfig.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
@@ -191,7 +186,7 @@ sub BuildCross($)
" rm -rf * && " .
" time ../wine/configure --host=$Host --with-wine-tools=../build-native --without-x --without-freetype --disable-winetest && " .
" time make -j$ncpus buildtests" .
- ") >>$LogDir/Reconfig.log 2>&1");
+ ") >>$LogFileName 2>&1");
if ($? != 0)
{
LogMsg "Build cross ($Bits bits) failed\n";
@@ -204,8 +199,8 @@ sub BuildCross($)
$ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
delete $ENV{ENV};
-# Start with clean logfile
-unlink("$LogDir/Reconfig.log");
+# Start with a clean logfile
+unlink($LogFileName);
if (! -d "$DataDir/staging" and ! mkdir "$DataDir/staging")
{
--
2.17.1
June 13, 2018
[PATCH 2/3] testbot/build: Move up CountCPus() in Build.pl.
by Francois Gouget
This way it matches Reconfig.pl.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/build/Build.pl | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index 8b1859016..001f5eb18 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -72,6 +72,18 @@ sub FatalError(@)
exit 1;
}
+my $ncpus;
+sub CountCPUs()
+{
+ if (open(my $fh, "<", "/proc/cpuinfo"))
+ {
+ # Linux
+ map { $ncpus++ if (/^processor/); } <$fh>;
+ close($fh);
+ }
+ $ncpus ||= 1;
+}
+
sub ApplyPatch($)
{
my ($PatchFile) = @_;
@@ -117,18 +129,6 @@ sub ApplyPatch($)
return $Impacts;
}
-my $ncpus;
-sub CountCPUs()
-{
- if (open(my $fh, "<", "/proc/cpuinfo"))
- {
- # Linux
- map { $ncpus++ if (/^processor/); } <$fh>;
- close($fh);
- }
- $ncpus ||= 1;
-}
-
sub BuildNative()
{
mkdir "$DataDir/build-native" if (! -d "$DataDir/build-native");
--
2.17.1
June 13, 2018
[PATCH 1/3] testbot/build: Move GitPull() and call it a bit later in Reconfig.pl.
by Francois Gouget
The functions are now declared in the order in which they are called.
Reconfig.pl now builds the TestBot tools and only then grabs the latest
Wine and recompiles it.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/build/Reconfig.pl | 64 +++++++++++++++++------------------
1 file changed, 31 insertions(+), 33 deletions(-)
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl
index 977df6e12..bc179951d 100755
--- a/testbot/bin/build/Reconfig.pl
+++ b/testbot/bin/build/Reconfig.pl
@@ -6,6 +6,7 @@
# 32 and 64 bit winetest binaries.
#
# Copyright 2009 Ge van Geldorp
+# Copyright 2012-2014, 2017-2018 Francois Gouget
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -70,35 +71,6 @@ sub FatalError(@)
exit 1;
}
-sub GitPull()
-{
- InfoMsg "Updating the Wine source\n";
- system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1");
- if ($? != 0)
- {
- LogMsg "Git pull failed\n";
- return !1;
- }
-
- if (open(my $fh, ">", "$DataDir/testlist.txt"))
- {
- foreach my $TestFile (glob("$DataDir/wine/*/*/tests/*.c"),
- glob("$DataDir/wine/*/*/tests/*.spec"))
- {
- next if ($TestFile =~ m=/testlist\.c$=);
- $TestFile =~ s=^$DataDir/wine/==;
- print $fh "$TestFile\n";
- }
- close($fh);
- }
- else
- {
- LogMsg "Could not open 'testlist.txt' for writing: $!\n";
- }
-
- return 1;
-}
-
my $ncpus;
sub CountCPUs()
{
@@ -156,6 +128,35 @@ sub BuildTestLauncher()
return 1;
}
+sub GitPull()
+{
+ InfoMsg "Updating the Wine source\n";
+ system("cd $DataDir/wine && git pull >> $LogDir/Reconfig.log 2>&1");
+ if ($? != 0)
+ {
+ LogMsg "Git pull failed\n";
+ return !1;
+ }
+
+ if (open(my $fh, ">", "$DataDir/testlist.txt"))
+ {
+ foreach my $TestFile (glob("$DataDir/wine/*/*/tests/*.c"),
+ glob("$DataDir/wine/*/*/tests/*.spec"))
+ {
+ next if ($TestFile =~ m=/testlist\.c$=);
+ $TestFile =~ s=^$DataDir/wine/==;
+ print $fh "$TestFile\n";
+ }
+ close($fh);
+ }
+ else
+ {
+ LogMsg "Could not open 'testlist.txt' for writing: $!\n";
+ }
+
+ return 1;
+}
+
sub BuildNative()
{
mkdir "$DataDir/build-native" if (! -d "$DataDir/build-native");
@@ -211,15 +212,12 @@ if (! -d "$DataDir/staging" and ! mkdir "$DataDir/staging")
LogMsg "Unable to create '$DataDir/staging': $!\n";
exit(1);
}
-if (! GitPull())
-{
- exit(1);
-}
CountCPUs();
if (!BuildTestAgentd() ||
!BuildTestLauncher() ||
+ !GitPull() ||
!BuildNative() ||
!BuildCross(32) ||
!BuildCross(64))
--
2.17.1
June 13, 2018
Re: [PATCH 3/3] msvcrt: Implement quick_exit and _crt_at_quick_exit
by Piotr Caban
On 06/13/18 08:16, Fabian Maurer wrote:
> Should I also send in a patch for MSVCRT__onexit to use
> _register_onexit_function, and for __MSVCRT__call_atexit to use
> _execute_onexit_table?
Sure, it makes sense to use this helpers there as well.
Thanks,
Piotr
June 13, 2018
Re: [PATCH] msxml3/tests: Use the available ARRAY_SIZE() macro
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 13, 2018
Re: [PATCH v2] comctl32/taskdialog: Create buttons without templates.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 13, 2018
Re: [PATCH 2/5] wined3d: Get rid of unnecessary enum wined3d_data_type values.
by Józef Kucia
On Tue, Jun 12, 2018 at 6:41 PM, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
> diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
> index 20d4f0773dd..a2c3f00559a 100644
> --- a/dlls/wined3d/shader.c
> +++ b/dlls/wined3d/shader.c
> @@ -2134,14 +2134,6 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
> shader_addline(buffer, " (uint)");
> break;
>
> - case WINED3D_DATA_UNORM:
> - shader_addline(buffer, " (unorm)");
> - break;
> -
> - case WINED3D_DATA_SNORM:
> - shader_addline(buffer, " (snorm)");
> - break;
> -
I don't like that it won't print the correct data type for
declarations. For example, after the patch "dcl_uav_typed_texture2d
(snorm) u0" is "dcl_uav_typed_texture2d (float) u0".
June 13, 2018
[PATCH 2/2] testbot: Create a single Job per patch even for multiple modules.
by Francois Gouget
So far a build task could only provide the 32 and 64 bit test
executables for a single dll or program. Also, because of the lack of
proper dependency support between steps it was impossible to have
multiple build steps. So the TestBot used to create one job per module.
However the patch status site can only keep track of one job per patch.
This means some failures could be missed if they did not happen in the
one job tracked by the patch status site.
Now that Build.pl rebuilds all the impacted test executables the
Testbot systematically creates a single job and a single build task and
retrieves all the test executables in one go. This also has the
advantage of reducing the number of VM reverts.
Another side-effect of this change is that if the patch modifies the
tests of multiple modules and the compilation of one them fails, no
test will be run. Before only the tests impacted by the failed
compilation would have been skipped. However a compilation error is
grounds for resubmitting the patch, at which time the tests will be
rerun anyway.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/WineRunBuild.pl | 65 ++++---------
testbot/lib/WineTestBot/Patches.pm | 143 +++++++++++++----------------
2 files changed, 85 insertions(+), 123 deletions(-)
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 12e34d5c7..61deb50a6 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -43,6 +43,7 @@ $Name0 =~ s+^.*/++;
use WineTestBot::Config;
use WineTestBot::Jobs;
+use WineTestBot::PatchUtils;
use WineTestBot::VMs;
use WineTestBot::Log;
use WineTestBot::Engine::Notify;
@@ -323,31 +324,15 @@ elsif ($Debug and !$VM->GetDomain()->IsPoweredOn())
# Figure out what to build
#
-my ($Run64, $BaseName);
-foreach my $OtherStep (@{$Job->Steps->GetItems()})
+my (%Bitnesses, %TestExes);
+foreach my $TestStep (@{$Job->Steps->GetItems()})
{
- next if ($OtherStep->No == $StepNo);
-
- $Run64 = 1 if ($OtherStep->FileType eq "exe64");
- my $OtherFileName = $OtherStep->FileName;
- if ($OtherFileName =~ m/^([\w_.]+)_test(?:64)?\.exe$/)
+ if ($TestStep->FileType =~ /^exe([0-9]+)$/)
{
- my $OtherBaseName = $1;
- if ($Step->FileType eq "patchprograms")
- {
- $OtherBaseName =~ s/\.exe$//;
- }
- if (defined $BaseName and $BaseName ne $OtherBaseName)
- {
- FatalError("$OtherBaseName doesn't match previously found $BaseName\n");
- }
- $BaseName = $OtherBaseName;
+ $Bitnesses{$1} = 1;
+ $TestExes{$TestStep->FileName} = 1;
}
}
-if (!defined $BaseName)
-{
- FatalError("Could not determine the test executable's base name\n");
-}
#
@@ -363,9 +348,8 @@ if (!$TA->SendFile($FileName, "staging/patch.diff", 0))
}
my $Script = "#!/bin/sh\n" .
"rm -f Build.log\n" .
- "../bin/build/Build.pl patch.diff 32";
-$Script .= ",64"if ($Run64);
-$Script .= " >>Build.log 2>&1\n";
+ "../bin/build/Build.pl patch.diff ". join(",", keys %Bitnesses) .
+ " >>Build.log 2>&1\n";
Debug(Elapsed($Start), " Sending the script: [$Script]\n");
if (!$TA->SendFileFromString($Script, "task", $TestAgent::SENDFILE_EXE))
{
@@ -456,34 +440,25 @@ FatalTAError(undef, $TAError) if (defined $TAError);
# Grab the executables for the next steps
#
-# Don't try copying the test executables if the build step failed
-if ($NewStatus eq "completed")
+my $Impacts = GetPatchImpact($FileName, "nounit");
+my $StepDir = $Step->CreateDir();
+foreach my $TestInfo (values %{$Impacts->{Tests}})
{
- my $StepDir = $Step->CreateDir();
- foreach my $OtherStep (@{$Job->Steps->GetItems()})
+ foreach my $Bits ("", "64")
{
- next if ($OtherStep->No == $StepNo);
-
- my $OtherFileName = $OtherStep->FileName;
- next if ($OtherFileName !~ /^[\w_.]+_test(?:64)?\.exe$/);
+ my $Local = "$TestInfo->{ExeBase}$Bits.exe";
+ next if (!$TestExes{$Local});
- my $Bits = $OtherStep->FileType eq "exe64" ? "64" : "32";
- my $TestExecutable;
- if ($Step->FileType ne "patchprograms")
- {
- $TestExecutable = "build-mingw$Bits/dlls/$BaseName/tests/${BaseName}_test.exe";
- }
- else
+ my $Remote = "build-mingw". ($Bits || "32") ."/$TestInfo->{Path}/$TestInfo->{ExeBase}.exe";
+ Debug(Elapsed($Start), " Retrieving '$Local'\n");
+ if ($TA->GetFile($Remote, "$StepDir/$Local"))
{
- $TestExecutable = "build-mingw$Bits/programs/$BaseName/tests/${BaseName}.exe_test.exe";
+ chmod 0664, "$StepDir/$Local";
}
-
- Debug(Elapsed($Start), " Retrieving '$OtherFileName'\n");
- if (!$TA->GetFile($TestExecutable, "$StepDir/$OtherFileName"))
+ elsif ($TA->GetLastError() !~ /: No such file or directory/)
{
- FatalTAError($TA, "Could not retrieve '$OtherFileName'");
+ FatalTAError($TA, "Could not retrieve '$Local'");
}
- chmod 0664, "$StepDir/$OtherFileName";
}
}
$TA->Disconnect();
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index e349dfe88..258aa2c19 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -157,59 +157,55 @@ sub Submit($$$)
$User = GetBatchUser();
}
- my $Disposition = "Submitted job ";
- my $First = 1;
- foreach my $Module (sort keys %{$Impacts->{Tests}})
- {
- my $TestInfo = $Impacts->{Tests}->{$Module};
- my $Jobs = CreateJobs();
-
- # Create a new job for this patch
- my $NewJob = $Jobs->Add();
- $NewJob->User($User);
- $NewJob->Priority(6);
- my $PropertyDescriptor = $Jobs->GetPropertyDescriptorByName("Remarks");
- my $Subject = $self->Subject;
- $Subject =~ s/\[PATCH[^\]]*]//i;
- $Subject =~ s/[[\(]?\d+\/\d+[\)\]]?//;
- $Subject =~ s/^\s*//;
- $NewJob->Remarks(substr("[wine-patches] " . $Subject, 0,
- $PropertyDescriptor->GetMaxLength()));
- $NewJob->Patch($self);
+ # Create a new job for this patch
+ my $Jobs = CreateJobs();
+ my $NewJob = $Jobs->Add();
+ $NewJob->User($User);
+ $NewJob->Priority(6);
+ my $PropertyDescriptor = $Jobs->GetPropertyDescriptorByName("Remarks");
+ my $Subject = $self->Subject;
+ $Subject =~ s/\[PATCH[^\]]*]//i;
+ $Subject =~ s/[[\(]?\d+\/\d+[\)\]]?//;
+ $Subject =~ s/^\s*//;
+ $NewJob->Remarks(substr("[wine-patches] " . $Subject, 0,
+ $PropertyDescriptor->GetMaxLength()));
+ $NewJob->Patch($self);
+
+ # Add build step to the job
+ my $BuildStep = $NewJob->Steps->Add();
+ $BuildStep->FileName("patch.diff");
+ $BuildStep->FileType("patchdlls"); # This is irrelevant now
+ $BuildStep->InStaging(!1);
+ $BuildStep->Type("build");
+ $BuildStep->DebugLevel(0);
- # Add build step to the job
- my $Steps = $NewJob->Steps;
- my $NewStep = $Steps->Add();
- $NewStep->FileName("patch.diff");
- $NewStep->FileType($TestInfo->{Type});
- $NewStep->InStaging(!1);
- $NewStep->Type("build");
- $NewStep->DebugLevel(0);
-
- # Add build task
- my $VMs = CreateVMs();
- $VMs->AddFilter("Type", ["build"]);
- $VMs->AddFilter("Role", ["base"]);
- my $BuildVM = ${$VMs->GetItems()}[0];
- my $Task = $NewStep->Tasks->Add();
- $Task->VM($BuildVM);
- $Task->Timeout($BuildTimeout);
-
- # Save the build step so other steps can reference it
- my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
- if (defined($ErrMessage))
- {
- $self->Disposition("Failed to submit build step");
- return $ErrMessage;
- }
+ # Add build task
+ my $VMs = CreateVMs();
+ $VMs->AddFilter("Type", ["build"]);
+ $VMs->AddFilter("Role", ["base"]);
+ my $BuildVM = ${$VMs->GetItems()}[0];
+ my $Task = $BuildStep->Tasks->Add();
+ $Task->VM($BuildVM);
+ $Task->Timeout($BuildTimeout);
+
+ # Save the build step so the others can reference it.
+ my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
+ if (defined($ErrMessage))
+ {
+ $self->Disposition("Failed to submit build step");
+ return $ErrMessage;
+ }
- # Stage the patch so it can be picked up by the job
- if (!link($PatchFileName, "$DataDir/staging/job". $NewJob->Id ."_patch.diff"))
- {
- $self->Disposition("Failed to prepare patch file");
- return $!;
- }
+ # Stage the patch so it can be picked up by the job
+ if (!link($PatchFileName, "$DataDir/staging/job". $NewJob->Id ."_patch.diff"))
+ {
+ $self->Disposition("Failed to stage the patch file");
+ return $!;
+ }
+ foreach my $Module (sort keys %{$Impacts->{Tests}})
+ {
+ my $TestInfo = $Impacts->{Tests}->{$Module};
foreach my $Unit (sort keys %{$TestInfo->{Units}})
{
# Add 32 and 64-bit tasks
@@ -221,8 +217,8 @@ sub Submit($$$)
if (@{$VMs->GetKeys()})
{
# Create the corresponding Step
- my $NewStep = $Steps->Add();
- $NewStep->PreviousNo(1);
+ my $NewStep = $NewJob->Steps->Add();
+ $NewStep->PreviousNo($BuildStep->No);
my $FileName = $TestInfo->{ExeBase};
$FileName .= "64" if ($Bits eq "64");
$NewStep->FileName("$FileName.exe");
@@ -243,35 +239,26 @@ sub Submit($$$)
}
}
}
+ }
- # Save it all
- ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
- if (defined $ErrMessage)
- {
- $self->Disposition("Failed to submit job");
- return $ErrMessage;
- }
-
- # Switch Status to staging to indicate we are done setting up the job
- $NewJob->Status("staging");
- ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
- if (defined $ErrMessage)
- {
- $self->Disposition("Failed to submit job (staging)");
- return $ErrMessage;
- }
+ # Save it all
+ ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
+ if (defined $ErrMessage)
+ {
+ $self->Disposition("Failed to submit job");
+ return $ErrMessage;
+ }
- if ($First)
- {
- $First = !1;
- }
- else
- {
- $Disposition .= ", ";
- }
- $Disposition .= $NewJob->Id;
+ # Switch Status to staging to indicate we are done setting up the job
+ $NewJob->Status("staging");
+ ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save();
+ if (defined $ErrMessage)
+ {
+ $self->Disposition("Failed to submit job (staging)");
+ return $ErrMessage;
}
- $self->Disposition($Disposition);
+
+ $self->Disposition("Submitted job ". $NewJob->Id);
return undef;
}
--
2.17.1
June 13, 2018
[PATCH 1/2] testbot: Remove the unneeded Build.pl parameters.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/WineRunBuild.pl | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 7a474e76d..12e34d5c7 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -363,8 +363,7 @@ if (!$TA->SendFile($FileName, "staging/patch.diff", 0))
}
my $Script = "#!/bin/sh\n" .
"rm -f Build.log\n" .
- "../bin/build/Build.pl patch.diff " . $Step->FileType .
- " $BaseName 32";
+ "../bin/build/Build.pl patch.diff 32";
$Script .= ",64"if ($Run64);
$Script .= " >>Build.log 2>&1\n";
Debug(Elapsed($Start), " Sending the script: [$Script]\n");
--
2.17.1
June 13, 2018
[PATCH v2] comctl32/taskdialog: Create buttons without templates.
by Zhiyi Zhang
Supersede 147257 and 147258.
Create buttons without templates and delete all unnecessary
templates related infrastructures.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 293 ++++++++++---------------------------
1 file changed, 74 insertions(+), 219 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index d71189d4de..7a09b8a6d2 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -34,16 +34,10 @@
#include "comctl32.h"
#include "wine/debug.h"
-#include "wine/list.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(taskdialog);
-#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
-#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
-#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
-#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
-
static const UINT DIALOG_MIN_WIDTH = 240;
static const UINT DIALOG_SPACING = 5;
static const UINT DIALOG_BUTTON_WIDTH = 50;
@@ -52,28 +46,6 @@ static const UINT DIALOG_TIMER_MS = 200;
static const UINT ID_TIMER = 1;
-struct taskdialog_control
-{
- struct list entry;
- DLGITEMTEMPLATE *template;
- unsigned int template_size;
-};
-
-struct taskdialog_button_desc
-{
- int id;
- const WCHAR *text;
- HINSTANCE hinst;
-};
-
-struct taskdialog_template_desc
-{
- const TASKDIALOGCONFIG *taskconfig;
- struct list controls;
- WORD control_count;
- struct taskdialog_button_desc *default_button;
-};
-
struct taskdialog_info
{
HWND hwnd;
@@ -84,6 +56,9 @@ struct taskdialog_info
/* Control handles */
HWND main_instruction;
HWND content;
+ HWND *buttons;
+ INT button_count;
+ HWND default_button;
/* Dialog metrics */
struct
{
@@ -96,8 +71,6 @@ struct taskdialog_info
struct button_layout_info
{
- INT id;
- HWND hwnd;
LONG width;
LONG line;
};
@@ -114,138 +87,6 @@ static void template_write_data(char **ptr, const void *src, unsigned int size)
*ptr += size;
}
-static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
- HINSTANCE hInstance, const WCHAR *text, DWORD style)
-{
- struct taskdialog_control *control = Alloc(sizeof(*control));
- unsigned int size, class_size, text_size;
- DLGITEMTEMPLATE *template;
- static const WCHAR nulW;
- const WCHAR *textW;
- char *ptr;
-
- class_size = (strlenW(class) + 1) * sizeof(WCHAR);
-
- if (IS_INTRESOURCE(text))
- text_size = LoadStringW(hInstance, (UINT_PTR)text, (WCHAR *)&textW, 0) * sizeof(WCHAR);
- else
- {
- textW = text;
- text_size = strlenW(textW) * sizeof(WCHAR);
- }
-
- size = sizeof(DLGITEMTEMPLATE);
- size += class_size;
- size += text_size + sizeof(WCHAR);
- size += sizeof(WORD); /* creation data */
-
- control->template = template = Alloc(size);
- control->template_size = size;
-
- template->style = WS_VISIBLE | style;
- template->dwExtendedStyle = 0;
- template->id = id;
- ptr = (char *)(template + 1);
- template_write_data(&ptr, class, class_size);
- template_write_data(&ptr, textW, text_size);
- template_write_data(&ptr, &nulW, sizeof(nulW));
-
- list_add_tail(&desc->controls, &control->entry);
- desc->control_count++;
- return ALIGNED_LENGTH(size, 3);
-}
-
-static void taskdialog_init_button(struct taskdialog_button_desc *button, struct taskdialog_template_desc *desc,
- int id, const WCHAR *text, BOOL custom_button)
-{
- button->id = id;
- button->text = text;
- button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
-
- if (id == desc->taskconfig->nDefaultButton)
- desc->default_button = button;
-}
-
-static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons,
- unsigned int *button_count)
-{
- DWORD flags = desc->taskconfig->dwCommonButtons;
-
-#define TASKDIALOG_INIT_COMMON_BUTTON(id) \
- do { \
- taskdialog_init_button(&buttons[(*button_count)++], desc, ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), FALSE); \
- } while(0)
-
- if (flags & TDCBF_OK_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(OK);
- if (flags & TDCBF_YES_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(YES);
- if (flags & TDCBF_NO_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(NO);
- if (flags & TDCBF_RETRY_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(RETRY);
- if (flags & TDCBF_CANCEL_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(CANCEL);
- if (flags & TDCBF_CLOSE_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(CLOSE);
-
-#undef TASKDIALOG_INIT_COMMON_BUTTON
-}
-
-static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc)
-{
- unsigned int count = 0, buttons_size, i, size = 0;
- const TASKDIALOGCONFIG *taskconfig = desc->taskconfig;
- struct taskdialog_button_desc *buttons;
-
- /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
- buttons_size = 6;
- if (taskconfig->cButtons && taskconfig->pButtons)
- buttons_size += taskconfig->cButtons;
-
- if (!(buttons = Alloc(buttons_size * sizeof(*buttons))))
- return 0;
-
- /* Custom buttons */
- if (taskconfig->cButtons && taskconfig->pButtons)
- for (i = 0; i < taskconfig->cButtons; i++)
- taskdialog_init_button(&buttons[count++], desc, taskconfig->pButtons[i].nButtonID,
- taskconfig->pButtons[i].pszButtonText, TRUE);
-
- /* Common buttons */
- taskdialog_init_common_buttons(desc, buttons, &count);
-
- /* There must be at least one button */
- if (count == 0)
- taskdialog_init_button(&buttons[count++], desc, IDOK, MAKEINTRESOURCEW(IDS_BUTTON_OK), FALSE);
-
- if (!desc->default_button)
- desc->default_button = &buttons[0];
-
- /* create all buttons */
- for (i = 0; i < count; i++)
- {
- DWORD style = &buttons[i] == desc->default_button ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
- size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, style);
- }
-
- Free(buttons);
-
- return size;
-}
-
-static void taskdialog_clear_controls(struct list *controls)
-{
- struct taskdialog_control *control, *control2;
-
- LIST_FOR_EACH_ENTRY_SAFE(control, control2, controls, struct taskdialog_control, entry)
- {
- list_remove(&control->entry);
- Free(control->template);
- Free(control);
- }
-}
-
static unsigned int taskdialog_get_reference_rect(const TASKDIALOGCONFIG *taskconfig, RECT *ret)
{
HMONITOR monitor = MonitorFromWindow(taskconfig->hwndParent ? taskconfig->hwndParent : GetActiveWindow(),
@@ -279,9 +120,7 @@ static WCHAR *taskdialog_get_exe_name(WCHAR *name, DWORD length)
static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
{
- struct taskdialog_control *control, *control2;
unsigned int size, title_size;
- struct taskdialog_template_desc desc;
static const WORD fontsize = 0x7fff;
static const WCHAR emptyW[] = { 0 };
const WCHAR *titleW = NULL;
@@ -307,25 +146,13 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
size += title_size;
size += 2; /* font size */
- list_init(&desc.controls);
- desc.taskconfig = taskconfig;
- desc.control_count = 0;
- desc.default_button = NULL;
-
- size += taskdialog_add_buttons(&desc);
-
template = Alloc(size);
- if (!template)
- {
- taskdialog_clear_controls(&desc.controls);
- return NULL;
- }
+ if (!template) return NULL;
template->style = DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_SYSMENU;
if (taskconfig->dwFlags & TDF_CAN_BE_MINIMIZED) template->style |= WS_MINIMIZEBOX;
if (!(taskconfig->dwFlags & TDF_NO_SET_FOREGROUND)) template->style |= DS_SETFOREGROUND;
if (taskconfig->dwFlags & TDF_RTL_LAYOUT) template->dwExtendedStyle = WS_EX_LAYOUTRTL | WS_EX_RIGHT | WS_EX_RTLREADING;
- template->cdit = desc.control_count;
ptr = (char *)(template + 1);
ptr += 2; /* menu */
@@ -333,19 +160,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
template_write_data(&ptr, titleW, title_size);
template_write_data(&ptr, &fontsize, sizeof(fontsize));
- /* write control entries */
- LIST_FOR_EACH_ENTRY_SAFE(control, control2, &desc.controls, struct taskdialog_control, entry)
- {
- ALIGN_POINTER(ptr, 3);
-
- template_write_data(&ptr, control->template, control->template_size);
-
- /* list item won't be needed later */
- list_remove(&control->entry);
- Free(control->template);
- Free(control);
- }
-
return template;
}
@@ -450,6 +264,58 @@ static void taskdialog_add_content(struct taskdialog_info *dialog_info)
dialog_info->content = taskdialog_create_label(dialog_info, dialog_info->taskconfig->pszContent, dialog_info->font);
}
+static void taskdialog_add_button(struct taskdialog_info *dialog_info, HWND *button, INT id, const WCHAR *text,
+ BOOL custom_button)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ WCHAR *textW;
+
+ textW = taskdialog_gettext(dialog_info, custom_button, text);
+ *button = CreateWindowW(WC_BUTTONW, textW, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, dialog_info->hwnd,
+ (HMENU)id, 0, NULL);
+ Free(textW);
+ SendMessageW(*button, WM_SETFONT, (WPARAM)dialog_info->font, 0);
+
+ if (id == taskconfig->nDefaultButton && !dialog_info->default_button) dialog_info->default_button = *button;
+}
+
+static void taskdialog_add_buttons(struct taskdialog_info *dialog_info)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ DWORD flags = taskconfig->dwCommonButtons;
+ INT count, max_count;
+
+ /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
+ max_count = 6;
+ if (taskconfig->cButtons && taskconfig->pButtons) max_count += taskconfig->cButtons;
+
+ dialog_info->buttons = Alloc(max_count * sizeof(*dialog_info->buttons));
+ if (!dialog_info->buttons) return;
+
+ for (count = 0; count < taskconfig->cButtons; count++)
+ taskdialog_add_button(dialog_info, &dialog_info->buttons[count], taskconfig->pButtons[count].nButtonID,
+ taskconfig->pButtons[count].pszButtonText, TRUE);
+
+#define TASKDIALOG_INIT_COMMON_BUTTON(id) \
+ do \
+ { \
+ taskdialog_add_button(dialog_info, &dialog_info->buttons[count++], ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), \
+ FALSE); \
+ } while (0)
+
+ if (flags & TDCBF_OK_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(OK);
+ if (flags & TDCBF_YES_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(YES);
+ if (flags & TDCBF_NO_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(NO);
+ if (flags & TDCBF_RETRY_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(RETRY);
+ if (flags & TDCBF_CANCEL_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(CANCEL);
+ if (flags & TDCBF_CLOSE_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(CLOSE);
+
+ if (!count) TASKDIALOG_INIT_COMMON_BUTTON(OK);
+#undef TASKDIALOG_INIT_COMMON_BUTTON
+
+ dialog_info->button_count = count;
+}
+
static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hwnd, INT start_x, LONG dialog_width,
LONG *dialog_height)
{
@@ -469,12 +335,10 @@ static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hw
static void taskdialog_layout(struct taskdialog_info *dialog_info)
{
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
- DWORD flags = taskconfig->dwCommonButtons;
static BOOL first_time = TRUE;
RECT ref_rect;
LONG screen_width, dialog_width, dialog_height = 0;
LONG h_spacing, v_spacing;
- INT button_max_count, button_count = 0;
struct button_layout_info *button_layout_infos;
LONG button_min_width, button_height;
LONG *line_widths, line_count, align;
@@ -497,39 +361,21 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
taskdialog_label_layout(dialog_info, dialog_info->content, 0, dialog_width, &dialog_height);
/* Common and custom buttons */
- /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
- button_max_count = 6;
- /* Custom buttons */
- if (taskconfig->cButtons && taskconfig->pButtons) button_max_count += taskconfig->cButtons;
-
- button_layout_infos = Alloc(button_max_count * sizeof(*button_layout_infos));
- line_widths = Alloc(button_max_count * sizeof(*line_widths));
-
- if (taskconfig->cButtons && taskconfig->pButtons)
- for (button_count = 0; button_count < taskconfig->cButtons; button_count++)
- button_layout_infos[button_count].id = taskconfig->pButtons[button_count].nButtonID;
-
- /* Ok button may be added if no button is specified in taskconfig */
- if (GetDlgItem(dialog_info->hwnd, IDOK)) button_layout_infos[button_count++].id = IDOK;
- if (flags & TDCBF_YES_BUTTON) button_layout_infos[button_count++].id = IDYES;
- if (flags & TDCBF_NO_BUTTON) button_layout_infos[button_count++].id = IDNO;
- if (flags & TDCBF_RETRY_BUTTON) button_layout_infos[button_count++].id = IDRETRY;
- if (flags & TDCBF_CANCEL_BUTTON) button_layout_infos[button_count++].id = IDCANCEL;
- if (flags & TDCBF_CLOSE_BUTTON) button_layout_infos[button_count++].id = IDCLOSE;
+ button_layout_infos = Alloc(dialog_info->button_count * sizeof(*button_layout_infos));
+ line_widths = Alloc(dialog_info->button_count * sizeof(*line_widths));
button_min_width = DIALOG_BUTTON_WIDTH;
button_height = DIALOG_BUTTON_HEIGHT;
taskdialog_du_to_px(dialog_info, &button_min_width, &button_height);
- for (i = 0; i < button_count; i++)
+ for (i = 0; i < dialog_info->button_count; i++)
{
- button_layout_infos[i].hwnd = GetDlgItem(dialog_info->hwnd, button_layout_infos[i].id);
- taskdialog_get_label_size(dialog_info, button_layout_infos[i].hwnd, dialog_width - h_spacing * 2, &size);
+ taskdialog_get_label_size(dialog_info, dialog_info->buttons[i], dialog_width - h_spacing * 2, &size);
button_layout_infos[i].width = max(size.cx, button_min_width);
}
/* Separate buttons into lines */
x = h_spacing;
- for (i = 0, line_count = 0; i < button_count; i++)
+ for (i = 0, line_count = 0; i < dialog_info->button_count; i++)
{
if (x + button_layout_infos[i].width + h_spacing >= dialog_width)
{
@@ -551,7 +397,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
unsigned int j, last_button = 0;
int diff_changed;
- for (j = 0; j < button_count; j++)
+ for (j = 0; j < dialog_info->button_count; j++)
if (button_layout_infos[j].line == i - 1) last_button = j;
/* Difference in length of both lines if we wrapped the last button from the last line into this one */
@@ -576,7 +422,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
/* Now that we got them all positioned, move all buttons */
x = align;
size.cy = button_height;
- for (i = 0; i < button_count; i++)
+ for (i = 0; i < dialog_info->button_count; i++)
{
/* New line */
if (i > 0 && button_layout_infos[i].line != button_layout_infos[i - 1].line)
@@ -587,7 +433,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
y = dialog_height + v_spacing;
size.cx = button_layout_infos[i].width;
- SetWindowPos(button_layout_infos[i].hwnd, 0, x, y, size.cx, size.cy, SWP_NOZORDER);
+ SetWindowPos(dialog_info->buttons[i], 0, x, y, size.cx, size.cy, SWP_NOZORDER);
x += button_layout_infos[i].width + h_spacing;
}
@@ -618,6 +464,7 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
NONCLIENTMETRICSW ncm;
HDC hdc;
+ INT id;
ncm.cbSize = sizeof(ncm);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
@@ -644,6 +491,13 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
taskdialog_add_main_instruction(dialog_info);
taskdialog_add_content(dialog_info);
+ taskdialog_add_buttons(dialog_info);
+
+ /* Set default button */
+ if (!dialog_info->default_button) dialog_info->default_button = dialog_info->buttons[0];
+ SendMessageW(dialog_info->hwnd, WM_NEXTDLGCTL, (WPARAM)dialog_info->default_button, TRUE);
+ id = GetWindowLongW(dialog_info->default_button, GWLP_ID);
+ SendMessageW(dialog_info->hwnd, DM_SETDEFID, id, 0);
taskdialog_layout(dialog_info);
}
@@ -653,6 +507,7 @@ static void taskdialog_destroy(struct taskdialog_info *dialog_info)
if (dialog_info->taskconfig->dwFlags & TDF_CALLBACK_TIMER) KillTimer(dialog_info->hwnd, ID_TIMER);
if (dialog_info->font) DeleteObject(dialog_info->font);
if (dialog_info->main_instruction_font) DeleteObject(dialog_info->main_instruction_font);
+ if (dialog_info->buttons) Free(dialog_info->buttons);
}
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -678,7 +533,7 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SetPropW(hwnd, taskdialog_info_propnameW, dialog_info);
taskdialog_notify(dialog_info, TDN_DIALOG_CONSTRUCTED, 0, 0);
taskdialog_notify(dialog_info, TDN_CREATED, 0, 0);
- break;
+ return FALSE;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
--
2.17.1
June 13, 2018
Re: [PATCH] msi/tests: Avoid ARRAY_SIZE-like macros
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
June 13, 2018
Re: [PATCH 3/3] msvcrt: Implement quick_exit and _crt_at_quick_exit
by Fabian Maurer
> atexit and at_quick_exit needs to manage similar table of functions.
> Because of that there's a set of helper functions that can be used to
> accomplish it (*_onexit_table functions). It's even documented that it's
> used internally: https://msdn.microsoft.com/en-us/library/mt670601.aspx
Yes, this makes sense.
Should I also send in a patch for MSVCRT__onexit to use _register_onexit_function,
and for __MSVCRT__call_atexit to use _execute_onexit_table?
Because those too duplicate the functionality, that's where I got that from.
I'd also add some tests while I'm on it.
Regards,
Fabian Maurer
June 13, 2018
[PATCH 3/3] mstask/tests: Add some tests for workitem data.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/tests/task.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/dlls/mstask/tests/task.c b/dlls/mstask/tests/task.c
index 0e2b4339ad..4e8386a008 100644
--- a/dlls/mstask/tests/task.c
+++ b/dlls/mstask/tests/task.c
@@ -720,6 +720,60 @@ static void test_SetFlags(void)
ITask_Release(task);
}
+static void test_workitem_data(void)
+{
+ static BYTE hello[] = "Hello World!";
+ HRESULT hr;
+ ITask *task;
+ WORD count;
+ BYTE *data;
+
+ hr = ITaskScheduler_NewWorkItem(scheduler, task_name, &CLSID_CTask,
+ &IID_ITask, (IUnknown **)&task);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ if (0) /* crashes under Windows */
+ hr = ITask_GetWorkItemData(task, &count, NULL);
+ if (0) /* crashes under Windows */
+ hr = ITask_GetWorkItemData(task, NULL, &data);
+
+ count = 0xdead;
+ data = (BYTE *)0xdeadbeef;
+ hr = ITask_GetWorkItemData(task, &count, &data);
+ ok(hr == S_OK, "got %#x\n", hr);
+ ok(count == 0, "got %u\n", count);
+ ok(data == NULL, "got %p\n", data);
+
+ hr = ITask_SetWorkItemData(task, sizeof(hello), NULL);
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
+
+ hr = ITask_SetWorkItemData(task, 0, hello);
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
+
+ hr = ITask_SetWorkItemData(task, sizeof(hello), hello);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ count = 0xdead;
+ data = NULL;
+ hr = ITask_GetWorkItemData(task, &count, &data);
+ ok(hr == S_OK, "got %#x\n", hr);
+ ok(count == sizeof(hello), "got %u\n", count);
+ ok(data != NULL, "got NULL\n");
+ ok(!memcmp(data, hello, sizeof(hello)), "data mismatch\n");
+
+ hr = ITask_SetWorkItemData(task, 0, NULL);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ count = 0xdead;
+ data = (BYTE *)0xdeadbeef;
+ hr = ITask_GetWorkItemData(task, &count, &data);
+ ok(hr == S_OK, "got %#x\n", hr);
+ ok(count == 0, "got %u\n", count);
+ ok(data == NULL, "got %p\n", data);
+
+ ITask_Release(task);
+}
+
START_TEST(task)
{
HRESULT hr;
@@ -738,6 +792,7 @@ START_TEST(task)
test_task_state();
test_Run();
test_SetFlags();
+ test_workitem_data();
ITaskScheduler_Release(scheduler);
CoUninitialize();
--
2.16.3
June 13, 2018
[PATCH 2/3] mstask: Implement ITask::GetWorkItemData().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 54e4912bc7..490229ae71 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -840,13 +840,26 @@ static HRESULT WINAPI MSTASK_ITask_SetWorkItemData(ITask *iface, WORD count, BYT
return S_OK;
}
-static HRESULT WINAPI MSTASK_ITask_GetWorkItemData(
- ITask* iface,
- WORD *pcBytes,
- BYTE **ppBytes)
+static HRESULT WINAPI MSTASK_ITask_GetWorkItemData(ITask *iface, WORD *count, BYTE **data)
{
- FIXME("(%p, %p, %p): stub\n", iface, pcBytes, ppBytes);
- return E_NOTIMPL;
+ TaskImpl *This = impl_from_ITask(iface);
+
+ TRACE("(%p, %p, %p)\n", iface, count, data);
+
+ if (!This->data)
+ {
+ *count = 0;
+ *data = NULL;
+ }
+ else
+ {
+ *data = CoTaskMemAlloc(This->data_count);
+ if (!*data) return E_OUTOFMEMORY;
+ memcpy(*data, This->data, This->data_count);
+ *count = This->data_count;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI MSTASK_ITask_SetErrorRetryCount(
--
2.16.3
June 13, 2018
[PATCH 1/3] mstask: Implement ITask::SetWorkItemData().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task.c | 36 ++++++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 69f1e5f95c..54e4912bc7 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -58,6 +58,8 @@ typedef struct
LONG ref;
ITaskDefinition *task;
IExecAction *action;
+ BYTE *data;
+ WORD data_count;
UUID uuid;
LPWSTR task_name;
HRESULT status;
@@ -87,6 +89,7 @@ static void TaskDestructor(TaskImpl *This)
if (This->action)
IExecAction_Release(This->action);
ITaskDefinition_Release(This->task);
+ heap_free(This->data);
heap_free(This->task_name);
heap_free(This->accountName);
heap_free(This->trigger);
@@ -809,13 +812,32 @@ static HRESULT WINAPI MSTASK_ITask_GetCreator(ITask *iface, LPWSTR *creator)
return hr;
}
-static HRESULT WINAPI MSTASK_ITask_SetWorkItemData(
- ITask* iface,
- WORD cBytes,
- BYTE rgbData[])
+static HRESULT WINAPI MSTASK_ITask_SetWorkItemData(ITask *iface, WORD count, BYTE data[])
{
- FIXME("(%p, %d, %p): stub\n", iface, cBytes, rgbData);
- return E_NOTIMPL;
+ TaskImpl *This = impl_from_ITask(iface);
+
+ TRACE("(%p, %u, %p)\n", iface, count, data);
+
+ if (count)
+ {
+ if (!data) return E_INVALIDARG;
+
+ heap_free(This->data);
+ This->data = heap_alloc(count);
+ if (!This->data) return E_OUTOFMEMORY;
+ memcpy(This->data, data, count);
+ This->data_count = count;
+ }
+ else
+ {
+ if (data) return E_INVALIDARG;
+
+ heap_free(This->data);
+ This->data = NULL;
+ This->data_count = 0;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI MSTASK_ITask_GetWorkItemData(
@@ -1865,6 +1887,8 @@ HRESULT TaskConstructor(ITaskService *service, const WCHAR *name, ITask **task)
This->IPersistFile_iface.lpVtbl = &MSTASK_IPersistFileVtbl;
This->ref = 1;
This->task = taskdef;
+ This->data = NULL;
+ This->data_count = 0;
This->task_name = heap_strdupW(task_name);
This->flags = 0;
This->status = SCHED_S_TASK_NOT_SCHEDULED;
--
2.16.3
June 13, 2018
[PATCH 3/3] widl: Use publicly defined NDR constants.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
include/wine/rpcfc.h | 205 -------------
tools/widl/client.c | 12 +-
tools/widl/expr.c | 6 +-
tools/widl/header.c | 12 +-
tools/widl/parser.y | 20 +-
tools/widl/proxy.c | 2 +-
tools/widl/server.c | 2 +-
tools/widl/typegen.c | 798 ++++++++++++++++++++++++-------------------------
tools/widl/widltypes.h | 2 +-
9 files changed, 427 insertions(+), 632 deletions(-)
delete mode 100644 include/wine/rpcfc.h
diff --git a/include/wine/rpcfc.h b/include/wine/rpcfc.h
deleted file mode 100644
index 53dd163..0000000
--- a/include/wine/rpcfc.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * RPC format chars, as found by studying MIDL output.
- * Some, but not all, usage of these are explained on MSDN.
- */
-
-#ifndef __WINE_RPCFC_H
-#define __WINE_RPCFC_H
-
-/* base types */
-#define RPC_FC_BYTE 0x01
-#define RPC_FC_CHAR 0x02
-#define RPC_FC_SMALL 0x03
-#define RPC_FC_USMALL 0x04
-#define RPC_FC_WCHAR 0x05
-#define RPC_FC_SHORT 0x06
-#define RPC_FC_USHORT 0x07
-#define RPC_FC_LONG 0x08
-#define RPC_FC_ULONG 0x09
-#define RPC_FC_FLOAT 0x0a
-#define RPC_FC_HYPER 0x0b
-#define RPC_FC_DOUBLE 0x0c
-#define RPC_FC_ENUM16 0x0d
-#define RPC_FC_ENUM32 0x0e
-#define RPC_FC_IGNORE 0x0f
-#define RPC_FC_ERROR_STATUS_T 0x10
-
-/* other stuff */
-#define RPC_FC_RP 0x11 /* reference pointer */
-#define RPC_FC_UP 0x12 /* unique pointer */
-#define RPC_FC_OP 0x13 /* unique pointer in object ? */
-#define RPC_FC_FP 0x14 /* full pointer */
-
-#define RPC_FC_STRUCT 0x15 /* simple structure */
-/* FC_STRUCT: align-1, NdrFcShort(size), fields */
-
-#define RPC_FC_PSTRUCT 0x16 /* simple structure w/ pointers */
-/* FC_PTRUCT: align-1, NdrFcShort(size), ptrs, fields */
-
-#define RPC_FC_CSTRUCT 0x17 /* conformant structure */
-
-#define RPC_FC_CPSTRUCT 0x18 /* conformant structure w/ pointers */
-
-#define RPC_FC_CVSTRUCT 0x19 /* conformant varying struct */
-
-#define RPC_FC_BOGUS_STRUCT 0x1a /* complex structure */
-
-#define RPC_FC_CARRAY 0x1b /* conformant array */
-/* FC_CARRAY: align-1, NdrFcShort(size), conformance, ptrs, fields */
-#define RPC_FC_CVARRAY 0x1c /* conformant varying array */
-/* FC_CARRAY: align-1, NdrFcShort(size), conformance, variance, ptrs, fields */
-#define RPC_FC_SMFARRAY 0x1d /* small (<64K) fixed array */
-/* FC_SMFARRAY: align-1, NdrFcShort(size), ptrs, fields */
-
-#define RPC_FC_LGFARRAY 0x1e /* large (>= 64k) fixed array */
-
-#define RPC_FC_SMVARRAY 0x1f /* small (<64k) varying array */
-
-#define RPC_FC_LGVARRAY 0x20 /* large (>= 64k) varying array */
-
-#define RPC_FC_BOGUS_ARRAY 0x21 /* complex array */
-
-#define RPC_FC_C_CSTRING 0x22
-#define RPC_FC_C_SSTRING 0x24
-#define RPC_FC_C_WSTRING 0x25
-#define RPC_FC_CSTRING 0x26
-#define RPC_FC_SSTRING 0x28
-#define RPC_FC_WSTRING 0x29
-
-#define RPC_FC_ENCAPSULATED_UNION 0x2a
-#define RPC_FC_NON_ENCAPSULATED_UNION 0x2b
-
-#define RPC_FC_BYTE_COUNT_POINTER 0x2c /* [byte_count] ACF attribute */
-
-#define RPC_FC_TRANSMIT_AS 0x2d
-#define RPC_FC_REPRESENT_AS 0x2e
-
-#define RPC_FC_IP 0x2f /* interface pointer */
-/* FC_IP: FC_CONSTANT_IID iid */
-/* FC_IP: FC_PAD correlation */
-
-#define RPC_FC_BIND_CONTEXT 0x30
-
-#define RPC_FC_BIND_GENERIC 0x31
-#define RPC_FC_BIND_PRIMITIVE 0x32
-#define RPC_FC_AUTO_HANDLE 0x33
-#define RPC_FC_CALLBACK_HANDLE 0x34
-
-#define RPC_FC_POINTER 0x36
-
-#define RPC_FC_ALIGNM2 0x37
-#define RPC_FC_ALIGNM4 0x38
-#define RPC_FC_ALIGNM8 0x39
-
-#define RPC_FC_STRUCTPAD1 0x3d
-#define RPC_FC_STRUCTPAD2 0x3e
-#define RPC_FC_STRUCTPAD3 0x3f
-#define RPC_FC_STRUCTPAD4 0x40
-#define RPC_FC_STRUCTPAD5 0x41
-#define RPC_FC_STRUCTPAD6 0x42
-#define RPC_FC_STRUCTPAD7 0x43
-
-#define RPC_FC_STRING_SIZED 0x44
-
-#define RPC_FC_NO_REPEAT 0x46
-#define RPC_FC_FIXED_REPEAT 0x47
-#define RPC_FC_VARIABLE_REPEAT 0x48
-#define RPC_FC_FIXED_OFFSET 0x49
-#define RPC_FC_VARIABLE_OFFSET 0x4a
-
-#define RPC_FC_PP 0x4b /* pointer layout */
-/* FC_PP: FC_PAD layouts */
-/* layouts: FC_NO_REPEAT FC_PAD instance */
-/* instance: NdrFcShort(memofs), NdrFcShort(bufofs), desc */
-
-#define RPC_FC_EMBEDDED_COMPLEX 0x4c
-/* FC_EMBEDDED_COMPLEX: padding, NdrFcShort(typeofs) */
-
-#define RPC_FC_IN_PARAM 0x4d
-/* FC_IN_PARAM: stacksiz, NdrFcShort(typeofs) */
-#define RPC_FC_IN_PARAM_BASETYPE 0x4e
-/* FC_IN_PARAM_BASETYPE: basetype */
-#define RPC_FC_IN_PARAM_NO_FREE_INST 0x4f
-#define RPC_FC_IN_OUT_PARAM 0x50
-/* FC_IN_OUT_PARAM: stacksiz, NdrFcShort(typeofs) */
-#define RPC_FC_OUT_PARAM 0x51
-/* FC_OUT_PARAM: stacksiz, NdrFcShort(typeofs) */
-#define RPC_FC_RETURN_PARAM 0x52
-/* FC_RETURN_PARAM: stacksiz, NdrFcShort(typeofs) */
-#define RPC_FC_RETURN_PARAM_BASETYPE 0x53
-/* FC_RETURN_PARAM_BASETYPE: basetype */
-
-#define RPC_FC_DEREFERENCE 0x54
-#define RPC_FC_DIV_2 0x55
-#define RPC_FC_MULT_2 0x56
-#define RPC_FC_ADD_1 0x57
-#define RPC_FC_SUB_1 0x58
-
-#define RPC_FC_CALLBACK 0x59
-
-#define RPC_FC_CONSTANT_IID 0x5a
-/* FC_CONSTANT_IID: NdrFcLong(), NdrFcShort(), NdrFcShort(), 8x () */
-
-#define RPC_FC_END 0x5b
-#define RPC_FC_PAD 0x5c
-
-#define RPC_FC_USER_MARSHAL 0xb4
-
-#define RPC_FC_RANGE 0xb7
-
-#define RPC_FC_INT3264 0xb8
-#define RPC_FC_UINT3264 0xb9
-
-/* FC_RP/UP/OP/FP: flags, NdrFcShort(typeofs)/basetype */
-#define RPC_FC_P_ALLOCALLNODES 0x01
-#define RPC_FC_P_DONTFREE 0x02
-#define RPC_FC_P_ONSTACK 0x04 /* [alloced_on_stack] */
-#define RPC_FC_P_SIMPLEPOINTER 0x08 /* [simple_pointer] */
-#define RPC_FC_P_DEREF 0x10
-
-#define RPC_FC_BIND_EXPLICIT 0x00
-
-/* proc header: oiflags, NdrFcLong(rpcflags), NdrFcShort(procnum), NdrFcShort(stacksiz),
- * oi2 header: NdrFcShort(clientbuf), NdrFcShort(servbuf), oi2flags, parmcount
- * oi2 parameters: NdrFcShort(flags), NdrFcShort(stackofs), NdrFcShort(typeofs)/basetype */
-#define RPC_FC_PROC_OIF_FULLPTR 0x01
-#define RPC_FC_PROC_OIF_RPCSSALLOC 0x02
-#define RPC_FC_PROC_OIF_OBJECT 0x04
-#define RPC_FC_PROC_OIF_RPCFLAGS 0x08
-#define RPC_FC_PROC_OIF_OBJ_V2 0x20
-#define RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT 0x20
-#define RPC_FC_PROC_OIF_NEWINIT 0x40
-
-#define RPC_FC_PROC_PF_MUSTSIZE 0x0001
-#define RPC_FC_PROC_PF_MUSTFREE 0x0002
-#define RPC_FC_PROC_PF_PIPE 0x0004
-#define RPC_FC_PROC_PF_IN 0x0008
-#define RPC_FC_PROC_PF_OUT 0x0010
-#define RPC_FC_PROC_PF_RETURN 0x0020
-#define RPC_FC_PROC_PF_BASETYPE 0x0040
-#define RPC_FC_PROC_PF_BYVAL 0x0080
-#define RPC_FC_PROC_PF_SIMPLEREF 0x0100
-#define RPC_FC_PROC_PF_DONTFREEINST 0x0200
-#define RPC_FC_PROC_PF_SAVEASYNC 0x0400
-#define RPC_FC_PROC_PF_SRVALLOCSIZE 0xe000 /* in 8 byte units */
-
-/* correlation types */
-#define RPC_FC_NORMAL_CONFORMANCE 0x00
-#define RPC_FC_POINTER_CONFORMANCE 0x10
-#define RPC_FC_TOP_LEVEL_CONFORMANCE 0x20
-#define RPC_FC_CONSTANT_CONFORMANCE 0x40
-#define RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE 0x80
-
-/* user marshal flags */
-#define USER_MARSHAL_UNIQUE 0x80
-#define USER_MARSHAL_REF 0x40
-#define USER_MARSHAL_POINTER 0xc0
-#define USER_MARSHAL_IID 0x20
-
-/* context handle flags */
-#define NDR_CONTEXT_HANDLE_CANNOT_BE_NULL 0x01
-#define NDR_CONTEXT_HANDLE_SERIALIZE 0x02
-#define NDR_CONTEXT_HANDLE_NO_SERIALIZE 0x04
-#define NDR_STRICT_CONTEXT_HANDLE 0x08
-
-#endif /* __WINE_RPCFC_H */
diff --git a/tools/widl/client.c b/tools/widl/client.c
index 739dba9..8b3b139 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -91,7 +91,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
if (handle_var)
{
- if (explicit_fc == RPC_FC_BIND_GENERIC)
+ if (explicit_fc == FC_BIND_GENERIC)
print_client("%s %s;\n",
get_explicit_generic_handle_type(handle_var)->name, handle_var->name );
print_client("RPC_BINDING_HANDLE _Handle;\n");
@@ -113,7 +113,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
- if (explicit_fc == RPC_FC_BIND_GENERIC)
+ if (explicit_fc == FC_BIND_GENERIC)
{
fprintf(client, "\n");
print_client("if (__frame->_Handle)\n");
@@ -144,7 +144,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if (handle_var)
{
print_client( "__frame->_Handle = 0;\n" );
- if (explicit_fc == RPC_FC_BIND_GENERIC)
+ if (explicit_fc == FC_BIND_GENERIC)
print_client("__frame->%s = %s;\n", handle_var->name, handle_var->name );
}
if (has_ret && decl_indirect(retval->type))
@@ -180,16 +180,16 @@ static void write_function_stub( const type_t *iface, const var_t *func,
switch (explicit_fc)
{
- case RPC_FC_BIND_PRIMITIVE:
+ case FC_BIND_PRIMITIVE:
print_client("__frame->_Handle = %s;\n", handle_var->name);
fprintf(client, "\n");
break;
- case RPC_FC_BIND_GENERIC:
+ case FC_BIND_GENERIC:
print_client("__frame->_Handle = %s_bind(%s);\n",
get_explicit_generic_handle_type(handle_var)->name, handle_var->name);
fprintf(client, "\n");
break;
- case RPC_FC_BIND_CONTEXT:
+ case FC_BIND_CONTEXT:
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must
diff --git a/tools/widl/expr.c b/tools/widl/expr.c
index cf97c7e..b461aee 100644
--- a/tools/widl/expr.c
+++ b/tools/widl/expr.c
@@ -519,11 +519,11 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
break;
case EXPR_STRLIT:
result.is_temporary = TRUE;
- result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL);
+ result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL);
break;
case EXPR_WSTRLIT:
result.is_temporary = TRUE;
- result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL);
+ result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL);
break;
case EXPR_CHARCONST:
result.is_temporary = TRUE;
@@ -573,7 +573,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
expr_loc->attr ? expr_loc->attr : "");
result.is_variable = FALSE;
result.is_temporary = TRUE;
- result.type = type_new_pointer(RPC_FC_UP, result.type, NULL);
+ result.type = type_new_pointer(FC_UP, result.type, NULL);
break;
case EXPR_PPTR:
result = resolve_expression(expr_loc, cont_type, e->ref);
diff --git a/tools/widl/header.c b/tools/widl/header.c
index 9f92127..e0c6d38 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -805,17 +805,17 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
if (!is_attr( var->attrs, ATTR_IN ) && is_attr( var->attrs, ATTR_OUT )) continue;
if (type_get_type( var->type ) == TYPE_BASIC && type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
{
- *explicit_fc = RPC_FC_BIND_PRIMITIVE;
+ *explicit_fc = FC_BIND_PRIMITIVE;
return var;
}
if (get_explicit_generic_handle_type( var ))
{
- *explicit_fc = RPC_FC_BIND_GENERIC;
+ *explicit_fc = FC_BIND_GENERIC;
return var;
}
if (is_context_handle( var->type ))
{
- *explicit_fc = RPC_FC_BIND_CONTEXT;
+ *explicit_fc = FC_BIND_CONTEXT;
return var;
}
}
@@ -824,13 +824,13 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
{
if (type_get_type( var->type ) == TYPE_BASIC &&
type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
- *implicit_fc = RPC_FC_BIND_PRIMITIVE;
+ *implicit_fc = FC_BIND_PRIMITIVE;
else
- *implicit_fc = RPC_FC_BIND_GENERIC;
+ *implicit_fc = FC_BIND_GENERIC;
return var;
}
- *implicit_fc = RPC_FC_AUTO_HANDLE;
+ *implicit_fc = FC_AUTO_HANDLE;
return NULL;
}
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index c262ca8..bf715c8 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -38,7 +38,7 @@
#include "expr.h"
#include "typetree.h"
-static unsigned char pointer_default = RPC_FC_UP;
+static unsigned char pointer_default = FC_UP;
typedef struct list typelist_t;
struct typenode {
@@ -1107,9 +1107,9 @@ threading_type:
;
pointer_type:
- tREF { $$ = RPC_FC_RP; }
- | tUNIQUE { $$ = RPC_FC_UP; }
- | tPTR { $$ = RPC_FC_FP; }
+ tREF { $$ = FC_RP; }
+ | tUNIQUE { $$ = FC_UP; }
+ | tPTR { $$ = FC_FP; }
;
structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
@@ -1501,12 +1501,12 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
}
if (is_ptr(ptr))
{
- if (ptr_attr && ptr_attr != RPC_FC_UP &&
+ if (ptr_attr && ptr_attr != FC_UP &&
type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE)
warning_loc_info(&v->loc_info,
"%s: pointer attribute applied to interface "
"pointer type has no effect\n", v->name);
- if (!ptr_attr && top && (*pt)->details.pointer.def_fc != RPC_FC_RP)
+ if (!ptr_attr && top && (*pt)->details.pointer.def_fc != FC_RP)
{
/* FIXME: this is a horrible hack to cope with the issue that we
* store an offset to the typeformat string in the type object, but
@@ -1531,9 +1531,9 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
t = type_pointer_get_ref(t);
if (type_get_type(t) != TYPE_BASIC &&
- (get_basic_fc(t) != RPC_FC_CHAR &&
- get_basic_fc(t) != RPC_FC_BYTE &&
- get_basic_fc(t) != RPC_FC_WCHAR))
+ (get_basic_fc(t) != FC_CHAR &&
+ get_basic_fc(t) != FC_BYTE &&
+ get_basic_fc(t) != FC_WCHAR))
{
error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
v->name);
@@ -1764,7 +1764,7 @@ static declarator_t *make_declarator(var_t *var)
static type_t *make_safearray(type_t *type)
{
return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0,
- NULL, NULL, RPC_FC_RP);
+ NULL, NULL, FC_RP);
}
static typelib_t *make_library(const char *name, const attr_list_t *attrs)
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index f4fe6f5..c56ef48 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -152,7 +152,7 @@ static void free_variable( const var_t *arg, const char *local_var_prefix )
break;
case TGT_STRUCT:
- if (get_struct_fc(type) != RPC_FC_STRUCT)
+ if (get_struct_fc(type) != FC_STRUCT)
print_proxy("/* FIXME: %s code for %s struct type 0x%x missing */\n", __FUNCTION__, arg->name, get_struct_fc(type) );
break;
diff --git a/tools/widl/server.c b/tools/widl/server.c
index 29b5bec..783ff90 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -104,7 +104,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
write_parameters_init(server, indent, func, "__frame->");
- if (explicit_fc == RPC_FC_BIND_PRIMITIVE)
+ if (explicit_fc == FC_BIND_PRIMITIVE)
{
print_server("__frame->%s = _pRpcMessage->Handle;\n", handle_var->name);
fprintf(server, "\n");
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 38cbfa0..da9ffd0 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -102,86 +102,86 @@ static const char *string_of_type(unsigned char type)
{
switch (type)
{
- case RPC_FC_BYTE: return "FC_BYTE";
- case RPC_FC_CHAR: return "FC_CHAR";
- case RPC_FC_SMALL: return "FC_SMALL";
- case RPC_FC_USMALL: return "FC_USMALL";
- case RPC_FC_WCHAR: return "FC_WCHAR";
- case RPC_FC_SHORT: return "FC_SHORT";
- case RPC_FC_USHORT: return "FC_USHORT";
- case RPC_FC_LONG: return "FC_LONG";
- case RPC_FC_ULONG: return "FC_ULONG";
- case RPC_FC_FLOAT: return "FC_FLOAT";
- case RPC_FC_HYPER: return "FC_HYPER";
- case RPC_FC_DOUBLE: return "FC_DOUBLE";
- case RPC_FC_ENUM16: return "FC_ENUM16";
- case RPC_FC_ENUM32: return "FC_ENUM32";
- case RPC_FC_IGNORE: return "FC_IGNORE";
- case RPC_FC_ERROR_STATUS_T: return "FC_ERROR_STATUS_T";
- case RPC_FC_RP: return "FC_RP";
- case RPC_FC_UP: return "FC_UP";
- case RPC_FC_OP: return "FC_OP";
- case RPC_FC_FP: return "FC_FP";
- case RPC_FC_ENCAPSULATED_UNION: return "FC_ENCAPSULATED_UNION";
- case RPC_FC_NON_ENCAPSULATED_UNION: return "FC_NON_ENCAPSULATED_UNION";
- case RPC_FC_STRUCT: return "FC_STRUCT";
- case RPC_FC_PSTRUCT: return "FC_PSTRUCT";
- case RPC_FC_CSTRUCT: return "FC_CSTRUCT";
- case RPC_FC_CPSTRUCT: return "FC_CPSTRUCT";
- case RPC_FC_CVSTRUCT: return "FC_CVSTRUCT";
- case RPC_FC_BOGUS_STRUCT: return "FC_BOGUS_STRUCT";
- case RPC_FC_SMFARRAY: return "FC_SMFARRAY";
- case RPC_FC_LGFARRAY: return "FC_LGFARRAY";
- case RPC_FC_SMVARRAY: return "FC_SMVARRAY";
- case RPC_FC_LGVARRAY: return "FC_LGVARRAY";
- case RPC_FC_CARRAY: return "FC_CARRAY";
- case RPC_FC_CVARRAY: return "FC_CVARRAY";
- case RPC_FC_BOGUS_ARRAY: return "FC_BOGUS_ARRAY";
- case RPC_FC_ALIGNM2: return "FC_ALIGNM2";
- case RPC_FC_ALIGNM4: return "FC_ALIGNM4";
- case RPC_FC_ALIGNM8: return "FC_ALIGNM8";
- case RPC_FC_POINTER: return "FC_POINTER";
- case RPC_FC_C_CSTRING: return "FC_C_CSTRING";
- case RPC_FC_C_WSTRING: return "FC_C_WSTRING";
- case RPC_FC_CSTRING: return "FC_CSTRING";
- case RPC_FC_WSTRING: return "FC_WSTRING";
- case RPC_FC_BYTE_COUNT_POINTER: return "FC_BYTE_COUNT_POINTER";
- case RPC_FC_TRANSMIT_AS: return "FC_TRANSMIT_AS";
- case RPC_FC_REPRESENT_AS: return "FC_REPRESENT_AS";
- case RPC_FC_IP: return "FC_IP";
- case RPC_FC_BIND_CONTEXT: return "FC_BIND_CONTEXT";
- case RPC_FC_BIND_GENERIC: return "FC_BIND_GENERIC";
- case RPC_FC_BIND_PRIMITIVE: return "FC_BIND_PRIMITIVE";
- case RPC_FC_AUTO_HANDLE: return "FC_AUTO_HANDLE";
- case RPC_FC_CALLBACK_HANDLE: return "FC_CALLBACK_HANDLE";
- case RPC_FC_STRUCTPAD1: return "FC_STRUCTPAD1";
- case RPC_FC_STRUCTPAD2: return "FC_STRUCTPAD2";
- case RPC_FC_STRUCTPAD3: return "FC_STRUCTPAD3";
- case RPC_FC_STRUCTPAD4: return "FC_STRUCTPAD4";
- case RPC_FC_STRUCTPAD5: return "FC_STRUCTPAD5";
- case RPC_FC_STRUCTPAD6: return "FC_STRUCTPAD6";
- case RPC_FC_STRUCTPAD7: return "FC_STRUCTPAD7";
- case RPC_FC_STRING_SIZED: return "FC_STRING_SIZED";
- case RPC_FC_NO_REPEAT: return "FC_NO_REPEAT";
- case RPC_FC_FIXED_REPEAT: return "FC_FIXED_REPEAT";
- case RPC_FC_VARIABLE_REPEAT: return "FC_VARIABLE_REPEAT";
- case RPC_FC_FIXED_OFFSET: return "FC_FIXED_OFFSET";
- case RPC_FC_VARIABLE_OFFSET: return "FC_VARIABLE_OFFSET";
- case RPC_FC_PP: return "FC_PP";
- case RPC_FC_EMBEDDED_COMPLEX: return "FC_EMBEDDED_COMPLEX";
- case RPC_FC_DEREFERENCE: return "FC_DEREFERENCE";
- case RPC_FC_DIV_2: return "FC_DIV_2";
- case RPC_FC_MULT_2: return "FC_MULT_2";
- case RPC_FC_ADD_1: return "FC_ADD_1";
- case RPC_FC_SUB_1: return "FC_SUB_1";
- case RPC_FC_CALLBACK: return "FC_CALLBACK";
- case RPC_FC_CONSTANT_IID: return "FC_CONSTANT_IID";
- case RPC_FC_END: return "FC_END";
- case RPC_FC_PAD: return "FC_PAD";
- case RPC_FC_USER_MARSHAL: return "FC_USER_MARSHAL";
- case RPC_FC_RANGE: return "FC_RANGE";
- case RPC_FC_INT3264: return "FC_INT3264";
- case RPC_FC_UINT3264: return "FC_UINT3264";
+ case FC_BYTE: return "FC_BYTE";
+ case FC_CHAR: return "FC_CHAR";
+ case FC_SMALL: return "FC_SMALL";
+ case FC_USMALL: return "FC_USMALL";
+ case FC_WCHAR: return "FC_WCHAR";
+ case FC_SHORT: return "FC_SHORT";
+ case FC_USHORT: return "FC_USHORT";
+ case FC_LONG: return "FC_LONG";
+ case FC_ULONG: return "FC_ULONG";
+ case FC_FLOAT: return "FC_FLOAT";
+ case FC_HYPER: return "FC_HYPER";
+ case FC_DOUBLE: return "FC_DOUBLE";
+ case FC_ENUM16: return "FC_ENUM16";
+ case FC_ENUM32: return "FC_ENUM32";
+ case FC_IGNORE: return "FC_IGNORE";
+ case FC_ERROR_STATUS_T: return "FC_ERROR_STATUS_T";
+ case FC_RP: return "FC_RP";
+ case FC_UP: return "FC_UP";
+ case FC_OP: return "FC_OP";
+ case FC_FP: return "FC_FP";
+ case FC_ENCAPSULATED_UNION: return "FC_ENCAPSULATED_UNION";
+ case FC_NON_ENCAPSULATED_UNION: return "FC_NON_ENCAPSULATED_UNION";
+ case FC_STRUCT: return "FC_STRUCT";
+ case FC_PSTRUCT: return "FC_PSTRUCT";
+ case FC_CSTRUCT: return "FC_CSTRUCT";
+ case FC_CPSTRUCT: return "FC_CPSTRUCT";
+ case FC_CVSTRUCT: return "FC_CVSTRUCT";
+ case FC_BOGUS_STRUCT: return "FC_BOGUS_STRUCT";
+ case FC_SMFARRAY: return "FC_SMFARRAY";
+ case FC_LGFARRAY: return "FC_LGFARRAY";
+ case FC_SMVARRAY: return "FC_SMVARRAY";
+ case FC_LGVARRAY: return "FC_LGVARRAY";
+ case FC_CARRAY: return "FC_CARRAY";
+ case FC_CVARRAY: return "FC_CVARRAY";
+ case FC_BOGUS_ARRAY: return "FC_BOGUS_ARRAY";
+ case FC_ALIGNM2: return "FC_ALIGNM2";
+ case FC_ALIGNM4: return "FC_ALIGNM4";
+ case FC_ALIGNM8: return "FC_ALIGNM8";
+ case FC_POINTER: return "FC_POINTER";
+ case FC_C_CSTRING: return "FC_C_CSTRING";
+ case FC_C_WSTRING: return "FC_C_WSTRING";
+ case FC_CSTRING: return "FC_CSTRING";
+ case FC_WSTRING: return "FC_WSTRING";
+ case FC_BYTE_COUNT_POINTER: return "FC_BYTE_COUNT_POINTER";
+ case FC_TRANSMIT_AS: return "FC_TRANSMIT_AS";
+ case FC_REPRESENT_AS: return "FC_REPRESENT_AS";
+ case FC_IP: return "FC_IP";
+ case FC_BIND_CONTEXT: return "FC_BIND_CONTEXT";
+ case FC_BIND_GENERIC: return "FC_BIND_GENERIC";
+ case FC_BIND_PRIMITIVE: return "FC_BIND_PRIMITIVE";
+ case FC_AUTO_HANDLE: return "FC_AUTO_HANDLE";
+ case FC_CALLBACK_HANDLE: return "FC_CALLBACK_HANDLE";
+ case FC_STRUCTPAD1: return "FC_STRUCTPAD1";
+ case FC_STRUCTPAD2: return "FC_STRUCTPAD2";
+ case FC_STRUCTPAD3: return "FC_STRUCTPAD3";
+ case FC_STRUCTPAD4: return "FC_STRUCTPAD4";
+ case FC_STRUCTPAD5: return "FC_STRUCTPAD5";
+ case FC_STRUCTPAD6: return "FC_STRUCTPAD6";
+ case FC_STRUCTPAD7: return "FC_STRUCTPAD7";
+ case FC_STRING_SIZED: return "FC_STRING_SIZED";
+ case FC_NO_REPEAT: return "FC_NO_REPEAT";
+ case FC_FIXED_REPEAT: return "FC_FIXED_REPEAT";
+ case FC_VARIABLE_REPEAT: return "FC_VARIABLE_REPEAT";
+ case FC_FIXED_OFFSET: return "FC_FIXED_OFFSET";
+ case FC_VARIABLE_OFFSET: return "FC_VARIABLE_OFFSET";
+ case FC_PP: return "FC_PP";
+ case FC_EMBEDDED_COMPLEX: return "FC_EMBEDDED_COMPLEX";
+ case FC_DEREFERENCE: return "FC_DEREFERENCE";
+ case FC_DIV_2: return "FC_DIV_2";
+ case FC_MULT_2: return "FC_MULT_2";
+ case FC_ADD_1: return "FC_ADD_1";
+ case FC_SUB_1: return "FC_SUB_1";
+ case FC_CALLBACK: return "FC_CALLBACK";
+ case FC_CONSTANT_IID: return "FC_CONSTANT_IID";
+ case FC_END: return "FC_END";
+ case FC_PAD: return "FC_PAD";
+ case FC_USER_MARSHAL: return "FC_USER_MARSHAL";
+ case FC_RANGE: return "FC_RANGE";
+ case FC_INT3264: return "FC_INT3264";
+ case FC_UINT3264: return "FC_UINT3264";
default:
error("string_of_type: unknown type 0x%02x\n", type);
return NULL;
@@ -206,20 +206,20 @@ unsigned char get_basic_fc(const type_t *type)
int sign = type_basic_get_sign(type);
switch (type_basic_get_type(type))
{
- case TYPE_BASIC_INT8: return (sign <= 0 ? RPC_FC_SMALL : RPC_FC_USMALL);
- case TYPE_BASIC_INT16: return (sign <= 0 ? RPC_FC_SHORT : RPC_FC_USHORT);
- case TYPE_BASIC_INT32: return (sign <= 0 ? RPC_FC_LONG : RPC_FC_ULONG);
- case TYPE_BASIC_INT64: return RPC_FC_HYPER;
- case TYPE_BASIC_INT: return (sign <= 0 ? RPC_FC_LONG : RPC_FC_ULONG);
- case TYPE_BASIC_INT3264: return (sign <= 0 ? RPC_FC_INT3264 : RPC_FC_UINT3264);
- case TYPE_BASIC_BYTE: return RPC_FC_BYTE;
- case TYPE_BASIC_CHAR: return RPC_FC_CHAR;
- case TYPE_BASIC_WCHAR: return RPC_FC_WCHAR;
- case TYPE_BASIC_HYPER: return RPC_FC_HYPER;
- case TYPE_BASIC_FLOAT: return RPC_FC_FLOAT;
- case TYPE_BASIC_DOUBLE: return RPC_FC_DOUBLE;
- case TYPE_BASIC_ERROR_STATUS_T: return RPC_FC_ERROR_STATUS_T;
- case TYPE_BASIC_HANDLE: return RPC_FC_BIND_PRIMITIVE;
+ case TYPE_BASIC_INT8: return (sign <= 0 ? FC_SMALL : FC_USMALL);
+ case TYPE_BASIC_INT16: return (sign <= 0 ? FC_SHORT : FC_USHORT);
+ case TYPE_BASIC_INT32: return (sign <= 0 ? FC_LONG : FC_ULONG);
+ case TYPE_BASIC_INT64: return FC_HYPER;
+ case TYPE_BASIC_INT: return (sign <= 0 ? FC_LONG : FC_ULONG);
+ case TYPE_BASIC_INT3264: return (sign <= 0 ? FC_INT3264 : FC_UINT3264);
+ case TYPE_BASIC_BYTE: return FC_BYTE;
+ case TYPE_BASIC_CHAR: return FC_CHAR;
+ case TYPE_BASIC_WCHAR: return FC_WCHAR;
+ case TYPE_BASIC_HYPER: return FC_HYPER;
+ case TYPE_BASIC_FLOAT: return FC_FLOAT;
+ case TYPE_BASIC_DOUBLE: return FC_DOUBLE;
+ case TYPE_BASIC_ERROR_STATUS_T: return FC_ERROR_STATUS_T;
+ case TYPE_BASIC_HANDLE: return FC_BIND_PRIMITIVE;
}
return 0;
}
@@ -228,20 +228,20 @@ static unsigned char get_basic_fc_signed(const type_t *type)
{
switch (type_basic_get_type(type))
{
- case TYPE_BASIC_INT8: return RPC_FC_SMALL;
- case TYPE_BASIC_INT16: return RPC_FC_SHORT;
- case TYPE_BASIC_INT32: return RPC_FC_LONG;
- case TYPE_BASIC_INT64: return RPC_FC_HYPER;
- case TYPE_BASIC_INT: return RPC_FC_LONG;
- case TYPE_BASIC_INT3264: return RPC_FC_INT3264;
- case TYPE_BASIC_BYTE: return RPC_FC_BYTE;
- case TYPE_BASIC_CHAR: return RPC_FC_CHAR;
- case TYPE_BASIC_WCHAR: return RPC_FC_WCHAR;
- case TYPE_BASIC_HYPER: return RPC_FC_HYPER;
- case TYPE_BASIC_FLOAT: return RPC_FC_FLOAT;
- case TYPE_BASIC_DOUBLE: return RPC_FC_DOUBLE;
- case TYPE_BASIC_ERROR_STATUS_T: return RPC_FC_ERROR_STATUS_T;
- case TYPE_BASIC_HANDLE: return RPC_FC_BIND_PRIMITIVE;
+ case TYPE_BASIC_INT8: return FC_SMALL;
+ case TYPE_BASIC_INT16: return FC_SHORT;
+ case TYPE_BASIC_INT32: return FC_LONG;
+ case TYPE_BASIC_INT64: return FC_HYPER;
+ case TYPE_BASIC_INT: return FC_LONG;
+ case TYPE_BASIC_INT3264: return FC_INT3264;
+ case TYPE_BASIC_BYTE: return FC_BYTE;
+ case TYPE_BASIC_CHAR: return FC_CHAR;
+ case TYPE_BASIC_WCHAR: return FC_WCHAR;
+ case TYPE_BASIC_HYPER: return FC_HYPER;
+ case TYPE_BASIC_FLOAT: return FC_FLOAT;
+ case TYPE_BASIC_DOUBLE: return FC_DOUBLE;
+ case TYPE_BASIC_ERROR_STATUS_T: return FC_ERROR_STATUS_T;
+ case TYPE_BASIC_HANDLE: return FC_BIND_PRIMITIVE;
}
return 0;
}
@@ -272,7 +272,7 @@ unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int t
}
if (toplevel_param)
- return RPC_FC_RP;
+ return FC_RP;
else if (is_ptr(type))
return type_pointer_get_default_fc(type);
else
@@ -284,9 +284,9 @@ static unsigned char get_pointer_fc_context( const type_t *type, const attr_list
{
int pointer_fc = get_pointer_fc(type, attrs, context == TYPE_CONTEXT_TOPLEVELPARAM);
- if (pointer_fc == RPC_FC_UP && is_attr( attrs, ATTR_OUT ) &&
+ if (pointer_fc == FC_UP && is_attr( attrs, ATTR_OUT ) &&
context == TYPE_CONTEXT_PARAM && is_object( current_iface ))
- pointer_fc = RPC_FC_OP;
+ pointer_fc = FC_OP;
return pointer_fc;
}
@@ -295,9 +295,9 @@ static unsigned char get_enum_fc(const type_t *type)
{
assert(type_get_type(type) == TYPE_ENUM);
if (is_aliaschain_attr(type, ATTR_V1ENUM))
- return RPC_FC_ENUM32;
+ return FC_ENUM32;
else
- return RPC_FC_ENUM16;
+ return FC_ENUM16;
}
static type_t *get_user_type(const type_t *t, const char **pname)
@@ -382,7 +382,7 @@ static int cant_be_null(const var_t *v)
if (!type_array_is_decl_as_ptr( v->type )) return 0;
/* fall through */
case TGT_POINTER:
- return (get_pointer_fc(v->type, v->attrs, TRUE) == RPC_FC_RP);
+ return (get_pointer_fc(v->type, v->attrs, TRUE) == FC_RP);
case TGT_CTXT_HANDLE_POINTER:
return TRUE;
default:
@@ -484,7 +484,7 @@ unsigned char get_struct_fc(const type_t *type)
fields = type_struct_get_fields(type);
if (get_padding(fields))
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry )
{
@@ -504,7 +504,7 @@ unsigned char get_struct_fc(const type_t *type)
}
if (is_array(type_array_get_element(field->type)))
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
if (type_array_has_conformance(field->type))
{
@@ -524,37 +524,37 @@ unsigned char get_struct_fc(const type_t *type)
{
case TGT_USER_TYPE:
case TGT_IFACE_POINTER:
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
case TGT_BASIC:
if (type_basic_get_type(t) == TYPE_BASIC_INT3264 && pointer_size != 4)
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
break;
case TGT_ENUM:
- if (get_enum_fc(t) == RPC_FC_ENUM16)
- return RPC_FC_BOGUS_STRUCT;
+ if (get_enum_fc(t) == FC_ENUM16)
+ return FC_BOGUS_STRUCT;
break;
case TGT_POINTER:
case TGT_ARRAY:
- if (get_pointer_fc(t, field->attrs, FALSE) == RPC_FC_RP || pointer_size != 4)
- return RPC_FC_BOGUS_STRUCT;
+ if (get_pointer_fc(t, field->attrs, FALSE) == FC_RP || pointer_size != 4)
+ return FC_BOGUS_STRUCT;
has_pointer = 1;
break;
case TGT_UNION:
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
case TGT_STRUCT:
{
unsigned char fc = get_struct_fc(t);
switch (fc)
{
- case RPC_FC_STRUCT:
+ case FC_STRUCT:
break;
- case RPC_FC_CVSTRUCT:
+ case FC_CVSTRUCT:
has_conformance = 1;
has_variance = 1;
has_pointer = 1;
break;
- case RPC_FC_CPSTRUCT:
+ case FC_CPSTRUCT:
has_conformance = 1;
if (list_next( fields, &field->entry ))
error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
@@ -562,14 +562,14 @@ unsigned char get_struct_fc(const type_t *type)
has_pointer = 1;
break;
- case RPC_FC_CSTRUCT:
+ case FC_CSTRUCT:
has_conformance = 1;
if (list_next( fields, &field->entry ))
error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n",
field->name);
break;
- case RPC_FC_PSTRUCT:
+ case FC_PSTRUCT:
has_pointer = 1;
break;
@@ -578,13 +578,13 @@ unsigned char get_struct_fc(const type_t *type)
/* fallthru - treat it as complex */
/* as soon as we see one of these these members, it's bogus... */
- case RPC_FC_BOGUS_STRUCT:
- return RPC_FC_BOGUS_STRUCT;
+ case FC_BOGUS_STRUCT:
+ return FC_BOGUS_STRUCT;
}
break;
}
case TGT_RANGE:
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
case TGT_STRING:
/* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */
case TGT_INVALID:
@@ -599,17 +599,17 @@ unsigned char get_struct_fc(const type_t *type)
if( has_variance )
{
if ( has_conformance )
- return RPC_FC_CVSTRUCT;
+ return FC_CVSTRUCT;
else
- return RPC_FC_BOGUS_STRUCT;
+ return FC_BOGUS_STRUCT;
}
if( has_conformance && has_pointer )
- return RPC_FC_CPSTRUCT;
+ return FC_CPSTRUCT;
if( has_conformance )
- return RPC_FC_CSTRUCT;
+ return FC_CSTRUCT;
if( has_pointer )
- return RPC_FC_PSTRUCT;
- return RPC_FC_STRUCT;
+ return FC_PSTRUCT;
+ return FC_STRUCT;
}
static unsigned char get_array_fc(const type_t *type)
@@ -625,60 +625,60 @@ static unsigned char get_array_fc(const type_t *type)
{
unsigned int size = type_memsize(elem_type);
if (size * type_array_get_dim(type) > 0xffffuL)
- fc = RPC_FC_LGFARRAY;
+ fc = FC_LGFARRAY;
else
- fc = RPC_FC_SMFARRAY;
+ fc = FC_SMFARRAY;
}
else
- fc = RPC_FC_CARRAY;
+ fc = FC_CARRAY;
if (type_array_has_variance(type))
{
- if (fc == RPC_FC_SMFARRAY)
- fc = RPC_FC_SMVARRAY;
- else if (fc == RPC_FC_LGFARRAY)
- fc = RPC_FC_LGVARRAY;
- else if (fc == RPC_FC_CARRAY)
- fc = RPC_FC_CVARRAY;
+ if (fc == FC_SMFARRAY)
+ fc = FC_SMVARRAY;
+ else if (fc == FC_LGFARRAY)
+ fc = FC_LGVARRAY;
+ else if (fc == FC_CARRAY)
+ fc = FC_CVARRAY;
}
switch (typegen_detect_type(elem_type, NULL, TDT_IGNORE_STRINGS))
{
case TGT_USER_TYPE:
- fc = RPC_FC_BOGUS_ARRAY;
+ fc = FC_BOGUS_ARRAY;
break;
case TGT_BASIC:
if (type_basic_get_type(elem_type) == TYPE_BASIC_INT3264 &&
pointer_size != 4)
- fc = RPC_FC_BOGUS_ARRAY;
+ fc = FC_BOGUS_ARRAY;
break;
case TGT_STRUCT:
switch (get_struct_fc(elem_type))
{
- case RPC_FC_BOGUS_STRUCT:
- fc = RPC_FC_BOGUS_ARRAY;
+ case FC_BOGUS_STRUCT:
+ fc = FC_BOGUS_ARRAY;
break;
}
break;
case TGT_ENUM:
/* is 16-bit enum - if so, wire size differs from mem size and so
* the array cannot be block copied, which means the array is complex */
- if (get_enum_fc(elem_type) == RPC_FC_ENUM16)
- fc = RPC_FC_BOGUS_ARRAY;
+ if (get_enum_fc(elem_type) == FC_ENUM16)
+ fc = FC_BOGUS_ARRAY;
break;
case TGT_UNION:
case TGT_IFACE_POINTER:
- fc = RPC_FC_BOGUS_ARRAY;
+ fc = FC_BOGUS_ARRAY;
break;
case TGT_POINTER:
/* ref pointers cannot just be block copied. unique pointers to
* interfaces need special treatment. either case means the array is
* complex */
- if (get_pointer_fc(elem_type, NULL, FALSE) == RPC_FC_RP || pointer_size != 4)
- fc = RPC_FC_BOGUS_ARRAY;
+ if (get_pointer_fc(elem_type, NULL, FALSE) == FC_RP || pointer_size != 4)
+ fc = FC_BOGUS_ARRAY;
break;
case TGT_RANGE:
- fc = RPC_FC_BOGUS_ARRAY;
+ fc = FC_BOGUS_ARRAY;
break;
case TGT_CTXT_HANDLE:
case TGT_CTXT_HANDLE_POINTER:
@@ -695,7 +695,7 @@ static unsigned char get_array_fc(const type_t *type)
static int is_non_complex_struct(const type_t *type)
{
return (type_get_type(type) == TYPE_STRUCT &&
- get_struct_fc(type) != RPC_FC_BOGUS_STRUCT);
+ get_struct_fc(type) != FC_BOGUS_STRUCT);
}
static int type_has_pointers(const type_t *type)
@@ -753,12 +753,12 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
case TGT_USER_TYPE:
return FALSE;
case TGT_POINTER:
- if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_FP)
+ if (get_pointer_fc(type, attrs, toplevel_param) == FC_FP)
return TRUE;
else
return FALSE;
case TGT_ARRAY:
- if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_FP)
+ if (get_pointer_fc(type, attrs, toplevel_param) == FC_FP)
return TRUE;
else
return type_has_full_pointer(type_array_get_element(type), NULL, FALSE);
@@ -861,7 +861,7 @@ static const char *get_context_handle_type_name(const type_t *type)
do { \
if (file) \
fprintf(file, "/* %2u */\n", typestring_offset); \
- print_file((file), 2, "0x%02x,\t/* " #fctype " */\n", RPC_##fctype); \
+ print_file((file), 2, "0x%02x,\t/* " #fctype " */\n", fctype); \
} \
while (0)
@@ -981,10 +981,10 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
case TGT_BASIC:
*flags |= IsBasetype;
fc = get_basic_fc_signed( var->type );
- if (fc == RPC_FC_BIND_PRIMITIVE)
+ if (fc == FC_BIND_PRIMITIVE)
{
buffer_size = 4; /* actually 0 but avoids setting MustSize */
- fc = RPC_FC_LONG;
+ fc = FC_LONG;
}
break;
case TGT_ENUM:
@@ -1005,7 +1005,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
case TGT_ARRAY:
*flags |= MustFree;
if (type_array_is_decl_as_ptr(var->type) && var->type->details.array.ptr_tfsoff &&
- get_pointer_fc( var->type, var->attrs, !is_return ) == RPC_FC_RP)
+ get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
{
*typestring_offset = var->type->typestring_offset;
*flags |= IsSimpleRef;
@@ -1013,7 +1013,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
break;
case TGT_STRING:
*flags |= MustFree;
- if (is_declptr( var->type ) && get_pointer_fc( var->type, var->attrs, !is_return ) == RPC_FC_RP)
+ if (is_declptr( var->type ) && get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
{
/* skip over pointer description straight to string description */
if (is_conformant_array( var->type )) *typestring_offset += 4;
@@ -1029,7 +1029,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
buffer_size = 20;
break;
case TGT_POINTER:
- if (get_pointer_fc( var->type, var->attrs, !is_return ) == RPC_FC_RP)
+ if (get_pointer_fc( var->type, var->attrs, !is_return ) == FC_RP)
{
const type_t *ref = type_pointer_get_ref( var->type );
@@ -1044,7 +1044,7 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
if (!is_in && is_out) server_size = pointer_size;
break;
case TGT_ENUM:
- if ((fc = get_enum_fc( ref )) == RPC_FC_ENUM32)
+ if ((fc = get_enum_fc( ref )) == FC_ENUM32)
{
*flags |= IsSimpleRef | IsBasetype;
if (!is_in && is_out) server_size = pointer_size;
@@ -1078,9 +1078,9 @@ static unsigned char get_parameter_fc( const var_t *var, int is_return, unsigned
*typestring_offset = ref->typestring_offset;
switch (get_struct_fc(ref))
{
- case RPC_FC_STRUCT:
- case RPC_FC_PSTRUCT:
- case RPC_FC_BOGUS_STRUCT:
+ case FC_STRUCT:
+ case FC_PSTRUCT:
+ case FC_BOGUS_STRUCT:
if (!is_in && is_out) server_size = type_memsize( ref );
break;
default:
@@ -1201,8 +1201,8 @@ static unsigned int write_old_procformatstring_type(FILE *file, int indent, cons
{
fc = get_basic_fc_signed(var->type);
- if (fc == RPC_FC_BIND_PRIMITIVE)
- fc = RPC_FC_IGNORE;
+ if (fc == FC_BIND_PRIMITIVE)
+ fc = FC_IGNORE;
}
print_file(file, indent, "0x%02x, /* %s */\n",
@@ -1294,7 +1294,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
unsigned char explicit_fc, implicit_fc;
unsigned char handle_flags;
const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
- unsigned char oi_flags = RPC_FC_PROC_OIF_RPCFLAGS | RPC_FC_PROC_OIF_NEWINIT;
+ unsigned char oi_flags = Oi_HAS_RPCFLAGS | Oi_USE_NEW_INIT_ROUTINES;
unsigned int rpc_flags = get_rpc_flags( func->attrs );
unsigned int nb_args = 0;
unsigned int stack_size = 0;
@@ -1302,11 +1302,11 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
unsigned short handle_stack_offset = 0;
unsigned short handle_param_num = 0;
- if (is_full_pointer_function( func )) oi_flags |= RPC_FC_PROC_OIF_FULLPTR;
+ if (is_full_pointer_function( func )) oi_flags |= Oi_FULL_PTR_USED;
if (is_object( iface ))
{
- oi_flags |= RPC_FC_PROC_OIF_OBJECT;
- if (get_stub_mode() == MODE_Oif) oi_flags |= RPC_FC_PROC_OIF_OBJ_V2;
+ oi_flags |= Oi_OBJECT_PROC;
+ if (get_stub_mode() == MODE_Oif) oi_flags |= Oi_OBJ_USE_V2_INTERPRETER;
stack_size += pointer_size;
}
@@ -1340,7 +1340,7 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
{
switch (explicit_fc)
{
- case RPC_FC_BIND_PRIMITIVE:
+ case FC_BIND_PRIMITIVE:
handle_flags = 0;
print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
print_file( file, indent, "0x%02x,\n", handle_flags );
@@ -1348,17 +1348,17 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
handle_stack_offset, handle_stack_offset );
*offset += 4;
break;
- case RPC_FC_BIND_GENERIC:
+ case FC_BIND_GENERIC:
handle_flags = type_memsize( handle_var->type );
print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
print_file( file, indent, "0x%02x,\n", handle_flags );
print_file( file, indent, "NdrFcShort(0x%hx),\t/* stack offset = %hu */\n",
handle_stack_offset, handle_stack_offset );
print_file( file, indent, "0x%02x,\n", get_generic_handle_offset( handle_var->type ) );
- print_file( file, indent, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
+ print_file( file, indent, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*offset += 6;
break;
- case RPC_FC_BIND_CONTEXT:
+ case FC_BIND_CONTEXT:
handle_flags = get_contexthandle_flags( iface, handle_var->attrs, handle_var->type );
print_file( file, indent, "0x%02x,\t/* %s */\n", explicit_fc, string_of_type(explicit_fc) );
print_file( file, indent, "0x%02x,\n", handle_flags );
@@ -1550,7 +1550,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
const expr_t *expr)
{
unsigned char operator_type = 0;
- unsigned char conftype = RPC_FC_NORMAL_CONFORMANCE;
+ unsigned char conftype = FC_NORMAL_CONFORMANCE;
const char *conftype_string = "field";
const expr_t *subexpr;
const type_t *iface = NULL;
@@ -1570,7 +1570,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
UCHAR_MAX * (USHRT_MAX + 1) + USHRT_MAX);
print_file(file, 2, "0x%x, /* Corr desc: constant, val = %d */\n",
- RPC_FC_CONSTANT_CONFORMANCE, expr->cval);
+ FC_CONSTANT_CONFORMANCE, expr->cval);
print_file(file, 2, "0x%x,\n", expr->cval >> 16);
print_file(file, 2, "NdrFcShort(0x%hx),\n", (unsigned short)expr->cval);
@@ -1579,7 +1579,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
if (!cont_type) /* top-level conformance */
{
- conftype = RPC_FC_TOP_LEVEL_CONFORMANCE;
+ conftype = FC_TOP_LEVEL_CONFORMANCE;
conftype_string = "parameter";
cont_type = current_func->type;
name = current_func->name;
@@ -1590,7 +1590,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
name = cont_type->name;
if (is_ptr(type) || (is_array(type) && type_array_is_decl_as_ptr(type)))
{
- conftype = RPC_FC_POINTER_CONFORMANCE;
+ conftype = FC_POINTER_CONFORMANCE;
conftype_string = "field pointer";
}
}
@@ -1600,34 +1600,34 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
{
case EXPR_PPTR:
subexpr = subexpr->ref;
- operator_type = RPC_FC_DEREFERENCE;
+ operator_type = FC_DEREFERENCE;
break;
case EXPR_DIV:
if (subexpr->u.ext->is_const && (subexpr->u.ext->cval == 2))
{
subexpr = subexpr->ref;
- operator_type = RPC_FC_DIV_2;
+ operator_type = FC_DIV_2;
}
break;
case EXPR_MUL:
if (subexpr->u.ext->is_const && (subexpr->u.ext->cval == 2))
{
subexpr = subexpr->ref;
- operator_type = RPC_FC_MULT_2;
+ operator_type = FC_MULT_2;
}
break;
case EXPR_SUB:
if (subexpr->u.ext->is_const && (subexpr->u.ext->cval == 1))
{
subexpr = subexpr->ref;
- operator_type = RPC_FC_SUB_1;
+ operator_type = FC_SUB_1;
}
break;
case EXPR_ADD:
if (subexpr->u.ext->is_const && (subexpr->u.ext->cval == 1))
{
subexpr = subexpr->ref;
- operator_type = RPC_FC_ADD_1;
+ operator_type = FC_ADD_1;
}
break;
default:
@@ -1686,26 +1686,26 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
{
switch (get_basic_fc(correlation_variable))
{
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- param_type = RPC_FC_SMALL;
+ case FC_CHAR:
+ case FC_SMALL:
+ param_type = FC_SMALL;
break;
- case RPC_FC_BYTE:
- case RPC_FC_USMALL:
- param_type = RPC_FC_USMALL;
+ case FC_BYTE:
+ case FC_USMALL:
+ param_type = FC_USMALL;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- param_type = RPC_FC_SHORT;
+ case FC_WCHAR:
+ case FC_SHORT:
+ param_type = FC_SHORT;
break;
- case RPC_FC_USHORT:
- param_type = RPC_FC_USHORT;
+ case FC_USHORT:
+ param_type = FC_USHORT;
break;
- case RPC_FC_LONG:
- param_type = RPC_FC_LONG;
+ case FC_LONG:
+ param_type = FC_LONG;
break;
- case RPC_FC_ULONG:
- param_type = RPC_FC_ULONG;
+ case FC_ULONG:
+ param_type = FC_ULONG;
break;
default:
error("write_conf_or_var_desc: conformance variable type not supported 0x%x\n",
@@ -1714,17 +1714,17 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
}
else if (type_get_type(correlation_variable) == TYPE_ENUM)
{
- if (get_enum_fc(correlation_variable) == RPC_FC_ENUM32)
- param_type = RPC_FC_LONG;
+ if (get_enum_fc(correlation_variable) == FC_ENUM32)
+ param_type = FC_LONG;
else
- param_type = RPC_FC_SHORT;
+ param_type = FC_SHORT;
}
else if (type_get_type(correlation_variable) == TYPE_POINTER)
{
if (pointer_size == 8)
- param_type = RPC_FC_HYPER;
+ param_type = FC_HYPER;
else
- param_type = RPC_FC_LONG;
+ param_type = FC_LONG;
}
else
{
@@ -1775,7 +1775,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
error("Maximum number of callback routines reached\n");
print_file(file, 2, "0x%x,\t/* Corr desc: %s in %s */\n", conftype, conftype_string, name);
- print_file(file, 2, "0x%x,\t/* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK");
+ print_file(file, 2, "0x%x,\t/* %s */\n", FC_CALLBACK, "FC_CALLBACK");
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)callback_offset, callback_offset);
}
else /* output a dummy corr desc that isn't used */
@@ -1849,34 +1849,34 @@ unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
case TYPE_BASIC:
switch (get_basic_fc(t))
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_USMALL:
- case RPC_FC_SMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_USMALL:
+ case FC_SMALL:
size = 1;
if (size > *align) *align = size;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_USHORT:
- case RPC_FC_SHORT:
+ case FC_WCHAR:
+ case FC_USHORT:
+ case FC_SHORT:
size = 2;
if (size > *align) *align = size;
break;
- case RPC_FC_ULONG:
- case RPC_FC_LONG:
- case RPC_FC_ERROR_STATUS_T:
- case RPC_FC_FLOAT:
+ case FC_ULONG:
+ case FC_LONG:
+ case FC_ERROR_STATUS_T:
+ case FC_FLOAT:
size = 4;
if (size > *align) *align = size;
break;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
size = 8;
if (size > *align) *align = size;
break;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
- case RPC_FC_BIND_PRIMITIVE:
+ case FC_INT3264:
+ case FC_UINT3264:
+ case FC_BIND_PRIMITIVE:
assert( pointer_size );
size = pointer_size;
if (size > *align) *align = size;
@@ -1889,8 +1889,8 @@ unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
case TYPE_ENUM:
switch (get_enum_fc(t))
{
- case RPC_FC_ENUM16:
- case RPC_FC_ENUM32:
+ case FC_ENUM16:
+ case FC_ENUM32:
size = 4;
if (size > *align) *align = size;
break;
@@ -1966,24 +1966,24 @@ static unsigned int type_buffer_alignment(const type_t *t)
case TYPE_BASIC:
switch (get_basic_fc(t))
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_USMALL:
- case RPC_FC_SMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_USMALL:
+ case FC_SMALL:
return 1;
- case RPC_FC_WCHAR:
- case RPC_FC_USHORT:
- case RPC_FC_SHORT:
+ case FC_WCHAR:
+ case FC_USHORT:
+ case FC_SHORT:
return 2;
- case RPC_FC_ULONG:
- case RPC_FC_LONG:
- case RPC_FC_ERROR_STATUS_T:
- case RPC_FC_FLOAT:
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_ULONG:
+ case FC_LONG:
+ case FC_ERROR_STATUS_T:
+ case FC_FLOAT:
+ case FC_INT3264:
+ case FC_UINT3264:
return 4;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
return 8;
default:
error("type_buffer_alignment: Unknown type 0x%x\n", get_basic_fc(t));
@@ -1992,9 +1992,9 @@ static unsigned int type_buffer_alignment(const type_t *t)
case TYPE_ENUM:
switch (get_enum_fc(t))
{
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
return 2;
- case RPC_FC_ENUM32:
+ case FC_ENUM32:
return 4;
default:
error("type_buffer_alignment: Unknown enum type\n");
@@ -2093,14 +2093,14 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
out_attr = is_attr(attrs, ATTR_OUT);
if (!in_attr && !out_attr) in_attr = 1;
- if (out_attr && !in_attr && pointer_type == RPC_FC_RP)
- flags |= RPC_FC_P_ONSTACK;
+ if (out_attr && !in_attr && pointer_type == FC_RP)
+ flags |= FC_ALLOCED_ON_STACK;
if (is_ptr(type))
{
type_t *ref = type_pointer_get_ref(type);
if(is_declptr(ref) && !is_user_type(ref))
- flags |= RPC_FC_P_DEREF;
+ flags |= FC_POINTER_DEREF;
}
print_file(file, 2, "0x%x, 0x%x,\t\t/* %s",
@@ -2109,9 +2109,9 @@ static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs
string_of_type(pointer_type));
if (file)
{
- if (flags & RPC_FC_P_ONSTACK)
+ if (flags & FC_ALLOCED_ON_STACK)
fprintf(file, " [allocated_on_stack]");
- if (flags & RPC_FC_P_DEREF)
+ if (flags & FC_POINTER_DEREF)
fprintf(file, " [pointer_deref]");
fprintf(file, " */\n");
}
@@ -2130,7 +2130,7 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
const type_t *ref;
int in_attr = is_attr(attrs, ATTR_IN);
int out_attr = is_attr(attrs, ATTR_OUT);
- unsigned char flags = RPC_FC_P_SIMPLEPOINTER;
+ unsigned char flags = FC_SIMPLE_POINTER;
/* for historical reasons, write_simple_pointer also handled string types,
* but no longer does. catch bad uses of the function with this check */
@@ -2146,11 +2146,11 @@ static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs,
fc = get_basic_fc(ref);
if (out_attr && !in_attr)
- flags |= RPC_FC_P_ONSTACK;
+ flags |= FC_ALLOCED_ON_STACK;
print_file(file, 2, "0x%02x, 0x%x,\t/* %s %s[simple_pointer] */\n",
pointer_fc, flags, string_of_type(pointer_fc),
- flags & RPC_FC_P_ONSTACK ? "[allocated_on_stack] " : "");
+ flags & FC_ALLOCED_ON_STACK ? "[allocated_on_stack] " : "");
print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc));
print_file(file, 2, "0x5c,\t/* FC_PAD */\n");
return 4;
@@ -2202,10 +2202,10 @@ static int user_type_has_variable_size(const type_t *t)
{
switch (get_struct_fc(t))
{
- case RPC_FC_PSTRUCT:
- case RPC_FC_CSTRUCT:
- case RPC_FC_CPSTRUCT:
- case RPC_FC_CVSTRUCT:
+ case FC_PSTRUCT:
+ case FC_CSTRUCT:
+ case FC_CPSTRUCT:
+ case FC_CVSTRUCT:
return TRUE;
}
}
@@ -2254,9 +2254,9 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof
absoff = utype->typestring_offset;
}
- if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == RPC_FC_RP)
+ if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == FC_RP)
flags = 0x40;
- else if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == RPC_FC_UP)
+ else if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == FC_UP)
flags = 0x80;
else
flags = 0;
@@ -2264,7 +2264,7 @@ static unsigned int write_user_tfs(FILE *file, type_t *type, unsigned int *tfsof
start = *tfsoff;
update_tfsoff(type, start, file);
print_start_tfs_comment(file, type, start);
- print_file(file, 2, "0x%x,\t/* FC_USER_MARSHAL */\n", RPC_FC_USER_MARSHAL);
+ print_file(file, 2, "0x%x,\t/* FC_USER_MARSHAL */\n", FC_USER_MARSHAL);
print_file(file, 2, "0x%x,\t/* Alignment= %d, Flags= %02x */\n",
flags | (ualign - 1), ualign - 1, flags);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Function offset= %hu */\n", funoff, funoff);
@@ -2309,7 +2309,7 @@ static void write_member_type(FILE *file, const type_t *cont,
}
else if (is_ptr(type) || is_conformant_array(type))
{
- unsigned char fc = cont_is_complex ? RPC_FC_POINTER : RPC_FC_LONG;
+ unsigned char fc = cont_is_complex ? FC_POINTER : FC_LONG;
print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
*tfsoff += 1;
}
@@ -2351,10 +2351,10 @@ static void write_end(FILE *file, unsigned int *tfsoff)
{
if (*tfsoff % 2 == 0)
{
- print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*tfsoff += 1;
}
- print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END);
+ print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END);
*tfsoff += 1;
}
@@ -2376,8 +2376,8 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff)
absoff += 8; /* we already have a corr descr, skip it */
reloff = absoff - (*tfsoff + 6);
print_file(file, 0, "/* %d */\n", *tfsoff);
- print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", RPC_FC_NON_ENCAPSULATED_UNION);
- print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", RPC_FC_LONG);
+ print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", FC_NON_ENCAPSULATED_UNION);
+ print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", FC_LONG);
write_conf_or_var_desc(file, current_structure, offset, ft,
get_attrp(f->attrs, ATTR_SWITCHIS));
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n",
@@ -2496,8 +2496,8 @@ static int write_no_repeat_pointer_descriptions(
if (is_ptr(type) ||
(is_conformant_array(type) && type_array_is_decl_as_ptr(type)))
{
- print_file(file, 2, "0x%02x, /* FC_NO_REPEAT */\n", RPC_FC_NO_REPEAT);
- print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%02x, /* FC_NO_REPEAT */\n", FC_NO_REPEAT);
+ print_file(file, 2, "0x%02x, /* FC_PAD */\n", FC_PAD);
*typestring_offset += 2;
return write_pointer_description_offsets(file, attrs, type,
@@ -2560,8 +2560,8 @@ static int write_fixed_array_pointer_descriptions(
increment_size = type_memsize(type_array_get_element(type));
- print_file(file, 2, "0x%02x, /* FC_FIXED_REPEAT */\n", RPC_FC_FIXED_REPEAT);
- print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%02x, /* FC_FIXED_REPEAT */\n", FC_FIXED_REPEAT);
+ print_file(file, 2, "0x%02x, /* FC_PAD */\n", FC_PAD);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Iterations = %d */\n", (unsigned short)type_array_get_dim(type), type_array_get_dim(type));
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", (unsigned short)increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", (unsigned short)*offset_in_memory, *offset_in_memory);
@@ -2634,8 +2634,8 @@ static int write_conformant_array_pointer_descriptions(
if (increment_size > USHRT_MAX)
error("array size of %u bytes is too large\n", increment_size);
- print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT);
- print_file(file, 2, "0x%02x, /* FC_FIXED_OFFSET */\n", RPC_FC_FIXED_OFFSET);
+ print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", FC_VARIABLE_REPEAT);
+ print_file(file, 2, "0x%02x, /* FC_FIXED_OFFSET */\n", FC_FIXED_OFFSET);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", (unsigned short)increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", (unsigned short)offset_in_memory, offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", (unsigned short)pointer_count, pointer_count);
@@ -2676,8 +2676,8 @@ static int write_varying_array_pointer_descriptions(
if (increment_size > USHRT_MAX)
error("array size of %u bytes is too large\n", increment_size);
- print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT);
- print_file(file, 2, "0x%02x, /* FC_VARIABLE_OFFSET */\n", RPC_FC_VARIABLE_OFFSET);
+ print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", FC_VARIABLE_REPEAT);
+ print_file(file, 2, "0x%02x, /* FC_VARIABLE_OFFSET */\n", FC_VARIABLE_OFFSET);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", (unsigned short)increment_size, increment_size);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", (unsigned short)*offset_in_memory, *offset_in_memory);
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", (unsigned short)pointer_count, pointer_count);
@@ -2760,7 +2760,7 @@ static void write_pointer_description(FILE *file, const attr_list_t *attrs, type
write_conformant_array_pointer_descriptions(
file, attrs, type, 0, typestring_offset);
else if (type_get_type(type) == TYPE_STRUCT &&
- get_struct_fc(type) == RPC_FC_CPSTRUCT)
+ get_struct_fc(type) == FC_CPSTRUCT)
{
type_t *carray = find_array_or_string_in_struct(type)->type;
write_conformant_array_pointer_descriptions( file, NULL, carray,
@@ -2788,10 +2788,10 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
if (is_declptr(type))
{
- unsigned char flag = is_conformant_array(type) ? 0 : RPC_FC_P_SIMPLEPOINTER;
+ unsigned char flag = is_conformant_array(type) ? 0 : FC_SIMPLE_POINTER;
int pointer_type = get_pointer_fc_context(type, attrs, context);
if (!pointer_type)
- pointer_type = RPC_FC_RP;
+ pointer_type = FC_RP;
print_start_tfs_comment(file, type, *typestring_offset);
print_file(file, 2,"0x%x, 0x%x,\t/* %s%s */\n",
pointer_type, flag, string_of_type(pointer_type),
@@ -2820,7 +2820,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
}
rtype = get_basic_fc(elem_type);
- if ((rtype != RPC_FC_BYTE) && (rtype != RPC_FC_CHAR) && (rtype != RPC_FC_WCHAR))
+ if ((rtype != FC_BYTE) && (rtype != FC_CHAR) && (rtype != FC_WCHAR))
{
error("write_string_tfs: Unimplemented for type 0x%x of name: %s\n", rtype, name);
return start_offset;
@@ -2837,11 +2837,11 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
error("array size for parameter %s exceeds %u bytes by %u bytes\n",
name, 0xffffu, dim - 0xffffu);
- if (rtype == RPC_FC_WCHAR)
+ if (rtype == FC_WCHAR)
WRITE_FCTYPE(file, FC_WSTRING, *typestring_offset);
else
WRITE_FCTYPE(file, FC_CSTRING, *typestring_offset);
- print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*typestring_offset += 2;
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)dim, dim);
@@ -2852,11 +2852,11 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
}
else if (is_conformant_array(type))
{
- if (rtype == RPC_FC_WCHAR)
+ if (rtype == FC_WCHAR)
WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset);
else
WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset);
- print_file(file, 2, "0x%x,\t/* FC_STRING_SIZED */\n", RPC_FC_STRING_SIZED);
+ print_file(file, 2, "0x%x,\t/* FC_STRING_SIZED */\n", FC_STRING_SIZED);
*typestring_offset += 2;
*typestring_offset += write_conf_or_var_desc(
@@ -2873,11 +2873,11 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
{
if (is_processed) return start_offset;
- if (rtype == RPC_FC_WCHAR)
+ if (rtype == FC_WCHAR)
WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset);
else
WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset);
- print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*typestring_offset += 2;
update_tfsoff(type, start_offset, file);
@@ -2901,7 +2901,7 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
: 0;
if (!pointer_type)
- pointer_type = RPC_FC_RP;
+ pointer_type = FC_RP;
if (!is_string_type(attrs, type_array_get_element(type)))
write_embedded_types(file, attrs, type_array_get_element(type), name, FALSE, typestring_offset);
@@ -2918,9 +2918,9 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
*typestring_offset += 2;
align = 0;
- if (fc != RPC_FC_BOGUS_ARRAY)
+ if (fc != FC_BOGUS_ARRAY)
{
- if (fc == RPC_FC_LGFARRAY || fc == RPC_FC_LGVARRAY)
+ if (fc == FC_LGFARRAY || fc == FC_LGVARRAY)
{
print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", size, size);
*typestring_offset += 4;
@@ -2936,12 +2936,12 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
+= write_conf_or_var_desc(file, current_structure, baseoff,
type, size_is);
- if (fc == RPC_FC_SMVARRAY || fc == RPC_FC_LGVARRAY)
+ if (fc == FC_SMVARRAY || fc == FC_LGVARRAY)
{
unsigned int elsize = type_memsize(type_array_get_element(type));
unsigned int dim = type_array_get_dim(type);
- if (fc == RPC_FC_LGVARRAY)
+ if (fc == FC_LGVARRAY)
{
print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", dim, dim);
*typestring_offset += 4;
@@ -2964,11 +2964,11 @@ static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t
if (type_has_pointers(type_array_get_element(type)) &&
(type_array_is_decl_as_ptr(type) || !current_structure))
{
- print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP);
- print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%x,\t/* FC_PP */\n", FC_PP);
+ print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*typestring_offset += 2;
write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, type, typestring_offset);
- print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END);
+ print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END);
*typestring_offset += 1;
}
@@ -3041,13 +3041,13 @@ static void write_struct_members(FILE *file, const type_t *type,
switch (align)
{
case 2:
- fc = RPC_FC_ALIGNM2;
+ fc = FC_ALIGNM2;
break;
case 4:
- fc = RPC_FC_ALIGNM4;
+ fc = FC_ALIGNM4;
break;
case 8:
- fc = RPC_FC_ALIGNM8;
+ fc = FC_ALIGNM8;
break;
default:
error("write_struct_members: cannot align type %d\n", type_get_type(ft));
@@ -3066,7 +3066,7 @@ static void write_struct_members(FILE *file, const type_t *type,
if (padding)
{
print_file(file, 2, "0x%x,\t/* FC_STRUCTPAD%d */\n",
- RPC_FC_STRUCTPAD1 + padding - 1,
+ FC_STRUCTPAD1 + padding - 1,
padding);
*typestring_offset += 1;
}
@@ -3129,13 +3129,13 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
reloff, reloff, absoff);
*tfsoff += 2;
}
- else if (fc == RPC_FC_BOGUS_STRUCT)
+ else if (fc == FC_BOGUS_STRUCT)
{
print_file(file, 2, "NdrFcShort(0x0),\n");
*tfsoff += 2;
}
- if (fc == RPC_FC_BOGUS_STRUCT)
+ if (fc == FC_BOGUS_STRUCT)
{
/* On the sizing pass, type->ptrdesc may be zero, but it's ok as
nothing is written to file yet. On the actual writing pass,
@@ -3147,22 +3147,22 @@ static unsigned int write_struct_tfs(FILE *file, type_t *type,
(unsigned short)reloff, reloff, absoff);
*tfsoff += 2;
}
- else if ((fc == RPC_FC_PSTRUCT) ||
- (fc == RPC_FC_CPSTRUCT) ||
- (fc == RPC_FC_CVSTRUCT && type_has_pointers(type)))
+ else if ((fc == FC_PSTRUCT) ||
+ (fc == FC_CPSTRUCT) ||
+ (fc == FC_CVSTRUCT && type_has_pointers(type)))
{
- print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP);
- print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD);
+ print_file(file, 2, "0x%x,\t/* FC_PP */\n", FC_PP);
+ print_file(file, 2, "0x%x,\t/* FC_PAD */\n", FC_PAD);
*tfsoff += 2;
write_pointer_description(file, NULL, type, tfsoff);
- print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END);
+ print_file(file, 2, "0x%x,\t/* FC_END */\n", FC_END);
*tfsoff += 1;
}
- write_struct_members(file, type, fc == RPC_FC_BOGUS_STRUCT, &corroff,
+ write_struct_members(file, type, fc == FC_BOGUS_STRUCT, &corroff,
tfsoff);
- if (fc == RPC_FC_BOGUS_STRUCT)
+ if (fc == FC_BOGUS_STRUCT)
{
const var_t *f;
@@ -3284,15 +3284,15 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
fc = get_basic_fc(st);
switch (fc)
{
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_BYTE:
- case RPC_FC_USMALL:
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_BYTE:
+ case FC_USMALL:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
+ case FC_LONG:
+ case FC_ULONG:
break;
default:
fc = 0;
@@ -3311,7 +3311,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
type_memsize_and_alignment(f->type, &align);
}
- print_file(file, 2, "0x%x,\t/* FC_ENCAPSULATED_UNION */\n", RPC_FC_ENCAPSULATED_UNION);
+ print_file(file, 2, "0x%x,\t/* FC_ENCAPSULATED_UNION */\n", FC_ENCAPSULATED_UNION);
print_file(file, 2, "0x%x,\t/* Switch type= %s */\n",
(align << 4) | fc, string_of_type(fc));
*tfsoff += 2;
@@ -3327,15 +3327,15 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
fc = get_basic_fc(st);
switch (fc)
{
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM16:
- case RPC_FC_ENUM32:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
+ case FC_SHORT:
+ case FC_USHORT:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM16:
+ case FC_ENUM32:
break;
default:
fc = 0;
@@ -3347,7 +3347,7 @@ static unsigned int write_union_tfs(FILE *file, const attr_list_t *attrs,
else
error("union switch type must be an integer, char, or enum\n");
- print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", RPC_FC_NON_ENCAPSULATED_UNION);
+ print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", FC_NON_ENCAPSULATED_UNION);
print_file(file, 2, "0x%x,\t/* Switch type= %s */\n",
fc, string_of_type(fc));
*tfsoff += 2;
@@ -3461,21 +3461,21 @@ static unsigned int write_contexthandle_tfs(FILE *file,
if (flags & 0x80) /* via ptr */
{
int pointer_type = get_pointer_fc( type, attrs, toplevel_param );
- if (!pointer_type) pointer_type = RPC_FC_RP;
+ if (!pointer_type) pointer_type = FC_RP;
*typeformat_offset += 4;
print_file(file, 2,"0x%x, 0x0,\t/* %s */\n", pointer_type, string_of_type(pointer_type) );
print_file(file, 2, "NdrFcShort(0x2),\t /* Offset= 2 (%u) */\n", *typeformat_offset);
print_file(file, 0, "/* %2u */\n", *typeformat_offset);
}
- print_file(file, 2, "0x%02x,\t/* FC_BIND_CONTEXT */\n", RPC_FC_BIND_CONTEXT);
+ print_file(file, 2, "0x%02x,\t/* FC_BIND_CONTEXT */\n", FC_BIND_CONTEXT);
print_file(file, 2, "0x%x,\t/* Context flags: ", flags);
/* return and can't be null values overlap */
if (((flags & 0x21) != 0x21) && (flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL))
print_file(file, 0, "can't be null, ");
if (flags & NDR_CONTEXT_HANDLE_SERIALIZE)
print_file(file, 0, "serialize, ");
- if (flags & NDR_CONTEXT_HANDLE_NO_SERIALIZE)
+ if (flags & NDR_CONTEXT_HANDLE_NOSERIALIZE)
print_file(file, 0, "no serialize, ");
if (flags & NDR_STRICT_CONTEXT_HANDLE)
print_file(file, 0, "strict, ");
@@ -3514,7 +3514,7 @@ static unsigned int write_range_tfs(FILE *file, const attr_list_t *attrs,
assert(fc <= 0xf);
print_file(file, 0, "/* %u */\n", *typeformat_offset);
- print_file(file, 2, "0x%x,\t/* FC_RANGE */\n", RPC_FC_RANGE);
+ print_file(file, 2, "0x%x,\t/* FC_RANGE */\n", FC_RANGE);
print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", range_min->cval, range_min->cval);
print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", range_max->cval, range_max->cval);
@@ -3558,7 +3558,7 @@ static unsigned int write_type_tfs(FILE *file, int indent,
int ptr_type;
ptr_type = get_pointer_fc(type, attrs,
context == TYPE_CONTEXT_TOPLEVELPARAM);
- if (ptr_type != RPC_FC_RP || type_array_is_decl_as_ptr(type))
+ if (ptr_type != FC_RP || type_array_is_decl_as_ptr(type))
{
unsigned int absoff = type->typestring_offset;
short reloff = absoff - (*typeformat_offset + 2);
@@ -3568,7 +3568,7 @@ static unsigned int write_type_tfs(FILE *file, int indent,
string_of_type(ptr_type));
print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n",
reloff, reloff, absoff);
- if (ptr_type != RPC_FC_RP) update_tfsoff( type, off, file );
+ if (ptr_type != FC_RP) update_tfsoff( type, off, file );
*typeformat_offset += 4;
}
type->details.array.ptr_tfsoff = off;
@@ -3721,39 +3721,39 @@ static unsigned int get_required_buffer_size_type(
case TGT_BASIC:
switch (get_basic_fc(type))
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_USMALL:
- case RPC_FC_SMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_USMALL:
+ case FC_SMALL:
*alignment = 4;
return 1;
- case RPC_FC_WCHAR:
- case RPC_FC_USHORT:
- case RPC_FC_SHORT:
+ case FC_WCHAR:
+ case FC_USHORT:
+ case FC_SHORT:
*alignment = 4;
return 2;
- case RPC_FC_ULONG:
- case RPC_FC_LONG:
- case RPC_FC_FLOAT:
- case RPC_FC_ERROR_STATUS_T:
+ case FC_ULONG:
+ case FC_LONG:
+ case FC_FLOAT:
+ case FC_ERROR_STATUS_T:
*alignment = 4;
return 4;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
*alignment = 8;
return 8;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
assert( pointer_size );
*alignment = pointer_size;
return pointer_size;
- case RPC_FC_IGNORE:
- case RPC_FC_BIND_PRIMITIVE:
+ case FC_IGNORE:
+ case FC_BIND_PRIMITIVE:
return 0;
default:
@@ -3766,17 +3766,17 @@ static unsigned int get_required_buffer_size_type(
case TGT_ENUM:
switch (get_enum_fc(type))
{
- case RPC_FC_ENUM32:
+ case FC_ENUM32:
*alignment = 4;
return 4;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
*alignment = 4;
return 2;
}
break;
case TGT_STRUCT:
- if (get_struct_fc(type) == RPC_FC_STRUCT)
+ if (get_struct_fc(type) == FC_STRUCT)
{
if (!type_struct_get_fields(type)) return 0;
return fields_memsize(type_struct_get_fields(type), alignment);
@@ -3789,7 +3789,7 @@ static unsigned int get_required_buffer_size_type(
const type_t *ref = type_pointer_get_ref(type);
if (is_string_type( attrs, ref )) break;
if (!(size = get_required_buffer_size_type( ref, name, NULL, FALSE, &align ))) break;
- if (get_pointer_fc(type, attrs, toplevel_param) != RPC_FC_RP)
+ if (get_pointer_fc(type, attrs, toplevel_param) != FC_RP)
{
size += 4 + align;
align = 4;
@@ -3799,12 +3799,12 @@ static unsigned int get_required_buffer_size_type(
}
case TGT_ARRAY:
- if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_RP)
+ if (get_pointer_fc(type, attrs, toplevel_param) == FC_RP)
{
switch (get_array_fc(type))
{
- case RPC_FC_SMFARRAY:
- case RPC_FC_LGFARRAY:
+ case FC_SMFARRAY:
+ case FC_LGFARRAY:
return type_array_get_dim(type) *
get_required_buffer_size_type(type_array_get_element(type), name,
NULL, FALSE, alignment);
@@ -3946,36 +3946,36 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
const type_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : type;
switch (get_basic_fc(ref))
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
alignment = 1;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_USHORT:
- case RPC_FC_SHORT:
+ case FC_WCHAR:
+ case FC_USHORT:
+ case FC_SHORT:
alignment = 2;
break;
- case RPC_FC_ULONG:
- case RPC_FC_LONG:
- case RPC_FC_FLOAT:
- case RPC_FC_ERROR_STATUS_T:
+ case FC_ULONG:
+ case FC_LONG:
+ case FC_FLOAT:
+ case FC_ERROR_STATUS_T:
/* pointer_size must be 4 if we got here in these two cases */
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
alignment = 4;
break;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
alignment = 8;
break;
- case RPC_FC_IGNORE:
- case RPC_FC_BIND_PRIMITIVE:
+ case FC_IGNORE:
+ case FC_BIND_PRIMITIVE:
/* no marshalling needed */
return;
@@ -4209,14 +4209,14 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
break;
case TGT_STRING:
if (phase == PHASE_FREE || pass == PASS_RETURN ||
- pointer_type != RPC_FC_RP)
+ pointer_type != FC_RP)
{
/* strings returned are assumed to be global and hence don't
* need freeing */
if (is_declptr(type) && !(phase == PHASE_FREE && pass == PASS_RETURN))
print_phase_function(file, indent, "Pointer", local_var_prefix,
phase, var, start_offset);
- else if (pointer_type == RPC_FC_RP && phase == PHASE_FREE &&
+ else if (pointer_type == FC_RP && phase == PHASE_FREE &&
!in_attr && is_conformant_array(type))
{
print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name);
@@ -4258,34 +4258,34 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
switch (tc)
{
- case RPC_FC_SMFARRAY:
- case RPC_FC_LGFARRAY:
+ case FC_SMFARRAY:
+ case FC_LGFARRAY:
array_type = "FixedArray";
break;
- case RPC_FC_SMVARRAY:
- case RPC_FC_LGVARRAY:
+ case FC_SMVARRAY:
+ case FC_LGVARRAY:
array_type = "VaryingArray";
break;
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
array_type = "ConformantArray";
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
array_type = "ConformantVaryingArray";
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
array_type = "ComplexArray";
break;
}
- if (pointer_type != RPC_FC_RP) array_type = "Pointer";
+ if (pointer_type != FC_RP) array_type = "Pointer";
- if (phase == PHASE_FREE && pointer_type == RPC_FC_RP)
+ if (phase == PHASE_FREE && pointer_type == FC_RP)
{
/* these are all unmarshalled by allocating memory */
- if (tc == RPC_FC_BOGUS_ARRAY ||
- tc == RPC_FC_CVARRAY ||
- ((tc == RPC_FC_SMVARRAY || tc == RPC_FC_LGVARRAY) && in_attr) ||
- (tc == RPC_FC_CARRAY && !in_attr))
+ if (tc == FC_BOGUS_ARRAY ||
+ tc == FC_CVARRAY ||
+ ((tc == FC_SMVARRAY || tc == FC_LGVARRAY) && in_attr) ||
+ (tc == FC_CARRAY && !in_attr))
{
if (type_array_is_decl_as_ptr(type) && type->details.array.ptr_tfsoff)
{
@@ -4336,21 +4336,21 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
case TGT_STRUCT:
switch (get_struct_fc(type))
{
- case RPC_FC_STRUCT:
+ case FC_STRUCT:
if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
print_phase_function(file, indent, "SimpleStruct", local_var_prefix, phase, var, start_offset);
break;
- case RPC_FC_PSTRUCT:
+ case FC_PSTRUCT:
print_phase_function(file, indent, "SimpleStruct", local_var_prefix, phase, var, start_offset);
break;
- case RPC_FC_CSTRUCT:
- case RPC_FC_CPSTRUCT:
+ case FC_CSTRUCT:
+ case FC_CPSTRUCT:
print_phase_function(file, indent, "ConformantStruct", local_var_prefix, phase, var, start_offset);
break;
- case RPC_FC_CVSTRUCT:
+ case FC_CVSTRUCT:
print_phase_function(file, indent, "ConformantVaryingStruct", local_var_prefix, phase, var, start_offset);
break;
- case RPC_FC_BOGUS_STRUCT:
+ case FC_BOGUS_STRUCT:
print_phase_function(file, indent, "ComplexStruct", local_var_prefix, phase, var, start_offset);
break;
default:
@@ -4373,7 +4373,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
case TGT_POINTER:
{
const type_t *ref = type_pointer_get_ref(type);
- if (pointer_type == RPC_FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES))
+ if (pointer_type == FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES))
{
case TGT_BASIC:
print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
@@ -4388,7 +4388,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
case TGT_STRUCT:
switch (get_struct_fc(ref))
{
- case RPC_FC_STRUCT:
+ case FC_STRUCT:
/* simple structs have known sizes, so don't need a sizing
* pass and don't have any memory to free and so don't
* need a freeing pass */
@@ -4402,17 +4402,17 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
indent--;
}
break;
- case RPC_FC_PSTRUCT:
+ case FC_PSTRUCT:
type_str = "SimpleStruct";
break;
- case RPC_FC_CSTRUCT:
- case RPC_FC_CPSTRUCT:
+ case FC_CSTRUCT:
+ case FC_CPSTRUCT:
type_str = "ConformantStruct";
break;
- case RPC_FC_CVSTRUCT:
+ case FC_CVSTRUCT:
type_str = "ConformantVaryingStruct";
break;
- case RPC_FC_BOGUS_STRUCT:
+ case FC_BOGUS_STRUCT:
type_str = "ComplexStruct";
break;
default:
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index 0387846..a391964 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -24,7 +24,7 @@
#include <stdarg.h>
#include <assert.h>
#include "guiddef.h"
-#include "wine/rpcfc.h"
+#include "ndrtypes.h"
#include "wine/list.h"
#ifndef UUID_DEFINED
--
2.7.4
June 13, 2018
[PATCH 2/3] rpcrt4: Use publicly defined NDR constants.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
All types defined in wine/rpcfc.h have equivalent types in ndrtypes.h, with
the exception of RPC_FC_BIND_EXPLICIT, which I have replaced with 0.
dlls/rpcrt4/ndr_contexthandle.c | 2 -
dlls/rpcrt4/ndr_es.c | 15 +-
dlls/rpcrt4/ndr_marshall.c | 1420 +++++++++++++++++++--------------------
dlls/rpcrt4/ndr_ole.c | 6 +-
dlls/rpcrt4/ndr_stubless.c | 241 ++++---
dlls/rpcrt4/ndr_stubless.h | 16 +-
6 files changed, 846 insertions(+), 854 deletions(-)
diff --git a/dlls/rpcrt4/ndr_contexthandle.c b/dlls/rpcrt4/ndr_contexthandle.c
index 3b26285..a5e1ffc 100644
--- a/dlls/rpcrt4/ndr_contexthandle.c
+++ b/dlls/rpcrt4/ndr_contexthandle.c
@@ -23,8 +23,6 @@
#include "rpc_assoc.h"
#include "rpcndr.h"
-#include "wine/rpcfc.h"
-
#include "wine/debug.h"
#include "wine/list.h"
diff --git a/dlls/rpcrt4/ndr_es.c b/dlls/rpcrt4/ndr_es.c
index 59ea816..158bc7c 100644
--- a/dlls/rpcrt4/ndr_es.c
+++ b/dlls/rpcrt4/ndr_es.c
@@ -32,7 +32,6 @@
#include "ndr_stubless.h"
#include "wine/debug.h"
-#include "wine/rpcfc.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -424,7 +423,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
client_interface = pStubDesc->RpcInterfaceInformation;
pEsMsg->InterfaceId = client_interface->InterfaceId;
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
{
const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
stack_size = header_rpc->stack_size;
@@ -438,17 +437,17 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
pFormat += sizeof(NDR_PROC_HEADER);
}
- if (pProcHeader->handle_type == RPC_FC_BIND_EXPLICIT)
+ if (pProcHeader->handle_type == 0)
{
switch (*pFormat) /* handle_type */
{
- case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */
+ case FC_BIND_PRIMITIVE: /* explicit primitive */
pFormat += sizeof(NDR_EHD_PRIMITIVE);
break;
- case RPC_FC_BIND_GENERIC: /* explicit generic */
+ case FC_BIND_GENERIC: /* explicit generic */
pFormat += sizeof(NDR_EHD_GENERIC);
break;
- case RPC_FC_BIND_CONTEXT: /* explicit context */
+ case FC_BIND_CONTEXT: /* explicit context */
pFormat += sizeof(NDR_EHD_CONTEXT);
break;
default:
@@ -467,7 +466,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
pEsMsg->StubMsg.pfnFree = pStubDesc->pfnFree;
/* create the full pointer translation tables, if requested */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
pEsMsg->StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT);
TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags);
@@ -510,7 +509,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu
return;
}
/* free the full pointer translation tables */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
NdrFullPointerXlatFree(pEsMsg->StubMsg.FullPtrXlatTables);
}
diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 6356fb9..52e2716 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -43,8 +43,6 @@
#include "ndrtypes.h"
#include "wine/unicode.h"
-#include "wine/rpcfc.h"
-
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole);
@@ -554,15 +552,15 @@ PFORMAT_STRING ComputeConformanceOrVariance(
}
switch (pFormat[0] & 0xf0) {
- case RPC_FC_NORMAL_CONFORMANCE:
+ case FC_NORMAL_CONFORMANCE:
TRACE("normal conformance, ofs=%d\n", ofs);
ptr = pMemory;
break;
- case RPC_FC_POINTER_CONFORMANCE:
+ case FC_POINTER_CONFORMANCE:
TRACE("pointer conformance, ofs=%d\n", ofs);
ptr = pStubMsg->Memory;
break;
- case RPC_FC_TOP_LEVEL_CONFORMANCE:
+ case FC_TOP_LEVEL_CONFORMANCE:
TRACE("toplevel conformance, ofs=%d\n", ofs);
if (pStubMsg->StackTop) {
ptr = pStubMsg->StackTop;
@@ -572,12 +570,12 @@ PFORMAT_STRING ComputeConformanceOrVariance(
goto finish_conf;
}
break;
- case RPC_FC_CONSTANT_CONFORMANCE:
+ case FC_CONSTANT_CONFORMANCE:
data = ofs | ((DWORD)pFormat[1] << 16);
TRACE("constant conformance, val=%ld\n", data);
*pCount = data;
goto finish_conf;
- case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE:
+ case FC_TOP_LEVEL_MULTID_CONFORMANCE:
FIXME("toplevel multidimensional conformance, ofs=%d\n", ofs);
if (pStubMsg->StackTop) {
ptr = pStubMsg->StackTop;
@@ -593,10 +591,10 @@ PFORMAT_STRING ComputeConformanceOrVariance(
}
switch (pFormat[1]) {
- case RPC_FC_DEREFERENCE:
+ case FC_DEREFERENCE:
ptr = *(LPVOID*)((char *)ptr + ofs);
break;
- case RPC_FC_CALLBACK:
+ case FC_CALLBACK:
{
unsigned char *old_stack_top = pStubMsg->StackTop;
ULONG_PTR max_count, old_max_count = pStubMsg->MaxCount;
@@ -621,25 +619,25 @@ PFORMAT_STRING ComputeConformanceOrVariance(
}
switch (dtype) {
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
+ case FC_LONG:
+ case FC_ULONG:
data = *(DWORD*)ptr;
break;
- case RPC_FC_SHORT:
+ case FC_SHORT:
data = *(SHORT*)ptr;
break;
- case RPC_FC_USHORT:
+ case FC_USHORT:
data = *(USHORT*)ptr;
break;
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
+ case FC_CHAR:
+ case FC_SMALL:
data = *(CHAR*)ptr;
break;
- case RPC_FC_BYTE:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_USMALL:
data = *(UCHAR*)ptr;
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
data = *(ULONGLONG *)ptr;
break;
default:
@@ -650,20 +648,20 @@ PFORMAT_STRING ComputeConformanceOrVariance(
done_conf_grab:
switch (pFormat[1]) {
- case RPC_FC_DEREFERENCE: /* already handled */
+ case FC_DEREFERENCE: /* already handled */
case 0: /* no op */
*pCount = data;
break;
- case RPC_FC_ADD_1:
+ case FC_ADD_1:
*pCount = data + 1;
break;
- case RPC_FC_SUB_1:
+ case FC_SUB_1:
*pCount = data - 1;
break;
- case RPC_FC_MULT_2:
+ case FC_MULT_2:
*pCount = data * 2;
break;
- case RPC_FC_DIV_2:
+ case FC_DIV_2:
*pCount = data / 2;
break;
default:
@@ -779,16 +777,16 @@ static void validate_string_data(MIDL_STUB_MESSAGE *pStubMsg, ULONG bufsize, ULO
static inline void dump_pointer_attr(unsigned char attr)
{
- if (attr & RPC_FC_P_ALLOCALLNODES)
- TRACE(" RPC_FC_P_ALLOCALLNODES");
- if (attr & RPC_FC_P_DONTFREE)
- TRACE(" RPC_FC_P_DONTFREE");
- if (attr & RPC_FC_P_ONSTACK)
- TRACE(" RPC_FC_P_ONSTACK");
- if (attr & RPC_FC_P_SIMPLEPOINTER)
- TRACE(" RPC_FC_P_SIMPLEPOINTER");
- if (attr & RPC_FC_P_DEREF)
- TRACE(" RPC_FC_P_DEREF");
+ if (attr & FC_ALLOCATE_ALL_NODES)
+ TRACE(" FC_ALLOCATE_ALL_NODES");
+ if (attr & FC_DONT_FREE)
+ TRACE(" FC_DONT_FREE");
+ if (attr & FC_ALLOCED_ON_STACK)
+ TRACE(" FC_ALLOCED_ON_STACK");
+ if (attr & FC_SIMPLE_POINTER)
+ TRACE(" FC_SIMPLE_POINTER");
+ if (attr & FC_POINTER_DEREF)
+ TRACE(" FC_POINTER_DEREF");
TRACE("\n");
}
@@ -809,11 +807,11 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p,%p)\n", pStubMsg, Buffer, Pointer, pFormat);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
- if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
+ if (attr & FC_SIMPLE_POINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
switch (type) {
- case RPC_FC_RP: /* ref pointer (always non-null) */
+ case FC_RP: /* ref pointer (always non-null) */
if (!Pointer)
{
ERR("NULL ref pointer is not allowed\n");
@@ -821,8 +819,8 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
}
pointer_needs_marshaling = TRUE;
break;
- case RPC_FC_UP: /* unique pointer */
- case RPC_FC_OP: /* object pointer - same as unique here */
+ case FC_UP: /* unique pointer */
+ case FC_OP: /* object pointer - same as unique here */
if (Pointer)
pointer_needs_marshaling = TRUE;
else
@@ -831,7 +829,7 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("writing 0x%08x to buffer\n", pointer_id);
NDR_LOCAL_UINT32_WRITE(Buffer, pointer_id);
break;
- case RPC_FC_FP:
+ case FC_FP:
pointer_needs_marshaling = !NdrFullPointerQueryPointer(
pStubMsg->FullPtrXlatTables, Pointer, 1, &pointer_id);
TRACE("writing 0x%08x to buffer\n", pointer_id);
@@ -846,7 +844,7 @@ static void PointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("calling marshaller for type 0x%x\n", (int)*desc);
if (pointer_needs_marshaling) {
- if (attr & RPC_FC_P_DEREF) {
+ if (attr & FC_POINTER_DEREF) {
Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer);
}
@@ -877,14 +875,14 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p,%p,%p,%d)\n", pStubMsg, Buffer, pPointer, pSrcPointer, pFormat, fMustAlloc);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
- if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
+ if (attr & FC_SIMPLE_POINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
switch (type) {
- case RPC_FC_RP: /* ref pointer (always non-null) */
+ case FC_RP: /* ref pointer (always non-null) */
pointer_needs_unmarshaling = TRUE;
break;
- case RPC_FC_UP: /* unique pointer */
+ case FC_UP: /* unique pointer */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
if (pointer_id)
@@ -894,7 +892,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pointer_needs_unmarshaling = FALSE;
}
break;
- case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
+ case FC_OP: /* object pointer - we must free data before overwriting it */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
if (!fMustAlloc && pSrcPointer)
@@ -910,7 +908,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pointer_needs_unmarshaling = FALSE;
}
break;
- case RPC_FC_FP:
+ case FC_FP:
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
pointer_needs_unmarshaling = !NdrFullPointerQueryRefId(
@@ -945,17 +943,17 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
* whether we have to initialise it so we can use the optimisation of
* setting the pointer to the buffer, if possible, or set fMustAlloc to
* TRUE. */
- if (attr & RPC_FC_P_DEREF) {
+ if (attr & FC_POINTER_DEREF) {
fMustAlloc = TRUE;
} else {
*current_ptr = NULL;
}
}
- if (attr & RPC_FC_P_ALLOCALLNODES)
- FIXME("RPC_FC_P_ALLOCALLNODES not implemented\n");
+ if (attr & FC_ALLOCATE_ALL_NODES)
+ FIXME("FC_ALLOCATE_ALL_NODES not implemented\n");
- if (attr & RPC_FC_P_DEREF) {
+ if (attr & FC_POINTER_DEREF) {
if (fMustAlloc) {
unsigned char *base_ptr_val = NdrAllocate(pStubMsg, sizeof(void *));
*pPointer = base_ptr_val;
@@ -969,7 +967,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (m) m(pStubMsg, current_ptr, desc, fMustAlloc);
else FIXME("no unmarshaller for data type=%02x\n", *desc);
- if (type == RPC_FC_FP)
+ if (type == FC_FP)
NdrFullPointerInsertRefId(pStubMsg->FullPtrXlatTables, pointer_id,
*pPointer);
}
@@ -993,24 +991,24 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
- if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
+ if (attr & FC_SIMPLE_POINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
switch (type) {
- case RPC_FC_RP: /* ref pointer (always non-null) */
+ case FC_RP: /* ref pointer (always non-null) */
if (!Pointer)
{
ERR("NULL ref pointer is not allowed\n");
RpcRaiseException(RPC_X_NULL_REF_POINTER);
}
break;
- case RPC_FC_OP:
- case RPC_FC_UP:
+ case FC_OP:
+ case FC_UP:
/* NULL pointer has no further representation */
if (!Pointer)
return;
break;
- case RPC_FC_FP:
+ case FC_FP:
pointer_needs_sizing = !NdrFullPointerQueryPointer(
pStubMsg->FullPtrXlatTables, Pointer, 0, &pointer_id);
if (!pointer_needs_sizing)
@@ -1022,7 +1020,7 @@ static void PointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
return;
}
- if (attr & RPC_FC_P_DEREF) {
+ if (attr & FC_POINTER_DEREF) {
Pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", Pointer);
}
@@ -1047,15 +1045,15 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, Buffer, pFormat);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
pFormat += 2;
- if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
+ if (attr & FC_SIMPLE_POINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
switch (type) {
- case RPC_FC_RP: /* ref pointer (always non-null) */
+ case FC_RP: /* ref pointer (always non-null) */
pointer_needs_sizing = TRUE;
break;
- case RPC_FC_UP: /* unique pointer */
- case RPC_FC_OP: /* object pointer - we must free data before overwriting it */
+ case FC_UP: /* unique pointer */
+ case FC_OP: /* object pointer - we must free data before overwriting it */
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
TRACE("pointer_id is 0x%08x\n", pointer_id);
if (pointer_id)
@@ -1063,7 +1061,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
else
pointer_needs_sizing = FALSE;
break;
- case RPC_FC_FP:
+ case FC_FP:
{
void *pointer;
pointer_id = NDR_LOCAL_UINT32_READ(Buffer);
@@ -1078,7 +1076,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
return 0;
}
- if (attr & RPC_FC_P_DEREF) {
+ if (attr & FC_POINTER_DEREF) {
align_length(&pStubMsg->MemorySize, sizeof(void*));
pStubMsg->MemorySize += sizeof(void*);
TRACE("deref\n");
@@ -1107,21 +1105,21 @@ static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, Pointer, pFormat);
TRACE("type=0x%x, attr=", type); dump_pointer_attr(attr);
- if (attr & RPC_FC_P_DONTFREE) return;
+ if (attr & FC_DONT_FREE) return;
pFormat += 2;
- if (attr & RPC_FC_P_SIMPLEPOINTER) desc = pFormat;
+ if (attr & FC_SIMPLE_POINTER) desc = pFormat;
else desc = pFormat + *(const SHORT*)pFormat;
if (!Pointer) return;
- if (type == RPC_FC_FP) {
+ if (type == FC_FP) {
int pointer_needs_freeing = NdrFullPointerFree(
pStubMsg->FullPtrXlatTables, Pointer);
if (!pointer_needs_freeing)
return;
}
- if (attr & RPC_FC_P_DEREF) {
+ if (attr & FC_POINTER_DEREF) {
current_pointer = *(unsigned char**)Pointer;
TRACE("deref => %p\n", current_pointer);
}
@@ -1138,7 +1136,7 @@ static void PointerFree(PMIDL_STUB_MESSAGE pStubMsg,
if (Pointer >= pStubMsg->BufferStart && Pointer <= pStubMsg->BufferEnd)
goto notfree;
- if (attr & RPC_FC_P_ONSTACK) {
+ if (attr & FC_ALLOCED_ON_STACK) {
TRACE("not freeing stack ptr %p\n", Pointer);
return;
}
@@ -1163,7 +1161,7 @@ static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (*pFormat != RPC_FC_PP) return NULL;
+ if (*pFormat != FC_PP) return NULL;
pFormat += 2;
if (pStubMsg->PointerBufferMark)
@@ -1173,25 +1171,25 @@ static unsigned char * EmbeddedPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerBufferMark = NULL;
}
- while (pFormat[0] != RPC_FC_END) {
+ while (pFormat[0] != FC_END) {
switch (pFormat[0]) {
default:
FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
/* fallthrough */
- case RPC_FC_NO_REPEAT:
+ case FC_NO_REPEAT:
rep = 1;
stride = 0;
count = 1;
pFormat += 2;
break;
- case RPC_FC_FIXED_REPEAT:
+ case FC_FIXED_REPEAT:
rep = *(const WORD*)&pFormat[2];
stride = *(const WORD*)&pFormat[4];
count = *(const WORD*)&pFormat[8];
pFormat += 10;
break;
- case RPC_FC_VARIABLE_REPEAT:
- rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
+ case FC_VARIABLE_REPEAT:
+ rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
stride = *(const WORD*)&pFormat[2];
count = *(const WORD*)&pFormat[6];
pFormat += 8;
@@ -1243,7 +1241,7 @@ static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p,%p,%d)\n", pStubMsg, pDstBuffer, pSrcMemoryPtrs, pFormat, fMustAlloc);
- if (*pFormat != RPC_FC_PP) return NULL;
+ if (*pFormat != FC_PP) return NULL;
pFormat += 2;
if (pStubMsg->PointerBufferMark)
@@ -1253,26 +1251,26 @@ static unsigned char * EmbeddedPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerBufferMark = NULL;
}
- while (pFormat[0] != RPC_FC_END) {
+ while (pFormat[0] != FC_END) {
TRACE("pFormat[0] = 0x%x\n", pFormat[0]);
switch (pFormat[0]) {
default:
FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
/* fallthrough */
- case RPC_FC_NO_REPEAT:
+ case FC_NO_REPEAT:
rep = 1;
stride = 0;
count = 1;
pFormat += 2;
break;
- case RPC_FC_FIXED_REPEAT:
+ case FC_FIXED_REPEAT:
rep = *(const WORD*)&pFormat[2];
stride = *(const WORD*)&pFormat[4];
count = *(const WORD*)&pFormat[8];
pFormat += 10;
break;
- case RPC_FC_VARIABLE_REPEAT:
- rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
+ case FC_VARIABLE_REPEAT:
+ rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
stride = *(const WORD*)&pFormat[2];
count = *(const WORD*)&pFormat[6];
pFormat += 8;
@@ -1319,7 +1317,7 @@ static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
if (pStubMsg->IgnoreEmbeddedPointers) return;
- if (*pFormat != RPC_FC_PP) return;
+ if (*pFormat != FC_PP) return;
pFormat += 2;
if (pStubMsg->PointerLength)
@@ -1329,25 +1327,25 @@ static void EmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerLength = 0;
}
- while (pFormat[0] != RPC_FC_END) {
+ while (pFormat[0] != FC_END) {
switch (pFormat[0]) {
default:
FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
/* fallthrough */
- case RPC_FC_NO_REPEAT:
+ case FC_NO_REPEAT:
rep = 1;
stride = 0;
count = 1;
pFormat += 2;
break;
- case RPC_FC_FIXED_REPEAT:
+ case FC_FIXED_REPEAT:
rep = *(const WORD*)&pFormat[2];
stride = *(const WORD*)&pFormat[4];
count = *(const WORD*)&pFormat[8];
pFormat += 10;
break;
- case RPC_FC_VARIABLE_REPEAT:
- rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
+ case FC_VARIABLE_REPEAT:
+ rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
stride = *(const WORD*)&pFormat[2];
count = *(const WORD*)&pFormat[6];
pFormat += 8;
@@ -1399,28 +1397,28 @@ static ULONG EmbeddedPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerBufferMark = NULL;
}
- if (*pFormat != RPC_FC_PP) return 0;
+ if (*pFormat != FC_PP) return 0;
pFormat += 2;
- while (pFormat[0] != RPC_FC_END) {
+ while (pFormat[0] != FC_END) {
switch (pFormat[0]) {
default:
FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
/* fallthrough */
- case RPC_FC_NO_REPEAT:
+ case FC_NO_REPEAT:
rep = 1;
stride = 0;
count = 1;
pFormat += 2;
break;
- case RPC_FC_FIXED_REPEAT:
+ case FC_FIXED_REPEAT:
rep = *(const WORD*)&pFormat[2];
stride = *(const WORD*)&pFormat[4];
count = *(const WORD*)&pFormat[8];
pFormat += 10;
break;
- case RPC_FC_VARIABLE_REPEAT:
- rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
+ case FC_VARIABLE_REPEAT:
+ rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
stride = *(const WORD*)&pFormat[2];
count = *(const WORD*)&pFormat[6];
pFormat += 8;
@@ -1458,28 +1456,28 @@ static void EmbeddedPointerFree(PMIDL_STUB_MESSAGE pStubMsg,
unsigned i;
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (*pFormat != RPC_FC_PP) return;
+ if (*pFormat != FC_PP) return;
pFormat += 2;
- while (pFormat[0] != RPC_FC_END) {
+ while (pFormat[0] != FC_END) {
switch (pFormat[0]) {
default:
FIXME("unknown repeat type %d; assuming no repeat\n", pFormat[0]);
/* fallthrough */
- case RPC_FC_NO_REPEAT:
+ case FC_NO_REPEAT:
rep = 1;
stride = 0;
count = 1;
pFormat += 2;
break;
- case RPC_FC_FIXED_REPEAT:
+ case FC_FIXED_REPEAT:
rep = *(const WORD*)&pFormat[2];
stride = *(const WORD*)&pFormat[4];
count = *(const WORD*)&pFormat[8];
pFormat += 10;
break;
- case RPC_FC_VARIABLE_REPEAT:
- rep = (pFormat[1] == RPC_FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
+ case FC_VARIABLE_REPEAT:
+ rep = (pFormat[1] == FC_VARIABLE_OFFSET) ? pStubMsg->ActualCount : pStubMsg->MaxCount;
stride = *(const WORD*)&pFormat[2];
count = *(const WORD*)&pFormat[6];
pFormat += 8;
@@ -1517,7 +1515,7 @@ unsigned char * WINAPI NdrPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* Increment the buffer here instead of in PointerMarshall,
* as that is used by embedded pointers which already handle the incrementing
* the buffer, and shouldn't write any additional pointer data to the wire */
- if (*pFormat != RPC_FC_RP)
+ if (*pFormat != FC_RP)
{
align_pointer_clear(&pStubMsg->Buffer, 4);
Buffer = pStubMsg->Buffer;
@@ -1543,7 +1541,7 @@ unsigned char * WINAPI NdrPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
- if (*pFormat == RPC_FC_RP)
+ if (*pFormat == FC_RP)
{
Buffer = pStubMsg->Buffer;
/* Do the NULL ref pointer check here because embedded pointers can be
@@ -1583,7 +1581,7 @@ void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
/* Increment the buffer length here instead of in PointerBufferSize,
* as that is used by embedded pointers which already handle the buffer
* length, and shouldn't write anything more to the wire */
- if (*pFormat != RPC_FC_RP)
+ if (*pFormat != FC_RP)
{
align_length(&pStubMsg->BufferLength, 4);
safe_buffer_length_increment(pStubMsg, 4);
@@ -1599,7 +1597,7 @@ ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
unsigned char *Buffer = pStubMsg->Buffer;
- if (*pFormat != RPC_FC_RP)
+ if (*pFormat != FC_RP)
{
align_pointer(&pStubMsg->Buffer, 4);
safe_buffer_increment(pStubMsg, 4);
@@ -1648,39 +1646,39 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char*
switch(FormatChar)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
BASE_TYPE_UNMARSHALL(UCHAR);
TRACE("value: 0x%02x\n", *pMemory);
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
BASE_TYPE_UNMARSHALL(USHORT);
TRACE("value: 0x%04x\n", *(USHORT *)pMemory);
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ERROR_STATUS_T:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ERROR_STATUS_T:
+ case FC_ENUM32:
BASE_TYPE_UNMARSHALL(ULONG);
TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
break;
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
BASE_TYPE_UNMARSHALL(float);
TRACE("value: %f\n", *(float *)pMemory);
break;
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
BASE_TYPE_UNMARSHALL(double);
TRACE("value: %f\n", *(double *)pMemory);
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
BASE_TYPE_UNMARSHALL(ULONGLONG);
TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG *)pMemory));
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
TRACE("pMemory: %p\n", pMemory);
/* 16-bits on the wire, but int in memory */
@@ -1688,21 +1686,21 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char*
pStubMsg->Buffer += sizeof(USHORT);
TRACE("value: 0x%08x\n", *(UINT *)pMemory);
break;
- case RPC_FC_INT3264:
+ case FC_INT3264:
align_pointer(&pStubMsg->Buffer, sizeof(INT));
/* 32-bits on the wire, but int_ptr in memory */
*(INT_PTR *)pMemory = *(INT *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(INT);
TRACE("value: 0x%08lx\n", *(INT_PTR *)pMemory);
break;
- case RPC_FC_UINT3264:
+ case FC_UINT3264:
align_pointer(&pStubMsg->Buffer, sizeof(UINT));
/* 32-bits on the wire, but int_ptr in memory */
*(UINT_PTR *)pMemory = *(UINT *)pStubMsg->Buffer;
pStubMsg->Buffer += sizeof(UINT);
TRACE("value: 0x%08lx\n", *(UINT_PTR *)pMemory);
break;
- case RPC_FC_IGNORE:
+ case FC_IGNORE:
break;
default:
FIXME("Unhandled base type: 0x%02x\n", FormatChar);
@@ -1725,7 +1723,7 @@ unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->BufferMark = pStubMsg->Buffer;
safe_copy_to_buffer(pStubMsg, pMemory, size);
- if (pFormat[0] != RPC_FC_STRUCT)
+ if (pFormat[0] != FC_STRUCT)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat+4);
return NULL;
@@ -1756,7 +1754,7 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, size);
- if (pFormat[0] == RPC_FC_PSTRUCT)
+ if (pFormat[0] == FC_PSTRUCT)
EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat+4, fMustAlloc);
TRACE("copying %p to %p\n", saved_buffer, *ppMemory);
@@ -1779,7 +1777,7 @@ void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
align_length(&pStubMsg->BufferLength, pFormat[1] + 1);
safe_buffer_length_increment(pStubMsg, size);
- if (pFormat[0] != RPC_FC_STRUCT)
+ if (pFormat[0] != FC_STRUCT)
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat+4);
}
@@ -1797,7 +1795,7 @@ ULONG WINAPI NdrSimpleStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->MemorySize += size;
safe_buffer_increment(pStubMsg, size);
- if (pFormat[0] != RPC_FC_STRUCT)
+ if (pFormat[0] != FC_STRUCT)
EmbeddedPointerMemorySize(pStubMsg, pFormat+4);
return pStubMsg->MemorySize;
}
@@ -1810,7 +1808,7 @@ void WINAPI NdrSimpleStructFree(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_STRUCT)
+ if (pFormat[0] != FC_STRUCT)
EmbeddedPointerFree(pStubMsg, pMemory, pFormat+4);
}
@@ -1824,18 +1822,18 @@ static inline void array_compute_and_size_conformance(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
SizeConformance(pStubMsg);
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, 0);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
SizeConformance(pStubMsg);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
{
TRACE("string=%s\n", debugstr_a((const char *)pMemory));
pStubMsg->ActualCount = strlen((const char *)pMemory)+1;
@@ -1846,14 +1844,14 @@ static inline void array_compute_and_size_conformance(
pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
}
- if (pFormat[1] == RPC_FC_STRING_SIZED)
+ if (pFormat[1] == FC_STRING_SIZED)
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
SizeConformance(pStubMsg);
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
count = *(const WORD *)(pFormat + 2);
pFormat += 4;
if (IsConformanceOrVariancePresent(pFormat)) SizeConformance(pStubMsg);
@@ -1876,7 +1874,7 @@ static inline void array_buffer_size(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -1891,7 +1889,7 @@ static inline void array_buffer_size(
if (fHasPointers)
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -1908,9 +1906,9 @@ static inline void array_buffer_size(
if (fHasPointers)
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
esize = 1;
else
esize = 2;
@@ -1920,7 +1918,7 @@ static inline void array_buffer_size(
size = safe_multiply(esize, pStubMsg->ActualCount);
safe_buffer_length_increment(pStubMsg, size);
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
alignment = pFormat[1] + 1;
pFormat = SkipConformance(pStubMsg, pFormat + 4);
if (IsConformanceOrVariancePresent(pFormat)) SizeVariance(pStubMsg);
@@ -1947,18 +1945,18 @@ static inline void array_compute_and_write_conformance(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
WriteConformance(pStubMsg);
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, 0);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
WriteConformance(pStubMsg);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
{
TRACE("string=%s\n", debugstr_a((const char *)pMemory));
pStubMsg->ActualCount = strlen((const char *)pMemory)+1;
@@ -1968,14 +1966,14 @@ static inline void array_compute_and_write_conformance(
TRACE("string=%s\n", debugstr_w((LPCWSTR)pMemory));
pStubMsg->ActualCount = strlenW((LPCWSTR)pMemory)+1;
}
- if (pFormat[1] == RPC_FC_STRING_SIZED)
+ if (pFormat[1] == FC_STRING_SIZED)
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 2, 0);
else
pStubMsg->MaxCount = pStubMsg->ActualCount;
pStubMsg->Offset = 0;
WriteConformance(pStubMsg);
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
def = *(const WORD *)(pFormat + 2);
pFormat += 4;
conformance_present = IsConformanceOrVariancePresent(pFormat);
@@ -1999,7 +1997,7 @@ static inline void array_write_variance_and_marshall(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -2015,7 +2013,7 @@ static inline void array_write_variance_and_marshall(
if (fHasPointers)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -2035,9 +2033,9 @@ static inline void array_write_variance_and_marshall(
if (fHasPointers)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
esize = 1;
else
esize = 2;
@@ -2047,7 +2045,7 @@ static inline void array_write_variance_and_marshall(
size = safe_multiply(esize, pStubMsg->ActualCount);
safe_copy_to_buffer(pStubMsg, pMemory, size); /* the string itself */
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
alignment = pFormat[1] + 1;
pFormat = SkipConformance(pStubMsg, pFormat + 4);
if (IsConformanceOrVariancePresent(pFormat)) WriteVariance(pStubMsg);
@@ -2072,27 +2070,27 @@ static inline ULONG array_read_conformance(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
esize = *(const WORD*)(pFormat+2);
pFormat = ReadConformance(pStubMsg, pFormat+4);
return safe_multiply(esize, pStubMsg->MaxCount);
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
esize = *(const WORD*)(pFormat+2);
pFormat = ReadConformance(pStubMsg, pFormat+4);
return safe_multiply(esize, pStubMsg->MaxCount);
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
esize = 1;
else
esize = 2;
- if (pFormat[1] == RPC_FC_STRING_SIZED)
+ if (pFormat[1] == FC_STRING_SIZED)
ReadConformance(pStubMsg, pFormat + 2);
else
ReadConformance(pStubMsg, NULL);
return safe_multiply(esize, pStubMsg->MaxCount);
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
def = *(const WORD *)(pFormat + 2);
pFormat += 4;
if (IsConformanceOrVariancePresent(pFormat)) pFormat = ReadConformance(pStubMsg, pFormat);
@@ -2124,7 +2122,7 @@ static inline ULONG array_read_variance_and_unmarshall(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -2156,7 +2154,7 @@ static inline ULONG array_read_variance_and_unmarshall(
memcpy(*ppMemory, saved_buffer, bufsize);
}
return bufsize;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -2187,16 +2185,16 @@ static inline ULONG array_read_variance_and_unmarshall(
memcpy(*ppMemory + offset, saved_buffer, bufsize);
}
return bufsize;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
esize = 1;
else
esize = 2;
ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount);
- if (pFormat[1] != RPC_FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
+ if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
{
ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
pStubMsg->ActualCount, pStubMsg->MaxCount);
@@ -2233,14 +2231,14 @@ static inline ULONG array_read_variance_and_unmarshall(
else
safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
- if (*pFormat == RPC_FC_C_CSTRING)
+ if (*pFormat == FC_C_CSTRING)
TRACE("string=%s\n", debugstr_a((char*)*ppMemory));
else
TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory));
}
return bufsize;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
alignment = pFormat[1] + 1;
pFormat = SkipConformance(pStubMsg, pFormat + 4);
pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
@@ -2281,7 +2279,7 @@ static inline void array_memory_size(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -2298,7 +2296,7 @@ static inline void array_memory_size(
if (fHasPointers)
EmbeddedPointerMemorySize(pStubMsg, pFormat);
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
esize = *(const WORD*)(pFormat+2);
alignment = pFormat[1] + 1;
@@ -2318,16 +2316,16 @@ static inline void array_memory_size(
if (fHasPointers)
EmbeddedPointerMemorySize(pStubMsg, pFormat);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (fc == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (fc == FC_C_CSTRING)
esize = 1;
else
esize = 2;
ReadVariance(pStubMsg, NULL, pStubMsg->MaxCount);
- if (pFormat[1] != RPC_FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
+ if (pFormat[1] != FC_STRING_SIZED && (pStubMsg->MaxCount != pStubMsg->ActualCount))
{
ERR("buffer size %d must equal memory size %ld for non-sized conformant strings\n",
pStubMsg->ActualCount, pStubMsg->MaxCount);
@@ -2347,7 +2345,7 @@ static inline void array_memory_size(
safe_buffer_increment(pStubMsg, bufsize);
pStubMsg->MemorySize += memsize;
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
alignment = pFormat[1] + 1;
pFormat = SkipConformance(pStubMsg, pFormat + 4);
pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount);
@@ -2379,22 +2377,22 @@ static inline void array_free(
switch (fc)
{
- case RPC_FC_CARRAY:
+ case FC_CARRAY:
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
if (fHasPointers)
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
break;
- case RPC_FC_CVARRAY:
+ case FC_CVARRAY:
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat+4, 0);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, 0);
if (fHasPointers)
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
/* No embedded pointers so nothing to do */
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
count = *(const WORD *)(pFormat + 2);
pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, count);
pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount);
@@ -2434,22 +2432,22 @@ unsigned char *WINAPI NdrConformantStringMarshall(MIDL_STUB_MESSAGE *pStubMsg,
{
TRACE("(pStubMsg == ^%p, pszMessage == ^%p, pFormat == ^%p)\n", pStubMsg, pszMessage, pFormat);
- if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) {
+ if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) {
ERR("Unhandled string type: %#x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
/* allow compiler to optimise inline function by passing constant into
* these functions */
- if (pFormat[0] == RPC_FC_C_CSTRING) {
- array_compute_and_write_conformance(RPC_FC_C_CSTRING, pStubMsg, pszMessage,
+ if (pFormat[0] == FC_C_CSTRING) {
+ array_compute_and_write_conformance(FC_C_CSTRING, pStubMsg, pszMessage,
pFormat);
- array_write_variance_and_marshall(RPC_FC_C_CSTRING, pStubMsg, pszMessage,
+ array_write_variance_and_marshall(FC_C_CSTRING, pStubMsg, pszMessage,
pFormat, TRUE /* fHasPointers */);
} else {
- array_compute_and_write_conformance(RPC_FC_C_WSTRING, pStubMsg, pszMessage,
+ array_compute_and_write_conformance(FC_C_WSTRING, pStubMsg, pszMessage,
pFormat);
- array_write_variance_and_marshall(RPC_FC_C_WSTRING, pStubMsg, pszMessage,
+ array_write_variance_and_marshall(FC_C_WSTRING, pStubMsg, pszMessage,
pFormat, TRUE /* fHasPointers */);
}
@@ -2464,22 +2462,22 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
{
TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) {
+ if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) {
ERR("Unhandled string type: %#x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
/* allow compiler to optimise inline function by passing constant into
* these functions */
- if (pFormat[0] == RPC_FC_C_CSTRING) {
- array_compute_and_size_conformance(RPC_FC_C_CSTRING, pStubMsg, pMemory,
+ if (pFormat[0] == FC_C_CSTRING) {
+ array_compute_and_size_conformance(FC_C_CSTRING, pStubMsg, pMemory,
pFormat);
- array_buffer_size(RPC_FC_C_CSTRING, pStubMsg, pMemory, pFormat,
+ array_buffer_size(FC_C_CSTRING, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
} else {
- array_compute_and_size_conformance(RPC_FC_C_WSTRING, pStubMsg, pMemory,
+ array_compute_and_size_conformance(FC_C_WSTRING, pStubMsg, pMemory,
pFormat);
- array_buffer_size(RPC_FC_C_WSTRING, pStubMsg, pMemory, pFormat,
+ array_buffer_size(FC_C_WSTRING, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
}
}
@@ -2492,20 +2490,20 @@ ULONG WINAPI NdrConformantStringMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
{
TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat);
- if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) {
+ if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) {
ERR("Unhandled string type: %#x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
/* allow compiler to optimise inline function by passing constant into
* these functions */
- if (pFormat[0] == RPC_FC_C_CSTRING) {
- array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat);
- array_memory_size(RPC_FC_C_CSTRING, pStubMsg, pFormat,
+ if (pFormat[0] == FC_C_CSTRING) {
+ array_read_conformance(FC_C_CSTRING, pStubMsg, pFormat);
+ array_memory_size(FC_C_CSTRING, pStubMsg, pFormat,
TRUE /* fHasPointers */);
} else {
- array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat);
- array_memory_size(RPC_FC_C_WSTRING, pStubMsg, pFormat,
+ array_read_conformance(FC_C_WSTRING, pStubMsg, pFormat);
+ array_memory_size(FC_C_WSTRING, pStubMsg, pFormat,
TRUE /* fHasPointers */);
}
@@ -2521,22 +2519,22 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n",
pStubMsg, *ppMemory, pFormat, fMustAlloc);
- if (pFormat[0] != RPC_FC_C_CSTRING && pFormat[0] != RPC_FC_C_WSTRING) {
+ if (pFormat[0] != FC_C_CSTRING && pFormat[0] != FC_C_WSTRING) {
ERR("Unhandled string type: %#x\n", *pFormat);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
/* allow compiler to optimise inline function by passing constant into
* these functions */
- if (pFormat[0] == RPC_FC_C_CSTRING) {
- array_read_conformance(RPC_FC_C_CSTRING, pStubMsg, pFormat);
- array_read_variance_and_unmarshall(RPC_FC_C_CSTRING, pStubMsg, ppMemory,
+ if (pFormat[0] == FC_C_CSTRING) {
+ array_read_conformance(FC_C_CSTRING, pStubMsg, pFormat);
+ array_read_variance_and_unmarshall(FC_C_CSTRING, pStubMsg, ppMemory,
pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
} else {
- array_read_conformance(RPC_FC_C_WSTRING, pStubMsg, pFormat);
- array_read_variance_and_unmarshall(RPC_FC_C_WSTRING, pStubMsg, ppMemory,
+ array_read_conformance(FC_C_WSTRING, pStubMsg, pFormat);
+ array_read_variance_and_unmarshall(FC_C_WSTRING, pStubMsg, ppMemory,
pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
@@ -2558,7 +2556,7 @@ unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubM
maxsize = *(const USHORT *)&pFormat[2];
- if (*pFormat == RPC_FC_CSTRING)
+ if (*pFormat == FC_CSTRING)
{
ULONG i = 0;
const char *str = (const char *)pMemory;
@@ -2567,7 +2565,7 @@ unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubM
pStubMsg->ActualCount = i + 1;
esize = 1;
}
- else if (*pFormat == RPC_FC_WSTRING)
+ else if (*pFormat == FC_WSTRING)
{
ULONG i = 0;
const WCHAR *str = (const WCHAR *)pMemory;
@@ -2613,8 +2611,8 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu
RpcRaiseException(RPC_S_INVALID_BOUND);
}
- if (*pFormat == RPC_FC_CSTRING) esize = 1;
- else if (*pFormat == RPC_FC_WSTRING) esize = 2;
+ if (*pFormat == FC_CSTRING) esize = 1;
+ else if (*pFormat == FC_WSTRING) esize = 2;
else
{
ERR("Unhandled string type: %#x\n", *pFormat);
@@ -2633,10 +2631,10 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu
safe_copy_from_buffer(pStubMsg, *ppMemory, bufsize);
- if (*pFormat == RPC_FC_CSTRING) {
+ if (*pFormat == FC_CSTRING) {
TRACE("string=%s\n", debugstr_an((char*)*ppMemory, pStubMsg->ActualCount));
}
- else if (*pFormat == RPC_FC_WSTRING) {
+ else if (*pFormat == FC_WSTRING) {
TRACE("string=%s\n", debugstr_wn((LPWSTR)*ppMemory, pStubMsg->ActualCount));
}
@@ -2658,7 +2656,7 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
SizeVariance(pStubMsg);
- if (*pFormat == RPC_FC_CSTRING)
+ if (*pFormat == FC_CSTRING)
{
ULONG i = 0;
const char *str = (const char *)pMemory;
@@ -2667,7 +2665,7 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->ActualCount = i + 1;
esize = 1;
}
- else if (*pFormat == RPC_FC_WSTRING)
+ else if (*pFormat == FC_WSTRING)
{
ULONG i = 0;
const WCHAR *str = (const WCHAR *)pMemory;
@@ -2705,8 +2703,8 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
RpcRaiseException(RPC_S_INVALID_BOUND);
}
- if (*pFormat == RPC_FC_CSTRING) esize = 1;
- else if (*pFormat == RPC_FC_WSTRING) esize = 2;
+ if (*pFormat == FC_CSTRING) esize = 1;
+ else if (*pFormat == FC_WSTRING) esize = 2;
else
{
ERR("Unhandled string type: %#x\n", *pFormat);
@@ -2740,54 +2738,54 @@ static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg,
PFORMAT_STRING pFormat)
{
switch (*pFormat) {
- case RPC_FC_STRUCT:
- case RPC_FC_PSTRUCT:
- case RPC_FC_CSTRUCT:
- case RPC_FC_BOGUS_STRUCT:
- case RPC_FC_SMFARRAY:
- case RPC_FC_SMVARRAY:
- case RPC_FC_CSTRING:
+ case FC_STRUCT:
+ case FC_PSTRUCT:
+ case FC_CSTRUCT:
+ case FC_BOGUS_STRUCT:
+ case FC_SMFARRAY:
+ case FC_SMVARRAY:
+ case FC_CSTRING:
return *(const WORD*)&pFormat[2];
- case RPC_FC_USER_MARSHAL:
+ case FC_USER_MARSHAL:
return *(const WORD*)&pFormat[4];
- case RPC_FC_RANGE: {
+ case FC_RANGE: {
switch (((const NDR_RANGE *)pFormat)->flags_type & 0xf) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
return sizeof(UCHAR);
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
return sizeof(USHORT);
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
+ case FC_INT3264:
+ case FC_UINT3264:
return sizeof(ULONG);
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
return sizeof(float);
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
return sizeof(double);
- case RPC_FC_HYPER:
+ case FC_HYPER:
return sizeof(ULONGLONG);
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
return sizeof(UINT);
default:
ERR("unknown type 0x%x\n", ((const NDR_RANGE *)pFormat)->flags_type & 0xf);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
}
- case RPC_FC_NON_ENCAPSULATED_UNION:
+ case FC_NON_ENCAPSULATED_UNION:
pFormat += 2;
pFormat = SkipConformance(pStubMsg, pFormat);
pFormat += *(const SHORT*)pFormat;
return *(const SHORT*)pFormat;
- case RPC_FC_IP:
+ case FC_IP:
return sizeof(void *);
- case RPC_FC_WSTRING:
+ case FC_WSTRING:
return *(const WORD*)&pFormat[2] * 2;
default:
FIXME("unhandled embedded type %02x\n", *pFormat);
@@ -2820,24 +2818,24 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_MARSHALL m;
ULONG size;
- while (*pFormat != RPC_FC_END) {
+ while (*pFormat != FC_END) {
switch (*pFormat) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
TRACE("byte=%d <= %p\n", *(WORD*)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, 1);
pMemory += 1;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
TRACE("short=%d <= %p\n", *(WORD*)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, 2);
pMemory += 2;
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
{
USHORT val = *(DWORD *)pMemory;
TRACE("enum16=%d <= %p\n", *(DWORD*)pMemory, pMemory);
@@ -2847,15 +2845,15 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += 4;
break;
}
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
TRACE("long=%d <= %p\n", *(DWORD*)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, 4);
pMemory += 4;
break;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
{
UINT val = *(UINT_PTR *)pMemory;
TRACE("int3264=%ld <= %p\n", *(UINT_PTR *)pMemory, pMemory);
@@ -2863,34 +2861,34 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += sizeof(UINT_PTR);
break;
}
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
TRACE("float=%f <= %p\n", *(float*)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float));
pMemory += sizeof(float);
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
TRACE("longlong=%s <= %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, 8);
pMemory += 8;
break;
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
TRACE("double=%f <= %p\n", *(double*)pMemory, pMemory);
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double));
pMemory += sizeof(double);
break;
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
- case RPC_FC_POINTER:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
+ case FC_POINTER:
{
unsigned char *saved_buffer;
BOOL pointer_buffer_mark_set = FALSE;
TRACE("pointer=%p <= %p\n", *(unsigned char**)pMemory, pMemory);
TRACE("pStubMsg->Buffer before %p\n", pStubMsg->Buffer);
- if (*pFormat != RPC_FC_POINTER)
+ if (*pFormat != FC_POINTER)
pPointer = pFormat;
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
align_pointer_clear(&pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
if (pStubMsg->PointerBufferMark)
@@ -2899,7 +2897,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerBufferMark = NULL;
pointer_buffer_mark_set = TRUE;
}
- else if (*pPointer != RPC_FC_RP)
+ else if (*pPointer != FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
PointerMarshall(pStubMsg, saved_buffer, *(unsigned char**)pMemory, pPointer);
if (pointer_buffer_mark_set)
@@ -2907,36 +2905,36 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
STD_OVERFLOW_CHECK(pStubMsg);
pStubMsg->PointerBufferMark = pStubMsg->Buffer;
pStubMsg->Buffer = saved_buffer;
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
}
TRACE("pStubMsg->Buffer after %p\n", pStubMsg->Buffer);
- if (*pFormat == RPC_FC_POINTER)
+ if (*pFormat == FC_POINTER)
pPointer += 4;
else
pFormat += 4;
pMemory += sizeof(void *);
break;
}
- case RPC_FC_ALIGNM2:
+ case FC_ALIGNM2:
align_pointer(&pMemory, 2);
break;
- case RPC_FC_ALIGNM4:
+ case FC_ALIGNM4:
align_pointer(&pMemory, 4);
break;
- case RPC_FC_ALIGNM8:
+ case FC_ALIGNM8:
align_pointer(&pMemory, 8);
break;
- case RPC_FC_STRUCTPAD1:
- case RPC_FC_STRUCTPAD2:
- case RPC_FC_STRUCTPAD3:
- case RPC_FC_STRUCTPAD4:
- case RPC_FC_STRUCTPAD5:
- case RPC_FC_STRUCTPAD6:
- case RPC_FC_STRUCTPAD7:
- pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
+ case FC_STRUCTPAD1:
+ case FC_STRUCTPAD2:
+ case FC_STRUCTPAD3:
+ case FC_STRUCTPAD4:
+ case FC_STRUCTPAD5:
+ case FC_STRUCTPAD6:
+ case FC_STRUCTPAD7:
+ pMemory += *pFormat - FC_STRUCTPAD1 + 1;
break;
- case RPC_FC_EMBEDDED_COMPLEX:
+ case FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
@@ -2946,10 +2944,10 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (m)
{
/* for some reason interface pointers aren't generated as
- * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet
+ * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
* they still need the dereferencing treatment that pointers are
* given */
- if (*desc == RPC_FC_IP)
+ if (*desc == FC_IP)
m(pStubMsg, *(unsigned char **)pMemory, desc);
else
m(pStubMsg, pMemory, desc);
@@ -2958,7 +2956,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += size;
pFormat += 2;
continue;
- case RPC_FC_PAD:
+ case FC_PAD:
break;
default:
FIXME("unhandled format 0x%02x\n", *pFormat);
@@ -2979,24 +2977,24 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
NDR_UNMARSHALL m;
ULONG size;
- while (*pFormat != RPC_FC_END) {
+ while (*pFormat != FC_END) {
switch (*pFormat) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
safe_copy_from_buffer(pStubMsg, pMemory, 1);
TRACE("byte=%d => %p\n", *(WORD*)pMemory, pMemory);
pMemory += 1;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
safe_copy_from_buffer(pStubMsg, pMemory, 2);
TRACE("short=%d => %p\n", *(WORD*)pMemory, pMemory);
pMemory += 2;
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
{
WORD val;
safe_copy_from_buffer(pStubMsg, &val, 2);
@@ -3007,14 +3005,14 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += 4;
break;
}
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
safe_copy_from_buffer(pStubMsg, pMemory, 4);
TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory);
pMemory += 4;
break;
- case RPC_FC_INT3264:
+ case FC_INT3264:
{
INT val;
safe_copy_from_buffer(pStubMsg, &val, 4);
@@ -3023,7 +3021,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += sizeof(INT_PTR);
break;
}
- case RPC_FC_UINT3264:
+ case FC_UINT3264:
{
UINT val;
safe_copy_from_buffer(pStubMsg, &val, 4);
@@ -3032,33 +3030,33 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += sizeof(UINT_PTR);
break;
}
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
safe_copy_from_buffer(pStubMsg, pMemory, sizeof(float));
TRACE("float=%f => %p\n", *(float*)pMemory, pMemory);
pMemory += sizeof(float);
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
safe_copy_from_buffer(pStubMsg, pMemory, 8);
TRACE("longlong=%s => %p\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory), pMemory);
pMemory += 8;
break;
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
safe_copy_from_buffer(pStubMsg, pMemory, sizeof(double));
TRACE("double=%f => %p\n", *(double*)pMemory, pMemory);
pMemory += sizeof(double);
break;
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
- case RPC_FC_POINTER:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
+ case FC_POINTER:
{
unsigned char *saved_buffer;
BOOL pointer_buffer_mark_set = FALSE;
TRACE("pointer => %p\n", pMemory);
- if (*pFormat != RPC_FC_POINTER)
+ if (*pFormat != FC_POINTER)
pPointer = pFormat;
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
align_pointer(&pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
if (pStubMsg->PointerBufferMark)
@@ -3067,7 +3065,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerBufferMark = NULL;
pointer_buffer_mark_set = TRUE;
}
- else if (*pPointer != RPC_FC_RP)
+ else if (*pPointer != FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
PointerUnmarshall(pStubMsg, saved_buffer, (unsigned char**)pMemory, *(unsigned char**)pMemory, pPointer, fMustAlloc);
@@ -3076,36 +3074,36 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
STD_OVERFLOW_CHECK(pStubMsg);
pStubMsg->PointerBufferMark = pStubMsg->Buffer;
pStubMsg->Buffer = saved_buffer;
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
}
- if (*pFormat == RPC_FC_POINTER)
+ if (*pFormat == FC_POINTER)
pPointer += 4;
else
pFormat += 4;
pMemory += sizeof(void *);
break;
}
- case RPC_FC_ALIGNM2:
+ case FC_ALIGNM2:
align_pointer_clear(&pMemory, 2);
break;
- case RPC_FC_ALIGNM4:
+ case FC_ALIGNM4:
align_pointer_clear(&pMemory, 4);
break;
- case RPC_FC_ALIGNM8:
+ case FC_ALIGNM8:
align_pointer_clear(&pMemory, 8);
break;
- case RPC_FC_STRUCTPAD1:
- case RPC_FC_STRUCTPAD2:
- case RPC_FC_STRUCTPAD3:
- case RPC_FC_STRUCTPAD4:
- case RPC_FC_STRUCTPAD5:
- case RPC_FC_STRUCTPAD6:
- case RPC_FC_STRUCTPAD7:
- memset(pMemory, 0, *pFormat - RPC_FC_STRUCTPAD1 + 1);
- pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
+ case FC_STRUCTPAD1:
+ case FC_STRUCTPAD2:
+ case FC_STRUCTPAD3:
+ case FC_STRUCTPAD4:
+ case FC_STRUCTPAD5:
+ case FC_STRUCTPAD6:
+ case FC_STRUCTPAD7:
+ memset(pMemory, 0, *pFormat - FC_STRUCTPAD1 + 1);
+ pMemory += *pFormat - FC_STRUCTPAD1 + 1;
break;
- case RPC_FC_EMBEDDED_COMPLEX:
+ case FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
@@ -3122,10 +3120,10 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (m)
{
/* for some reason interface pointers aren't generated as
- * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet
+ * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
* they still need the dereferencing treatment that pointers are
* given */
- if (*desc == RPC_FC_IP)
+ if (*desc == FC_IP)
m(pStubMsg, (unsigned char **)pMemory, desc, FALSE);
else
m(pStubMsg, &pMemory, desc, FALSE);
@@ -3134,7 +3132,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += size;
pFormat += 2;
continue;
- case RPC_FC_PAD:
+ case FC_PAD:
break;
default:
FIXME("unhandled format %d\n", *pFormat);
@@ -3154,48 +3152,48 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
NDR_BUFFERSIZE m;
ULONG size;
- while (*pFormat != RPC_FC_END) {
+ while (*pFormat != FC_END) {
switch (*pFormat) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
safe_buffer_length_increment(pStubMsg, 1);
pMemory += 1;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
safe_buffer_length_increment(pStubMsg, 2);
pMemory += 2;
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
safe_buffer_length_increment(pStubMsg, 2);
pMemory += 4;
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
- case RPC_FC_FLOAT:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
+ case FC_FLOAT:
safe_buffer_length_increment(pStubMsg, 4);
pMemory += 4;
break;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
safe_buffer_length_increment(pStubMsg, 4);
pMemory += sizeof(INT_PTR);
break;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
safe_buffer_length_increment(pStubMsg, 8);
pMemory += 8;
break;
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
- case RPC_FC_POINTER:
- if (*pFormat != RPC_FC_POINTER)
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
+ case FC_POINTER:
+ if (*pFormat != FC_POINTER)
pPointer = pFormat;
if (!pStubMsg->IgnoreEmbeddedPointers)
{
@@ -3208,36 +3206,36 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerLength = pStubMsg->BufferLength;
pStubMsg->BufferLength = saved_buffer_length;
}
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
{
align_length(&pStubMsg->BufferLength, 4);
safe_buffer_length_increment(pStubMsg, 4);
}
- if (*pFormat == RPC_FC_POINTER)
+ if (*pFormat == FC_POINTER)
pPointer += 4;
else
pFormat += 4;
pMemory += sizeof(void*);
break;
- case RPC_FC_ALIGNM2:
+ case FC_ALIGNM2:
align_pointer(&pMemory, 2);
break;
- case RPC_FC_ALIGNM4:
+ case FC_ALIGNM4:
align_pointer(&pMemory, 4);
break;
- case RPC_FC_ALIGNM8:
+ case FC_ALIGNM8:
align_pointer(&pMemory, 8);
break;
- case RPC_FC_STRUCTPAD1:
- case RPC_FC_STRUCTPAD2:
- case RPC_FC_STRUCTPAD3:
- case RPC_FC_STRUCTPAD4:
- case RPC_FC_STRUCTPAD5:
- case RPC_FC_STRUCTPAD6:
- case RPC_FC_STRUCTPAD7:
- pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
+ case FC_STRUCTPAD1:
+ case FC_STRUCTPAD2:
+ case FC_STRUCTPAD3:
+ case FC_STRUCTPAD4:
+ case FC_STRUCTPAD5:
+ case FC_STRUCTPAD6:
+ case FC_STRUCTPAD7:
+ pMemory += *pFormat - FC_STRUCTPAD1 + 1;
break;
- case RPC_FC_EMBEDDED_COMPLEX:
+ case FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
@@ -3246,10 +3244,10 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
if (m)
{
/* for some reason interface pointers aren't generated as
- * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet
+ * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
* they still need the dereferencing treatment that pointers are
* given */
- if (*desc == RPC_FC_IP)
+ if (*desc == FC_IP)
m(pStubMsg, *(unsigned char **)pMemory, desc);
else
m(pStubMsg, pMemory, desc);
@@ -3258,7 +3256,7 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += size;
pFormat += 2;
continue;
- case RPC_FC_PAD:
+ case FC_PAD:
break;
default:
FIXME("unhandled format 0x%02x\n", *pFormat);
@@ -3278,67 +3276,67 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
NDR_FREE m;
ULONG size;
- while (*pFormat != RPC_FC_END) {
+ while (*pFormat != FC_END) {
switch (*pFormat) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
pMemory += 1;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
pMemory += 2;
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM16:
- case RPC_FC_ENUM32:
- case RPC_FC_FLOAT:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM16:
+ case FC_ENUM32:
+ case FC_FLOAT:
pMemory += 4;
break;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
pMemory += sizeof(INT_PTR);
break;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
pMemory += 8;
break;
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
- case RPC_FC_POINTER:
- if (*pFormat != RPC_FC_POINTER)
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
+ case FC_POINTER:
+ if (*pFormat != FC_POINTER)
pPointer = pFormat;
NdrPointerFree(pStubMsg, *(unsigned char**)pMemory, pPointer);
- if (*pFormat == RPC_FC_POINTER)
+ if (*pFormat == FC_POINTER)
pPointer += 4;
else
pFormat += 4;
pMemory += sizeof(void *);
break;
- case RPC_FC_ALIGNM2:
+ case FC_ALIGNM2:
align_pointer(&pMemory, 2);
break;
- case RPC_FC_ALIGNM4:
+ case FC_ALIGNM4:
align_pointer(&pMemory, 4);
break;
- case RPC_FC_ALIGNM8:
+ case FC_ALIGNM8:
align_pointer(&pMemory, 8);
break;
- case RPC_FC_STRUCTPAD1:
- case RPC_FC_STRUCTPAD2:
- case RPC_FC_STRUCTPAD3:
- case RPC_FC_STRUCTPAD4:
- case RPC_FC_STRUCTPAD5:
- case RPC_FC_STRUCTPAD6:
- case RPC_FC_STRUCTPAD7:
- pMemory += *pFormat - RPC_FC_STRUCTPAD1 + 1;
+ case FC_STRUCTPAD1:
+ case FC_STRUCTPAD2:
+ case FC_STRUCTPAD3:
+ case FC_STRUCTPAD4:
+ case FC_STRUCTPAD5:
+ case FC_STRUCTPAD6:
+ case FC_STRUCTPAD7:
+ pMemory += *pFormat - FC_STRUCTPAD1 + 1;
break;
- case RPC_FC_EMBEDDED_COMPLEX:
+ case FC_EMBEDDED_COMPLEX:
pMemory += pFormat[1];
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
@@ -3347,10 +3345,10 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
if (m)
{
/* for some reason interface pointers aren't generated as
- * RPC_FC_POINTER, but instead as RPC_FC_EMBEDDED_COMPLEX, yet
+ * FC_POINTER, but instead as FC_EMBEDDED_COMPLEX, yet
* they still need the dereferencing treatment that pointers are
* given */
- if (*desc == RPC_FC_IP)
+ if (*desc == FC_IP)
m(pStubMsg, *(unsigned char **)pMemory, desc);
else
m(pStubMsg, pMemory, desc);
@@ -3358,7 +3356,7 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg,
pMemory += size;
pFormat += 2;
continue;
- case RPC_FC_PAD:
+ case FC_PAD:
break;
default:
FIXME("unhandled format 0x%02x\n", *pFormat);
@@ -3376,53 +3374,53 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING desc;
ULONG size = 0;
- while (*pFormat != RPC_FC_END) {
+ while (*pFormat != FC_END) {
switch (*pFormat) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
size += 1;
safe_buffer_increment(pStubMsg, 1);
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
size += 2;
safe_buffer_increment(pStubMsg, 2);
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
size += 4;
safe_buffer_increment(pStubMsg, 2);
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
- case RPC_FC_FLOAT:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
+ case FC_FLOAT:
size += 4;
safe_buffer_increment(pStubMsg, 4);
break;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
size += sizeof(INT_PTR);
safe_buffer_increment(pStubMsg, 4);
break;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
size += 8;
safe_buffer_increment(pStubMsg, 8);
break;
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
- case RPC_FC_POINTER:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
+ case FC_POINTER:
{
unsigned char *saved_buffer;
BOOL pointer_buffer_mark_set = FALSE;
- if (*pFormat != RPC_FC_POINTER)
+ if (*pFormat != FC_POINTER)
pPointer = pFormat;
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
align_pointer(&pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
if (pStubMsg->PointerBufferMark)
@@ -3431,7 +3429,7 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->PointerBufferMark = NULL;
pointer_buffer_mark_set = TRUE;
}
- else if (*pPointer != RPC_FC_RP)
+ else if (*pPointer != FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
if (!pStubMsg->IgnoreEmbeddedPointers)
@@ -3441,42 +3439,42 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
STD_OVERFLOW_CHECK(pStubMsg);
pStubMsg->PointerBufferMark = pStubMsg->Buffer;
pStubMsg->Buffer = saved_buffer;
- if (*pPointer != RPC_FC_RP)
+ if (*pPointer != FC_RP)
safe_buffer_increment(pStubMsg, 4); /* for pointer ID */
}
- if (*pFormat == RPC_FC_POINTER)
+ if (*pFormat == FC_POINTER)
pPointer += 4;
else
pFormat += 4;
size += sizeof(void *);
break;
}
- case RPC_FC_ALIGNM2:
+ case FC_ALIGNM2:
align_length(&size, 2);
break;
- case RPC_FC_ALIGNM4:
+ case FC_ALIGNM4:
align_length(&size, 4);
break;
- case RPC_FC_ALIGNM8:
+ case FC_ALIGNM8:
align_length(&size, 8);
break;
- case RPC_FC_STRUCTPAD1:
- case RPC_FC_STRUCTPAD2:
- case RPC_FC_STRUCTPAD3:
- case RPC_FC_STRUCTPAD4:
- case RPC_FC_STRUCTPAD5:
- case RPC_FC_STRUCTPAD6:
- case RPC_FC_STRUCTPAD7:
- size += *pFormat - RPC_FC_STRUCTPAD1 + 1;
+ case FC_STRUCTPAD1:
+ case FC_STRUCTPAD2:
+ case FC_STRUCTPAD3:
+ case FC_STRUCTPAD4:
+ case FC_STRUCTPAD5:
+ case FC_STRUCTPAD6:
+ case FC_STRUCTPAD7:
+ size += *pFormat - FC_STRUCTPAD1 + 1;
break;
- case RPC_FC_EMBEDDED_COMPLEX:
+ case FC_EMBEDDED_COMPLEX:
size += pFormat[1];
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
size += EmbeddedComplexMemorySize(pStubMsg, desc);
pFormat += 2;
continue;
- case RPC_FC_PAD:
+ case FC_PAD:
break;
default:
FIXME("unhandled format 0x%02x\n", *pFormat);
@@ -3492,69 +3490,69 @@ ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
PFORMAT_STRING desc;
ULONG size = 0;
- while (*pFormat != RPC_FC_END) {
+ while (*pFormat != FC_END) {
switch (*pFormat) {
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
size += 1;
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
size += 2;
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM16:
- case RPC_FC_ENUM32:
- case RPC_FC_FLOAT:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM16:
+ case FC_ENUM32:
+ case FC_FLOAT:
size += 4;
break;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
size += sizeof(INT_PTR);
break;
- case RPC_FC_HYPER:
- case RPC_FC_DOUBLE:
+ case FC_HYPER:
+ case FC_DOUBLE:
size += 8;
break;
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
- case RPC_FC_POINTER:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
+ case FC_POINTER:
size += sizeof(void *);
- if (*pFormat != RPC_FC_POINTER)
+ if (*pFormat != FC_POINTER)
pFormat += 4;
break;
- case RPC_FC_ALIGNM2:
+ case FC_ALIGNM2:
align_length(&size, 2);
break;
- case RPC_FC_ALIGNM4:
+ case FC_ALIGNM4:
align_length(&size, 4);
break;
- case RPC_FC_ALIGNM8:
+ case FC_ALIGNM8:
align_length(&size, 8);
break;
- case RPC_FC_STRUCTPAD1:
- case RPC_FC_STRUCTPAD2:
- case RPC_FC_STRUCTPAD3:
- case RPC_FC_STRUCTPAD4:
- case RPC_FC_STRUCTPAD5:
- case RPC_FC_STRUCTPAD6:
- case RPC_FC_STRUCTPAD7:
- size += *pFormat - RPC_FC_STRUCTPAD1 + 1;
+ case FC_STRUCTPAD1:
+ case FC_STRUCTPAD2:
+ case FC_STRUCTPAD3:
+ case FC_STRUCTPAD4:
+ case FC_STRUCTPAD5:
+ case FC_STRUCTPAD6:
+ case FC_STRUCTPAD7:
+ size += *pFormat - FC_STRUCTPAD1 + 1;
break;
- case RPC_FC_EMBEDDED_COMPLEX:
+ case FC_EMBEDDED_COMPLEX:
size += pFormat[1];
pFormat += 2;
desc = pFormat + *(const SHORT*)pFormat;
size += EmbeddedComplexSize(pStubMsg, desc);
pFormat += 2;
continue;
- case RPC_FC_PAD:
+ case FC_PAD:
break;
default:
FIXME("unhandled format 0x%02x\n", *pFormat);
@@ -3904,15 +3902,15 @@ unsigned char * WINAPI NdrConformantArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_CARRAY)
+ if (pFormat[0] != FC_CARRAY)
{
ERR("invalid format = 0x%x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- array_compute_and_write_conformance(RPC_FC_CARRAY, pStubMsg, pMemory,
+ array_compute_and_write_conformance(FC_CARRAY, pStubMsg, pMemory,
pFormat);
- array_write_variance_and_marshall(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat,
+ array_write_variance_and_marshall(FC_CARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
return NULL;
@@ -3927,14 +3925,14 @@ unsigned char * WINAPI NdrConformantArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
unsigned char fMustAlloc)
{
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
- if (pFormat[0] != RPC_FC_CARRAY)
+ if (pFormat[0] != FC_CARRAY)
{
ERR("invalid format = 0x%x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat);
- array_read_variance_and_unmarshall(RPC_FC_CARRAY, pStubMsg, ppMemory, pFormat,
+ array_read_conformance(FC_CARRAY, pStubMsg, pFormat);
+ array_read_variance_and_unmarshall(FC_CARRAY, pStubMsg, ppMemory, pFormat,
fMustAlloc,
TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
@@ -3950,14 +3948,14 @@ void WINAPI NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_CARRAY)
+ if (pFormat[0] != FC_CARRAY)
{
ERR("invalid format = 0x%x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- array_compute_and_size_conformance(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat);
- array_buffer_size(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat,
+ array_compute_and_size_conformance(FC_CARRAY, pStubMsg, pMemory, pFormat);
+ array_buffer_size(FC_CARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
}
@@ -3968,14 +3966,14 @@ ULONG WINAPI NdrConformantArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
TRACE("(%p,%p)\n", pStubMsg, pFormat);
- if (pFormat[0] != RPC_FC_CARRAY)
+ if (pFormat[0] != FC_CARRAY)
{
ERR("invalid format = 0x%x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- array_read_conformance(RPC_FC_CARRAY, pStubMsg, pFormat);
- array_memory_size(RPC_FC_CARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */);
+ array_read_conformance(FC_CARRAY, pStubMsg, pFormat);
+ array_memory_size(FC_CARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */);
return pStubMsg->MemorySize;
}
@@ -3988,13 +3986,13 @@ void WINAPI NdrConformantArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
PFORMAT_STRING pFormat)
{
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_CARRAY)
+ if (pFormat[0] != FC_CARRAY)
{
ERR("invalid format = 0x%x\n", pFormat[0]);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- array_free(RPC_FC_CARRAY, pStubMsg, pMemory, pFormat,
+ array_free(FC_CARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
}
@@ -4008,16 +4006,16 @@ unsigned char* WINAPI NdrConformantVaryingArrayMarshall( PMIDL_STUB_MESSAGE pStu
{
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_CVARRAY)
+ if (pFormat[0] != FC_CVARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return NULL;
}
- array_compute_and_write_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory,
+ array_compute_and_write_conformance(FC_CVARRAY, pStubMsg, pMemory,
pFormat);
- array_write_variance_and_marshall(RPC_FC_CVARRAY, pStubMsg, pMemory,
+ array_write_variance_and_marshall(FC_CVARRAY, pStubMsg, pMemory,
pFormat, TRUE /* fHasPointers */);
return NULL;
@@ -4034,15 +4032,15 @@ unsigned char* WINAPI NdrConformantVaryingArrayUnmarshall( PMIDL_STUB_MESSAGE pS
{
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
- if (pFormat[0] != RPC_FC_CVARRAY)
+ if (pFormat[0] != FC_CVARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return NULL;
}
- array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat);
- array_read_variance_and_unmarshall(RPC_FC_CVARRAY, pStubMsg, ppMemory,
+ array_read_conformance(FC_CVARRAY, pStubMsg, pFormat);
+ array_read_variance_and_unmarshall(FC_CVARRAY, pStubMsg, ppMemory,
pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */,
TRUE /* fUnmarshall */);
@@ -4060,14 +4058,14 @@ void WINAPI NdrConformantVaryingArrayFree( PMIDL_STUB_MESSAGE pStubMsg,
{
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_CVARRAY)
+ if (pFormat[0] != FC_CVARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
- array_free(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat,
+ array_free(FC_CVARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
}
@@ -4080,16 +4078,16 @@ void WINAPI NdrConformantVaryingArrayBufferSize( PMIDL_STUB_MESSAGE pStubMsg,
{
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_CVARRAY)
+ if (pFormat[0] != FC_CVARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
- array_compute_and_size_conformance(RPC_FC_CVARRAY, pStubMsg, pMemory,
+ array_compute_and_size_conformance(FC_CVARRAY, pStubMsg, pMemory,
pFormat);
- array_buffer_size(RPC_FC_CVARRAY, pStubMsg, pMemory, pFormat,
+ array_buffer_size(FC_CVARRAY, pStubMsg, pMemory, pFormat,
TRUE /* fHasPointers */);
}
@@ -4102,15 +4100,15 @@ ULONG WINAPI NdrConformantVaryingArrayMemorySize( PMIDL_STUB_MESSAGE pStubMsg,
{
TRACE("(%p, %p)\n", pStubMsg, pFormat);
- if (pFormat[0] != RPC_FC_CVARRAY)
+ if (pFormat[0] != FC_CVARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return pStubMsg->MemorySize;
}
- array_read_conformance(RPC_FC_CVARRAY, pStubMsg, pFormat);
- array_memory_size(RPC_FC_CVARRAY, pStubMsg, pFormat,
+ array_read_conformance(FC_CVARRAY, pStubMsg, pFormat);
+ array_memory_size(FC_CVARRAY, pStubMsg, pFormat,
TRUE /* fHasPointers */);
return pStubMsg->MemorySize;
@@ -4128,7 +4126,7 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
+ if (pFormat[0] != FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4164,8 +4162,8 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->BufferLength = saved_buffer_length;
}
- array_compute_and_write_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat);
- array_write_variance_and_marshall(RPC_FC_BOGUS_ARRAY, pStubMsg,
+ array_compute_and_write_conformance(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat);
+ array_write_variance_and_marshall(FC_BOGUS_ARRAY, pStubMsg,
pMemory, pFormat, TRUE /* fHasPointers */);
STD_OVERFLOW_CHECK(pStubMsg);
@@ -4193,7 +4191,7 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
- if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
+ if (pFormat[0] != FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4220,8 +4218,8 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
/* restore the original buffer */
pStubMsg->Buffer = saved_buffer;
- array_read_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat);
- array_read_variance_and_unmarshall(RPC_FC_BOGUS_ARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc,
+ array_read_conformance(FC_BOGUS_ARRAY, pStubMsg, pFormat);
+ array_read_variance_and_unmarshall(FC_BOGUS_ARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc,
TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */);
if (pointer_buffer_mark_set)
@@ -4244,7 +4242,7 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
+ if (pFormat[0] != FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4278,8 +4276,8 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->BufferLength = saved_buffer_length;
}
- array_compute_and_size_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat);
- array_buffer_size(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */);
+ array_compute_and_size_conformance(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat);
+ array_buffer_size(FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */);
if(pointer_length_set)
{
@@ -4296,15 +4294,15 @@ ULONG WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
{
TRACE("(%p,%p)\n", pStubMsg, pFormat);
- if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
+ if (pFormat[0] != FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return 0;
}
- array_read_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat);
- array_memory_size(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */);
+ array_read_conformance(FC_BOGUS_ARRAY, pStubMsg, pFormat);
+ array_memory_size(FC_BOGUS_ARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */);
return pStubMsg->MemorySize;
}
@@ -4319,7 +4317,7 @@ void WINAPI NdrComplexArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat);
- if (pFormat[0] != RPC_FC_BOGUS_ARRAY)
+ if (pFormat[0] != FC_BOGUS_ARRAY)
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4678,7 +4676,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
- if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT))
{
ERR("invalid format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4687,7 +4685,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
pCStructFormat->offset_to_array_description;
- if (*pCArrayFormat != RPC_FC_CARRAY)
+ if (*pCArrayFormat != FC_CARRAY)
{
ERR("invalid array format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4715,7 +4713,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->BufferMark = pStubMsg->Buffer;
safe_copy_to_buffer(pStubMsg, pMemory, pCStructFormat->memory_size + bufsize);
- if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ if (pCStructFormat->type == FC_CPSTRUCT)
EmbeddedPointerMarshall(pStubMsg, pMemory, pFormat);
return NULL;
@@ -4737,7 +4735,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
- if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT))
{
ERR("invalid format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4745,7 +4743,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs
}
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
pCStructFormat->offset_to_array_description;
- if (*pCArrayFormat != RPC_FC_CARRAY)
+ if (*pCArrayFormat != FC_CARRAY)
{
ERR("invalid array format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4781,7 +4779,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs
saved_buffer = pStubMsg->BufferMark = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, pCStructFormat->memory_size + bufsize);
- if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ if (pCStructFormat->type == FC_CPSTRUCT)
EmbeddedPointerUnmarshall(pStubMsg, saved_buffer, *ppMemory, pFormat, fMustAlloc);
TRACE("copying %p to %p\n", saved_buffer, *ppMemory);
@@ -4805,7 +4803,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
- if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT))
{
ERR("invalid format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4813,7 +4811,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
}
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
pCStructFormat->offset_to_array_description;
- if (*pCArrayFormat != RPC_FC_CARRAY)
+ if (*pCArrayFormat != FC_CARRAY)
{
ERR("invalid array format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4831,7 +4829,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
safe_buffer_length_increment(pStubMsg, pCStructFormat->memory_size);
safe_buffer_length_increment(pStubMsg, safe_multiply(pStubMsg->MaxCount, esize));
- if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ if (pCStructFormat->type == FC_CPSTRUCT)
EmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);
}
@@ -4858,7 +4856,7 @@ void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
pFormat += sizeof(NDR_CSTRUCT_FORMAT);
- if ((pCStructFormat->type != RPC_FC_CPSTRUCT) && (pCStructFormat->type != RPC_FC_CSTRUCT))
+ if ((pCStructFormat->type != FC_CPSTRUCT) && (pCStructFormat->type != FC_CSTRUCT))
{
ERR("invalid format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4867,7 +4865,7 @@ void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
pCArrayFormat = (const unsigned char *)&pCStructFormat->offset_to_array_description +
pCStructFormat->offset_to_array_description;
- if (*pCArrayFormat != RPC_FC_CARRAY)
+ if (*pCArrayFormat != FC_CARRAY)
{
ERR("invalid array format type %x\n", pCStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4882,7 +4880,7 @@ void WINAPI NdrConformantStructFree(PMIDL_STUB_MESSAGE pStubMsg,
/* copy constant sized part of struct */
pStubMsg->BufferMark = pStubMsg->Buffer;
- if (pCStructFormat->type == RPC_FC_CPSTRUCT)
+ if (pCStructFormat->type == FC_CPSTRUCT)
EmbeddedPointerFree(pStubMsg, pMemory, pFormat);
}
@@ -4899,7 +4897,7 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
- if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
+ if (pCVStructFormat->type != FC_CVSTRUCT)
{
ERR("invalid format type %x\n", pCVStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -4948,7 +4946,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
- if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
+ if (pCVStructFormat->type != FC_CVSTRUCT)
{
ERR("invalid format type %x\n", pCVStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5001,9 +4999,9 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE
memcpy(*ppMemory + pCVStructFormat->memory_size + offset,
saved_array_buffer, bufsize);
- if (*pCVArrayFormat == RPC_FC_C_CSTRING)
+ if (*pCVArrayFormat == FC_C_CSTRING)
TRACE("string=%s\n", debugstr_a((char *)(*ppMemory + pCVStructFormat->memory_size)));
- else if (*pCVArrayFormat == RPC_FC_C_WSTRING)
+ else if (*pCVArrayFormat == FC_C_WSTRING)
TRACE("string=%s\n", debugstr_w((WCHAR *)(*ppMemory + pCVStructFormat->memory_size)));
return NULL;
@@ -5022,7 +5020,7 @@ void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
- if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
+ if (pCVStructFormat->type != FC_CVSTRUCT)
{
ERR("invalid format type %x\n", pCVStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5060,7 +5058,7 @@ ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p)\n", pStubMsg, pFormat);
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
- if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
+ if (pCVStructFormat->type != FC_CVSTRUCT)
{
ERR("invalid format type %x\n", pCVStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5099,7 +5097,7 @@ void WINAPI NdrConformantVaryingStructFree(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
pFormat += sizeof(NDR_CVSTRUCT_FORMAT);
- if (pCVStructFormat->type != RPC_FC_CVSTRUCT)
+ if (pCVStructFormat->type != FC_CVSTRUCT)
{
ERR("invalid format type %x\n", pCVStructFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5145,8 +5143,8 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
- (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ if ((pSmFArrayFormat->type != FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != FC_LGFARRAY))
{
ERR("invalid format type %x\n", pSmFArrayFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5155,7 +5153,7 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
align_pointer_clear(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1);
- if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ if (pSmFArrayFormat->type == FC_SMFARRAY)
{
total_size = pSmFArrayFormat->total_size;
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
@@ -5189,8 +5187,8 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
- if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
- (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ if ((pSmFArrayFormat->type != FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != FC_LGFARRAY))
{
ERR("invalid format type %x\n", pSmFArrayFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5199,7 +5197,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1);
- if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ if (pSmFArrayFormat->type == FC_SMFARRAY)
{
total_size = pSmFArrayFormat->total_size;
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
@@ -5243,8 +5241,8 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
- (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ if ((pSmFArrayFormat->type != FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != FC_LGFARRAY))
{
ERR("invalid format type %x\n", pSmFArrayFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5253,7 +5251,7 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
align_length(&pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1);
- if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ if (pSmFArrayFormat->type == FC_SMFARRAY)
{
total_size = pSmFArrayFormat->total_size;
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
@@ -5280,8 +5278,8 @@ ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p)\n", pStubMsg, pFormat);
- if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
- (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ if ((pSmFArrayFormat->type != FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != FC_LGFARRAY))
{
ERR("invalid format type %x\n", pSmFArrayFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5290,7 +5288,7 @@ ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1);
- if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ if (pSmFArrayFormat->type == FC_SMFARRAY)
{
total_size = pSmFArrayFormat->total_size;
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
@@ -5321,15 +5319,15 @@ void WINAPI NdrFixedArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if ((pSmFArrayFormat->type != RPC_FC_SMFARRAY) &&
- (pSmFArrayFormat->type != RPC_FC_LGFARRAY))
+ if ((pSmFArrayFormat->type != FC_SMFARRAY) &&
+ (pSmFArrayFormat->type != FC_LGFARRAY))
{
ERR("invalid format type %x\n", pSmFArrayFormat->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
- if (pSmFArrayFormat->type == RPC_FC_SMFARRAY)
+ if (pSmFArrayFormat->type == FC_SMFARRAY)
pFormat = (const unsigned char *)(pSmFArrayFormat + 1);
else
{
@@ -5353,8 +5351,8 @@ unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if ((pFormat[0] != RPC_FC_SMVARRAY) &&
- (pFormat[0] != RPC_FC_LGVARRAY))
+ if ((pFormat[0] != FC_SMVARRAY) &&
+ (pFormat[0] != FC_LGVARRAY))
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5363,7 +5361,7 @@ unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg,
alignment = pFormat[1] + 1;
- if (pFormat[0] == RPC_FC_SMVARRAY)
+ if (pFormat[0] == FC_SMVARRAY)
{
pFormat += 2;
pFormat += sizeof(WORD);
@@ -5418,8 +5416,8 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p, %d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc);
- if ((pFormat[0] != RPC_FC_SMVARRAY) &&
- (pFormat[0] != RPC_FC_LGVARRAY))
+ if ((pFormat[0] != FC_SMVARRAY) &&
+ (pFormat[0] != FC_LGVARRAY))
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5428,7 +5426,7 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
alignment = pFormat[1] + 1;
- if (pFormat[0] == RPC_FC_SMVARRAY)
+ if (pFormat[0] == FC_SMVARRAY)
{
pFormat += 2;
size = *(const WORD*)pFormat;
@@ -5481,8 +5479,8 @@ void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if ((pFormat[0] != RPC_FC_SMVARRAY) &&
- (pFormat[0] != RPC_FC_LGVARRAY))
+ if ((pFormat[0] != FC_SMVARRAY) &&
+ (pFormat[0] != FC_LGVARRAY))
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5491,7 +5489,7 @@ void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
alignment = pFormat[1] + 1;
- if (pFormat[0] == RPC_FC_SMVARRAY)
+ if (pFormat[0] == FC_SMVARRAY)
{
pFormat += 2;
pFormat += sizeof(WORD);
@@ -5537,8 +5535,8 @@ ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p)\n", pStubMsg, pFormat);
- if ((pFormat[0] != RPC_FC_SMVARRAY) &&
- (pFormat[0] != RPC_FC_LGVARRAY))
+ if ((pFormat[0] != FC_SMVARRAY) &&
+ (pFormat[0] != FC_LGVARRAY))
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -5547,7 +5545,7 @@ ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg,
alignment = pFormat[1] + 1;
- if (pFormat[0] == RPC_FC_SMVARRAY)
+ if (pFormat[0] == FC_SMVARRAY)
{
pFormat += 2;
size = *(const WORD*)pFormat;
@@ -5590,15 +5588,15 @@ void WINAPI NdrVaryingArrayFree(PMIDL_STUB_MESSAGE pStubMsg,
TRACE("(%p, %p, %p)\n", pStubMsg, pMemory, pFormat);
- if ((pFormat[0] != RPC_FC_SMVARRAY) &&
- (pFormat[0] != RPC_FC_LGVARRAY))
+ if ((pFormat[0] != FC_SMVARRAY) &&
+ (pFormat[0] != FC_LGVARRAY))
{
ERR("invalid format type %x\n", pFormat[0]);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
return;
}
- if (pFormat[0] == RPC_FC_SMVARRAY)
+ if (pFormat[0] == FC_SMVARRAY)
{
pFormat += 2;
pFormat += sizeof(WORD);
@@ -5630,22 +5628,22 @@ static ULONG get_discriminant(unsigned char fc, const unsigned char *pMemory)
{
switch (fc)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
return *pMemory;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
- case RPC_FC_ENUM16:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
+ case FC_ENUM16:
return *(const USHORT *)pMemory;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
return *(const ULONG *)pMemory;
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
return *(const ULONG_PTR *)pMemory;
default:
FIXME("Unhandled base type: 0x%02x\n", fc);
@@ -5716,10 +5714,10 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c
BOOL pointer_buffer_mark_set = FALSE;
switch(*desc)
{
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
align_pointer_clear(&pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
if (pStubMsg->PointerBufferMark)
@@ -5745,7 +5743,7 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c
pStubMsg->Buffer = saved_buffer + 4;
}
break;
- case RPC_FC_IP:
+ case FC_IP:
/* must be dereferenced first */
m(pStubMsg, *(unsigned char **)pMemory, desc);
break;
@@ -5789,10 +5787,10 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg,
BOOL pointer_buffer_mark_set = FALSE;
switch(*desc)
{
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
align_pointer(&pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
if (pStubMsg->PointerBufferMark)
@@ -5819,7 +5817,7 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->Buffer = saved_buffer + 4;
}
break;
- case RPC_FC_IP:
+ case FC_IP:
/* must be dereferenced first */
m(pStubMsg, *(unsigned char ***)ppMemory, desc, fMustAlloc);
break;
@@ -5860,10 +5858,10 @@ static void union_arm_buffer_size(PMIDL_STUB_MESSAGE pStubMsg,
{
switch(*desc)
{
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
align_length(&pStubMsg->BufferLength, 4);
safe_buffer_length_increment(pStubMsg, 4); /* for pointer ID */
if (!pStubMsg->IgnoreEmbeddedPointers)
@@ -5878,7 +5876,7 @@ static void union_arm_buffer_size(PMIDL_STUB_MESSAGE pStubMsg,
pStubMsg->BufferLength = saved_buffer_length;
}
break;
- case RPC_FC_IP:
+ case FC_IP:
/* must be dereferenced first */
m(pStubMsg, *(unsigned char **)pMemory, desc);
break;
@@ -5919,10 +5917,10 @@ static ULONG union_arm_memory_size(PMIDL_STUB_MESSAGE pStubMsg,
{
switch(*desc)
{
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
align_pointer(&pStubMsg->Buffer, 4);
saved_buffer = pStubMsg->Buffer;
safe_buffer_increment(pStubMsg, 4);
@@ -5965,13 +5963,13 @@ static void union_arm_free(PMIDL_STUB_MESSAGE pStubMsg,
{
switch(*desc)
{
- case RPC_FC_RP:
- case RPC_FC_UP:
- case RPC_FC_OP:
- case RPC_FC_FP:
+ case FC_RP:
+ case FC_UP:
+ case FC_OP:
+ case FC_FP:
PointerFree(pStubMsg, *(unsigned char **)pMemory, desc);
break;
- case RPC_FC_IP:
+ case FC_IP:
/* must be dereferenced first */
m(pStubMsg, *(unsigned char **)pMemory, desc);
break;
@@ -6164,20 +6162,20 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg,
switch(**ppFormat)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
{
UCHAR d;
safe_copy_from_buffer(pStubMsg, &d, sizeof(d));
discriminant = d;
break;
}
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
- case RPC_FC_ENUM16:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
+ case FC_ENUM16:
{
USHORT d;
align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
@@ -6185,8 +6183,8 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg,
discriminant = d;
break;
}
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
+ case FC_LONG:
+ case FC_ULONG:
{
ULONG d;
align_pointer(&pStubMsg->Buffer, sizeof(ULONG));
@@ -6416,7 +6414,7 @@ static unsigned char *WINAPI NdrRangeMarshall(
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
- if (pRange->type != RPC_FC_RANGE)
+ if (pRange->type != FC_RANGE)
{
ERR("invalid format type %x\n", pRange->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6442,7 +6440,7 @@ unsigned char *WINAPI NdrRangeUnmarshall(
TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false");
- if (pRange->type != RPC_FC_RANGE)
+ if (pRange->type != FC_RANGE)
{
ERR("invalid format type %x\n", pRange->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6483,41 +6481,41 @@ unsigned char *WINAPI NdrRangeUnmarshall(
switch(base_type)
{
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
+ case FC_CHAR:
+ case FC_SMALL:
RANGE_UNMARSHALL(UCHAR, UCHAR, "%d");
TRACE("value: 0x%02x\n", **ppMemory);
break;
- case RPC_FC_BYTE:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_USMALL:
RANGE_UNMARSHALL(CHAR, CHAR, "%u");
TRACE("value: 0x%02x\n", **ppMemory);
break;
- case RPC_FC_WCHAR: /* FIXME: valid? */
- case RPC_FC_USHORT:
+ case FC_WCHAR: /* FIXME: valid? */
+ case FC_USHORT:
RANGE_UNMARSHALL(USHORT, USHORT, "%u");
TRACE("value: 0x%04x\n", **(USHORT **)ppMemory);
break;
- case RPC_FC_SHORT:
+ case FC_SHORT:
RANGE_UNMARSHALL(SHORT, SHORT, "%d");
TRACE("value: 0x%04x\n", **(USHORT **)ppMemory);
break;
- case RPC_FC_LONG:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ENUM32:
RANGE_UNMARSHALL(LONG, LONG, "%d");
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
break;
- case RPC_FC_ULONG:
+ case FC_ULONG:
RANGE_UNMARSHALL(ULONG, ULONG, "%u");
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
RANGE_UNMARSHALL(UINT, USHORT, "%u");
TRACE("value: 0x%08x\n", **(UINT **)ppMemory);
break;
- case RPC_FC_FLOAT:
- case RPC_FC_DOUBLE:
- case RPC_FC_HYPER:
+ case FC_FLOAT:
+ case FC_DOUBLE:
+ case FC_HYPER:
default:
ERR("invalid range base type: 0x%02x\n", base_type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6539,7 +6537,7 @@ static void WINAPI NdrRangeBufferSize(
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
- if (pRange->type != RPC_FC_RANGE)
+ if (pRange->type != FC_RANGE)
{
ERR("invalid format type %x\n", pRange->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6559,7 +6557,7 @@ static ULONG WINAPI NdrRangeMemorySize(
const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat;
unsigned char base_type;
- if (pRange->type != RPC_FC_RANGE)
+ if (pRange->type != FC_RANGE)
{
ERR("invalid format type %x\n", pRange->type);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6594,42 +6592,42 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
switch(*pFormat)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(UCHAR));
TRACE("value: 0x%02x\n", *pMemory);
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
align_pointer_clear(&pStubMsg->Buffer, sizeof(USHORT));
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(USHORT));
TRACE("value: 0x%04x\n", *(USHORT *)pMemory);
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ERROR_STATUS_T:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ERROR_STATUS_T:
+ case FC_ENUM32:
align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONG));
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONG));
TRACE("value: 0x%08x\n", *(ULONG *)pMemory);
break;
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
align_pointer_clear(&pStubMsg->Buffer, sizeof(float));
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float));
break;
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
align_pointer_clear(&pStubMsg->Buffer, sizeof(double));
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double));
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONGLONG));
safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONGLONG));
TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory));
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
{
USHORT val = *(UINT *)pMemory;
/* only 16-bits on the wire, so do a sanity check */
@@ -6640,15 +6638,15 @@ static unsigned char *WINAPI NdrBaseTypeMarshall(
TRACE("value: 0x%04x\n", *(UINT *)pMemory);
break;
}
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
{
UINT val = *(UINT_PTR *)pMemory;
align_pointer_clear(&pStubMsg->Buffer, sizeof(UINT));
safe_copy_to_buffer(pStubMsg, &val, sizeof(val));
break;
}
- case RPC_FC_IGNORE:
+ case FC_IGNORE:
break;
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
@@ -6688,39 +6686,39 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
switch(*pFormat)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
BASE_TYPE_UNMARSHALL(UCHAR);
TRACE("value: 0x%02x\n", **ppMemory);
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
BASE_TYPE_UNMARSHALL(USHORT);
TRACE("value: 0x%04x\n", **(USHORT **)ppMemory);
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ERROR_STATUS_T:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ERROR_STATUS_T:
+ case FC_ENUM32:
BASE_TYPE_UNMARSHALL(ULONG);
TRACE("value: 0x%08x\n", **(ULONG **)ppMemory);
break;
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
BASE_TYPE_UNMARSHALL(float);
TRACE("value: %f\n", **(float **)ppMemory);
break;
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
BASE_TYPE_UNMARSHALL(double);
TRACE("value: %f\n", **(double **)ppMemory);
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
BASE_TYPE_UNMARSHALL(ULONGLONG);
TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory));
break;
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
{
USHORT val;
align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
@@ -6734,7 +6732,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
TRACE("value: 0x%08x\n", **(UINT **)ppMemory);
break;
}
- case RPC_FC_INT3264:
+ case FC_INT3264:
if (sizeof(INT_PTR) == sizeof(INT)) BASE_TYPE_UNMARSHALL(INT);
else
{
@@ -6749,7 +6747,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
TRACE("value: 0x%08lx\n", **(INT_PTR **)ppMemory);
}
break;
- case RPC_FC_UINT3264:
+ case FC_UINT3264:
if (sizeof(UINT_PTR) == sizeof(UINT)) BASE_TYPE_UNMARSHALL(UINT);
else
{
@@ -6764,7 +6762,7 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall(
TRACE("value: 0x%08lx\n", **(UINT_PTR **)ppMemory);
}
break;
- case RPC_FC_IGNORE:
+ case FC_IGNORE:
break;
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
@@ -6788,44 +6786,44 @@ static void WINAPI NdrBaseTypeBufferSize(
switch(*pFormat)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
safe_buffer_length_increment(pStubMsg, sizeof(UCHAR));
break;
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
- case RPC_FC_ENUM16:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
+ case FC_ENUM16:
align_length(&pStubMsg->BufferLength, sizeof(USHORT));
safe_buffer_length_increment(pStubMsg, sizeof(USHORT));
break;
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
+ case FC_INT3264:
+ case FC_UINT3264:
align_length(&pStubMsg->BufferLength, sizeof(ULONG));
safe_buffer_length_increment(pStubMsg, sizeof(ULONG));
break;
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
align_length(&pStubMsg->BufferLength, sizeof(float));
safe_buffer_length_increment(pStubMsg, sizeof(float));
break;
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
align_length(&pStubMsg->BufferLength, sizeof(double));
safe_buffer_length_increment(pStubMsg, sizeof(double));
break;
- case RPC_FC_HYPER:
+ case FC_HYPER:
align_length(&pStubMsg->BufferLength, sizeof(ULONGLONG));
safe_buffer_length_increment(pStubMsg, sizeof(ULONGLONG));
break;
- case RPC_FC_ERROR_STATUS_T:
+ case FC_ERROR_STATUS_T:
align_length(&pStubMsg->BufferLength, sizeof(error_status_t));
safe_buffer_length_increment(pStubMsg, sizeof(error_status_t));
break;
- case RPC_FC_IGNORE:
+ case FC_IGNORE:
break;
default:
FIXME("Unhandled base type: 0x%02x\n", *pFormat);
@@ -6843,67 +6841,67 @@ static ULONG WINAPI NdrBaseTypeMemorySize(
switch(*pFormat)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
safe_buffer_increment(pStubMsg, sizeof(UCHAR));
pStubMsg->MemorySize += sizeof(UCHAR);
return sizeof(UCHAR);
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
safe_buffer_increment(pStubMsg, sizeof(USHORT));
align_length(&pStubMsg->MemorySize, sizeof(USHORT));
pStubMsg->MemorySize += sizeof(USHORT);
return sizeof(USHORT);
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_ENUM32:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_ENUM32:
align_pointer(&pStubMsg->Buffer, sizeof(ULONG));
safe_buffer_increment(pStubMsg, sizeof(ULONG));
align_length(&pStubMsg->MemorySize, sizeof(ULONG));
pStubMsg->MemorySize += sizeof(ULONG);
return sizeof(ULONG);
- case RPC_FC_FLOAT:
+ case FC_FLOAT:
align_pointer(&pStubMsg->Buffer, sizeof(float));
safe_buffer_increment(pStubMsg, sizeof(float));
align_length(&pStubMsg->MemorySize, sizeof(float));
pStubMsg->MemorySize += sizeof(float);
return sizeof(float);
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
align_pointer(&pStubMsg->Buffer, sizeof(double));
safe_buffer_increment(pStubMsg, sizeof(double));
align_length(&pStubMsg->MemorySize, sizeof(double));
pStubMsg->MemorySize += sizeof(double);
return sizeof(double);
- case RPC_FC_HYPER:
+ case FC_HYPER:
align_pointer(&pStubMsg->Buffer, sizeof(ULONGLONG));
safe_buffer_increment(pStubMsg, sizeof(ULONGLONG));
align_length(&pStubMsg->MemorySize, sizeof(ULONGLONG));
pStubMsg->MemorySize += sizeof(ULONGLONG);
return sizeof(ULONGLONG);
- case RPC_FC_ERROR_STATUS_T:
+ case FC_ERROR_STATUS_T:
align_pointer(&pStubMsg->Buffer, sizeof(error_status_t));
safe_buffer_increment(pStubMsg, sizeof(error_status_t));
align_length(&pStubMsg->MemorySize, sizeof(error_status_t));
pStubMsg->MemorySize += sizeof(error_status_t);
return sizeof(error_status_t);
- case RPC_FC_ENUM16:
+ case FC_ENUM16:
align_pointer(&pStubMsg->Buffer, sizeof(USHORT));
safe_buffer_increment(pStubMsg, sizeof(USHORT));
align_length(&pStubMsg->MemorySize, sizeof(UINT));
pStubMsg->MemorySize += sizeof(UINT);
return sizeof(UINT);
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
+ case FC_INT3264:
+ case FC_UINT3264:
align_pointer(&pStubMsg->Buffer, sizeof(UINT));
safe_buffer_increment(pStubMsg, sizeof(UINT));
align_length(&pStubMsg->MemorySize, sizeof(UINT_PTR));
pStubMsg->MemorySize += sizeof(UINT_PTR);
return sizeof(UINT_PTR);
- case RPC_FC_IGNORE:
+ case FC_IGNORE:
align_length(&pStubMsg->MemorySize, sizeof(void *));
pStubMsg->MemorySize += sizeof(void *);
return sizeof(void *);
@@ -6935,7 +6933,7 @@ static void WINAPI NdrContextHandleBufferSize(
{
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
- if (*pFormat != RPC_FC_BIND_CONTEXT)
+ if (*pFormat != FC_BIND_CONTEXT)
{
ERR("invalid format type %x\n", *pFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6954,7 +6952,7 @@ static unsigned char *WINAPI NdrContextHandleMarshall(
{
TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat);
- if (*pFormat != RPC_FC_BIND_CONTEXT)
+ if (*pFormat != FC_BIND_CONTEXT)
{
ERR("invalid format type %x\n", *pFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -6990,7 +6988,7 @@ static unsigned char *WINAPI NdrContextHandleUnmarshall(
TRACE("pStubMsg %p, ppMemory %p, pFormat %p, fMustAlloc %s\n", pStubMsg,
ppMemory, pFormat, fMustAlloc ? "TRUE": "FALSE");
- if (*pFormat != RPC_FC_BIND_CONTEXT)
+ if (*pFormat != FC_BIND_CONTEXT)
{
ERR("invalid format type %x\n", *pFormat);
RpcRaiseException(RPC_S_INTERNAL_ERROR);
@@ -7126,7 +7124,7 @@ NDR_SCONTEXT WINAPI NdrContextHandleInitialize(PMIDL_STUB_MESSAGE pStubMsg,
if (pFormat[1] & NDR_CONTEXT_HANDLE_SERIALIZE)
flags |= RPC_CONTEXT_HANDLE_SERIALIZE;
- if (pFormat[1] & NDR_CONTEXT_HANDLE_NO_SERIALIZE)
+ if (pFormat[1] & NDR_CONTEXT_HANDLE_NOSERIALIZE)
flags |= RPC_CONTEXT_HANDLE_DONT_SERIALIZE;
if (pFormat[1] & NDR_STRICT_CONTEXT_HANDLE)
{
@@ -7160,7 +7158,7 @@ void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (pFormat[1] & NDR_CONTEXT_HANDLE_SERIALIZE)
flags |= RPC_CONTEXT_HANDLE_SERIALIZE;
- if (pFormat[1] & NDR_CONTEXT_HANDLE_NO_SERIALIZE)
+ if (pFormat[1] & NDR_CONTEXT_HANDLE_NOSERIALIZE)
flags |= RPC_CONTEXT_HANDLE_DONT_SERIALIZE;
if (pFormat[1] & NDR_STRICT_CONTEXT_HANDLE)
{
@@ -7193,7 +7191,7 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg,
if (pFormat[1] & NDR_CONTEXT_HANDLE_SERIALIZE)
flags |= RPC_CONTEXT_HANDLE_SERIALIZE;
- if (pFormat[1] & NDR_CONTEXT_HANDLE_NO_SERIALIZE)
+ if (pFormat[1] & NDR_CONTEXT_HANDLE_NOSERIALIZE)
flags |= RPC_CONTEXT_HANDLE_DONT_SERIALIZE;
if (pFormat[1] & NDR_STRICT_CONTEXT_HANDLE)
{
diff --git a/dlls/rpcrt4/ndr_ole.c b/dlls/rpcrt4/ndr_ole.c
index 0f0b7e7..8608691 100644
--- a/dlls/rpcrt4/ndr_ole.c
+++ b/dlls/rpcrt4/ndr_ole.c
@@ -36,8 +36,8 @@
#include "ndr_misc.h"
#include "rpcndr.h"
+#include "ndrtypes.h"
#include "rpcproxy.h"
-#include "wine/rpcfc.h"
#include "cpsf.h"
#include "wine/debug.h"
@@ -288,8 +288,8 @@ static const IID* get_ip_iid(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory
const IID *riid;
if (!pFormat) return &IID_IUnknown;
TRACE("format=%02x %02x\n", pFormat[0], pFormat[1]);
- if (pFormat[0] != RPC_FC_IP) FIXME("format=%d\n", pFormat[0]);
- if (pFormat[1] == RPC_FC_CONSTANT_IID) {
+ if (pFormat[0] != FC_IP) FIXME("format=%d\n", pFormat[0]);
+ if (pFormat[1] == FC_CONSTANT_IID) {
riid = (const IID *)&pFormat[2];
} else {
ComputeConformance(pStubMsg, pMemory, pFormat+2, 0);
diff --git a/dlls/rpcrt4/ndr_stubless.c b/dlls/rpcrt4/ndr_stubless.c
index f84c617..a645a24 100644
--- a/dlls/rpcrt4/ndr_stubless.c
+++ b/dlls/rpcrt4/ndr_stubless.c
@@ -40,7 +40,6 @@
#include "wine/exception.h"
#include "wine/debug.h"
-#include "wine/rpcfc.h"
#include "cpsf.h"
#include "ndr_misc.h"
@@ -154,8 +153,8 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
DWORD size;
switch(*pFormat)
{
- case RPC_FC_RP:
- if (pFormat[1] & RPC_FC_P_SIMPLEPOINTER)
+ case FC_RP:
+ if (pFormat[1] & FC_SIMPLE_POINTER)
{
FIXME("Simple reference pointer (type %#x).\n", pFormat[2]);
size = sizeof(void *);
@@ -163,52 +162,52 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
}
size = calc_arg_size(pStubMsg, &pFormat[2] + *(const SHORT*)&pFormat[2]);
break;
- case RPC_FC_STRUCT:
- case RPC_FC_PSTRUCT:
+ case FC_STRUCT:
+ case FC_PSTRUCT:
size = *(const WORD*)(pFormat + 2);
break;
- case RPC_FC_BOGUS_STRUCT:
+ case FC_BOGUS_STRUCT:
size = *(const WORD*)(pFormat + 2);
if(*(const WORD*)(pFormat + 4))
FIXME("Unhandled conformant description\n");
break;
- case RPC_FC_CARRAY:
- case RPC_FC_CVARRAY:
+ case FC_CARRAY:
+ case FC_CVARRAY:
size = *(const WORD*)(pFormat + 2);
ComputeConformance(pStubMsg, NULL, pFormat + 4, 0);
size *= pStubMsg->MaxCount;
break;
- case RPC_FC_SMFARRAY:
- case RPC_FC_SMVARRAY:
+ case FC_SMFARRAY:
+ case FC_SMVARRAY:
size = *(const WORD*)(pFormat + 2);
break;
- case RPC_FC_LGFARRAY:
- case RPC_FC_LGVARRAY:
+ case FC_LGFARRAY:
+ case FC_LGVARRAY:
size = *(const DWORD*)(pFormat + 2);
break;
- case RPC_FC_BOGUS_ARRAY:
+ case FC_BOGUS_ARRAY:
pFormat = ComputeConformance(pStubMsg, NULL, pFormat + 4, *(const WORD*)&pFormat[2]);
TRACE("conformance = %ld\n", pStubMsg->MaxCount);
pFormat = ComputeVariance(pStubMsg, NULL, pFormat, pStubMsg->MaxCount);
size = ComplexStructSize(pStubMsg, pFormat);
size *= pStubMsg->MaxCount;
break;
- case RPC_FC_USER_MARSHAL:
+ case FC_USER_MARSHAL:
size = *(const WORD*)(pFormat + 4);
break;
- case RPC_FC_CSTRING:
+ case FC_CSTRING:
size = *(const WORD*)(pFormat + 2);
break;
- case RPC_FC_WSTRING:
+ case FC_WSTRING:
size = *(const WORD*)(pFormat + 2) * sizeof(WCHAR);
break;
- case RPC_FC_C_CSTRING:
- case RPC_FC_C_WSTRING:
- if (*pFormat == RPC_FC_C_CSTRING)
+ case FC_C_CSTRING:
+ case FC_C_WSTRING:
+ if (*pFormat == FC_C_CSTRING)
size = sizeof(CHAR);
else
size = sizeof(WCHAR);
- if (pFormat[1] == RPC_FC_STRING_SIZED)
+ if (pFormat[1] == FC_STRING_SIZED)
ComputeConformance(pStubMsg, NULL, pFormat + 2, 0);
else
pStubMsg->MaxCount = 0;
@@ -217,7 +216,7 @@ static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat)
default:
FIXME("Unhandled type %02x\n", *pFormat);
/* fallthrough */
- case RPC_FC_IP:
+ case FC_IP:
size = sizeof(void *);
break;
}
@@ -279,10 +278,10 @@ static PFORMAT_STRING client_get_handle(
switch (pProcHeader->handle_type)
{
/* explicit binding: parse additional section */
- case RPC_FC_BIND_EXPLICIT:
+ case 0:
switch (*pFormat) /* handle_type */
{
- case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */
+ case FC_BIND_PRIMITIVE: /* explicit primitive */
{
const NDR_EHD_PRIMITIVE *pDesc = (const NDR_EHD_PRIMITIVE *)pFormat;
@@ -294,7 +293,7 @@ static PFORMAT_STRING client_get_handle(
*phBinding = *(handle_t *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset);
return pFormat + sizeof(NDR_EHD_PRIMITIVE);
}
- case RPC_FC_BIND_GENERIC: /* explicit generic */
+ case FC_BIND_GENERIC: /* explicit generic */
{
const NDR_EHD_GENERIC *pDesc = (const NDR_EHD_GENERIC *)pFormat;
void *pObject = NULL;
@@ -312,7 +311,7 @@ static PFORMAT_STRING client_get_handle(
*phBinding = pGenPair->pfnBind(pObject);
return pFormat + sizeof(NDR_EHD_GENERIC);
}
- case RPC_FC_BIND_CONTEXT: /* explicit context */
+ case FC_BIND_CONTEXT: /* explicit context */
{
const NDR_EHD_CONTEXT *pDesc = (const NDR_EHD_CONTEXT *)pFormat;
NDR_CCONTEXT context_handle;
@@ -340,22 +339,22 @@ static PFORMAT_STRING client_get_handle(
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
break;
- case RPC_FC_BIND_GENERIC: /* implicit generic */
- FIXME("RPC_FC_BIND_GENERIC\n");
+ case FC_BIND_GENERIC: /* implicit generic */
+ FIXME("FC_BIND_GENERIC\n");
RpcRaiseException(RPC_X_BAD_STUB_DATA); /* FIXME: remove when implemented */
break;
- case RPC_FC_BIND_PRIMITIVE: /* implicit primitive */
+ case FC_BIND_PRIMITIVE: /* implicit primitive */
TRACE("Implicit primitive handle\n");
*phBinding = *pStubMsg->StubDesc->IMPLICIT_HANDLE_INFO.pPrimitiveHandle;
break;
- case RPC_FC_CALLBACK_HANDLE: /* implicit callback */
- TRACE("RPC_FC_CALLBACK_HANDLE\n");
+ case FC_CALLBACK_HANDLE: /* implicit callback */
+ TRACE("FC_CALLBACK_HANDLE\n");
/* server calls callback procedures only in response to remote call, and most recent
binding handle is used. Calling back to a client can potentially result in another
callback with different current handle. */
*phBinding = I_RpcGetCurrentCallHandle();
break;
- case RPC_FC_AUTO_HANDLE: /* implicit auto handle */
+ case FC_AUTO_HANDLE: /* implicit auto handle */
/* strictly speaking, it isn't necessary to set hBinding here
* since it isn't actually used (hence the automatic in its name),
* but then why does MIDL generate a valid entry in the
@@ -378,10 +377,10 @@ static void client_free_handle(
switch (pProcHeader->handle_type)
{
/* explicit binding: parse additional section */
- case RPC_FC_BIND_EXPLICIT:
+ case 0:
switch (*pFormat) /* handle_type */
{
- case RPC_FC_BIND_GENERIC: /* explicit generic */
+ case FC_BIND_GENERIC: /* explicit generic */
{
const NDR_EHD_GENERIC *pDesc = (const NDR_EHD_GENERIC *)pFormat;
void *pObject = NULL;
@@ -399,21 +398,21 @@ static void client_free_handle(
pGenPair->pfnUnbind(pObject, hBinding);
break;
}
- case RPC_FC_BIND_CONTEXT: /* explicit context */
- case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */
+ case FC_BIND_CONTEXT: /* explicit context */
+ case FC_BIND_PRIMITIVE: /* explicit primitive */
break;
default:
ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
break;
- case RPC_FC_BIND_GENERIC: /* implicit generic */
- FIXME("RPC_FC_BIND_GENERIC\n");
+ case FC_BIND_GENERIC: /* implicit generic */
+ FIXME("FC_BIND_GENERIC\n");
RpcRaiseException(RPC_X_BAD_STUB_DATA); /* FIXME: remove when implemented */
break;
- case RPC_FC_CALLBACK_HANDLE: /* implicit callback */
- case RPC_FC_BIND_PRIMITIVE: /* implicit primitive */
- case RPC_FC_AUTO_HANDLE: /* implicit auto handle */
+ case FC_CALLBACK_HANDLE: /* implicit callback */
+ case FC_BIND_PRIMITIVE: /* implicit primitive */
+ case FC_AUTO_HANDLE: /* implicit auto handle */
break;
default:
ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
@@ -436,7 +435,7 @@ void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum s
float f;
if (params[i].attr.IsBasetype &&
- params[i].u.type_format_char == RPC_FC_FLOAT &&
+ params[i].u.type_format_char == FC_FLOAT &&
!params[i].attr.IsSimpleRef &&
!fpu_args)
{
@@ -487,26 +486,26 @@ static unsigned int type_stack_size(unsigned char fc)
{
switch (fc)
{
- case RPC_FC_BYTE:
- case RPC_FC_CHAR:
- case RPC_FC_SMALL:
- case RPC_FC_USMALL:
- case RPC_FC_WCHAR:
- case RPC_FC_SHORT:
- case RPC_FC_USHORT:
- case RPC_FC_LONG:
- case RPC_FC_ULONG:
- case RPC_FC_INT3264:
- case RPC_FC_UINT3264:
- case RPC_FC_ENUM16:
- case RPC_FC_ENUM32:
- case RPC_FC_FLOAT:
- case RPC_FC_ERROR_STATUS_T:
- case RPC_FC_IGNORE:
+ case FC_BYTE:
+ case FC_CHAR:
+ case FC_SMALL:
+ case FC_USMALL:
+ case FC_WCHAR:
+ case FC_SHORT:
+ case FC_USHORT:
+ case FC_LONG:
+ case FC_ULONG:
+ case FC_INT3264:
+ case FC_UINT3264:
+ case FC_ENUM16:
+ case FC_ENUM32:
+ case FC_FLOAT:
+ case FC_ERROR_STATUS_T:
+ case FC_IGNORE:
return sizeof(void *);
- case RPC_FC_DOUBLE:
+ case FC_DOUBLE:
return sizeof(double);
- case RPC_FC_HYPER:
+ case FC_HYPER:
return sizeof(ULONGLONG);
default:
ERR("invalid base type 0x%x\n", fc);
@@ -518,13 +517,13 @@ static BOOL is_by_value( PFORMAT_STRING format )
{
switch (*format)
{
- case RPC_FC_USER_MARSHAL:
- case RPC_FC_STRUCT:
- case RPC_FC_PSTRUCT:
- case RPC_FC_CSTRUCT:
- case RPC_FC_CPSTRUCT:
- case RPC_FC_CVSTRUCT:
- case RPC_FC_BOGUS_STRUCT:
+ case FC_USER_MARSHAL:
+ case FC_STRUCT:
+ case FC_PSTRUCT:
+ case FC_CSTRUCT:
+ case FC_CPSTRUCT:
+ case FC_CVSTRUCT:
+ case FC_BOGUS_STRUCT:
return TRUE;
default:
return FALSE;
@@ -554,32 +553,32 @@ PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
switch (param->param_direction)
{
- case RPC_FC_IN_PARAM_BASETYPE:
+ case FC_IN_PARAM_BASETYPE:
args[i].attr.IsIn = 1;
args[i].attr.IsBasetype = 1;
break;
- case RPC_FC_RETURN_PARAM_BASETYPE:
+ case FC_RETURN_PARAM_BASETYPE:
args[i].attr.IsOut = 1;
args[i].attr.IsReturn = 1;
args[i].attr.IsBasetype = 1;
break;
- case RPC_FC_IN_PARAM:
+ case FC_IN_PARAM:
args[i].attr.IsIn = 1;
args[i].attr.MustFree = 1;
break;
- case RPC_FC_IN_PARAM_NO_FREE_INST:
+ case FC_IN_PARAM_NO_FREE_INST:
args[i].attr.IsIn = 1;
args[i].attr.IsDontCallFreeInst = 1;
break;
- case RPC_FC_IN_OUT_PARAM:
+ case FC_IN_OUT_PARAM:
args[i].attr.IsIn = 1;
args[i].attr.IsOut = 1;
args[i].attr.MustFree = 1;
break;
- case RPC_FC_OUT_PARAM:
+ case FC_OUT_PARAM:
args[i].attr.IsOut = 1;
break;
- case RPC_FC_RETURN_PARAM:
+ case FC_RETURN_PARAM:
args[i].attr.IsOut = 1;
args[i].attr.IsReturn = 1;
break;
@@ -633,7 +632,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
{
const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
stack_size = header_rpc->stack_size;
@@ -650,10 +649,10 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
TRACE("proc num: %d\n", procedure_number);
/* create the full pointer translation tables, if requested */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
stubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT);
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
/* object is always the first argument */
This = stack_top[0];
@@ -669,7 +668,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
pHandleFormat = pFormat;
/* we only need a handle if this isn't an object method */
- if (!(pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT))
+ if (!(pProcHeader->Oi_flags & Oi_OBJECT_PROC))
{
pFormat = client_get_handle(&stubMsg, pProcHeader, pHandleFormat, &hBinding);
if (!pFormat) goto done;
@@ -710,7 +709,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
else
{
pFormat = convert_old_args( &stubMsg, pFormat, stack_size,
- pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT,
+ pProcHeader->Oi_flags & Oi_OBJECT_PROC,
/* reuse the correlation cache, it's not needed for v1 format */
NdrCorrCache, sizeof(NdrCorrCache), &number_of_params );
}
@@ -718,11 +717,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
stubMsg.BufferLength = 0;
/* store the RPC flags away */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
rpcMsg.RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags;
/* use alternate memory allocation routines */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC)
+ if (pProcHeader->Oi_flags & Oi_RPCSS_ALLOC_USED)
NdrRpcSmSetClientToOsf(&stubMsg);
if (Oif_flags.HasPipes)
@@ -749,11 +748,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
* 6. UNMARSHAL - unmarshal [out] params from buffer
* 7. FREE - clear [out] parameters (for proxies, and only on error)
*/
- if ((pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) ||
- (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT))
+ if ((pProcHeader->Oi_flags & Oi_OBJECT_PROC) ||
+ (pProcHeader->Oi_flags & Oi_HAS_COMM_OR_FAULT))
{
/* 1. INITOUT */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
TRACE( "INITOUT\n" );
client_do_args(&stubMsg, pFormat, STUBLESS_INITOUT, fpu_stack,
@@ -769,7 +768,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
/* 3. GETBUFFER */
TRACE( "GETBUFFER\n" );
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
/* allocate the buffer */
NdrProxyGetBuffer(This, &stubMsg);
@@ -782,7 +781,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
FIXME("pipes not supported yet\n");
else
{
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
#else
@@ -800,7 +799,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
/* 5. SENDRECEIVE */
TRACE( "SENDRECEIVE\n" );
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
/* send the [in] params and receive the [out] and [retval]
* params */
@@ -815,7 +814,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
FIXME("pipes not supported yet\n");
else
{
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
@@ -838,7 +837,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
}
__EXCEPT_ALL
{
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
/* 7. FREE */
TRACE( "FREE\n" );
@@ -888,7 +887,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
FIXME("pipes not supported yet\n");
else
{
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding);
#else
@@ -910,7 +909,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
FIXME("pipes not supported yet\n");
else
{
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
@@ -943,11 +942,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORM
}
/* free the full pointer translation tables */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
NdrFullPointerXlatFree(stubMsg.FullPtrXlatTables);
/* free marshalling buffer */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
NdrProxyFreeBuffer(This, &stubMsg);
else
{
@@ -1180,13 +1179,13 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
else if (param_needs_alloc(params[i].attr) &&
(!params[i].attr.MustFree || params[i].attr.IsSimpleRef))
{
- if (*pTypeFormat != RPC_FC_BIND_CONTEXT) pStubMsg->pfnFree(*(void **)pArg);
+ if (*pTypeFormat != FC_BIND_CONTEXT) pStubMsg->pfnFree(*(void **)pArg);
}
break;
case STUBLESS_INITOUT:
if (param_needs_alloc(params[i].attr) && !params[i].attr.ServerAllocSize)
{
- if (*pTypeFormat == RPC_FC_BIND_CONTEXT)
+ if (*pTypeFormat == FC_BIND_CONTEXT)
{
NDR_SCONTEXT ctxt = NdrContextHandleInitialize(pStubMsg, pTypeFormat);
*(void **)pArg = NDRSContextValue(ctxt);
@@ -1276,7 +1275,7 @@ LONG WINAPI NdrStubCall2(
TRACE("NDR Version: 0x%x\n", pStubDesc->Version);
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
{
const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
stack_size = header_rpc->stack_size;
@@ -1295,16 +1294,16 @@ LONG WINAPI NdrStubCall2(
switch (pProcHeader->handle_type)
{
/* explicit binding: parse additional section */
- case RPC_FC_BIND_EXPLICIT:
+ case 0:
switch (*pFormat) /* handle_type */
{
- case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */
+ case FC_BIND_PRIMITIVE: /* explicit primitive */
pFormat += sizeof(NDR_EHD_PRIMITIVE);
break;
- case RPC_FC_BIND_GENERIC: /* explicit generic */
+ case FC_BIND_GENERIC: /* explicit generic */
pFormat += sizeof(NDR_EHD_GENERIC);
break;
- case RPC_FC_BIND_CONTEXT: /* explicit context */
+ case FC_BIND_CONTEXT: /* explicit context */
pFormat += sizeof(NDR_EHD_CONTEXT);
break;
default:
@@ -1312,31 +1311,31 @@ LONG WINAPI NdrStubCall2(
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
break;
- case RPC_FC_BIND_GENERIC: /* implicit generic */
- case RPC_FC_BIND_PRIMITIVE: /* implicit primitive */
- case RPC_FC_CALLBACK_HANDLE: /* implicit callback */
- case RPC_FC_AUTO_HANDLE: /* implicit auto handle */
+ case FC_BIND_GENERIC: /* implicit generic */
+ case FC_BIND_PRIMITIVE: /* implicit primitive */
+ case FC_CALLBACK_HANDLE: /* implicit callback */
+ case FC_AUTO_HANDLE: /* implicit auto handle */
break;
default:
ERR("bad implicit binding handle type (0x%02x)\n", pProcHeader->handle_type);
RpcRaiseException(RPC_X_BAD_STUB_DATA);
}
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
NdrStubInitialize(pRpcMsg, &stubMsg, pStubDesc, pChannel);
else
NdrServerInitializeNew(pRpcMsg, &stubMsg, pStubDesc);
/* create the full pointer translation tables, if requested */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
stubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_SERVER);
/* store the RPC flags away */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags;
/* use alternate memory allocation routines */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC)
+ if (pProcHeader->Oi_flags & Oi_RPCSS_ALLOC_USED)
#if 0
NdrRpcSsEnableAllocate(&stubMsg);
#else
@@ -1389,7 +1388,7 @@ LONG WINAPI NdrStubCall2(
else
{
pFormat = convert_old_args( &stubMsg, pFormat, stack_size,
- pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT,
+ pProcHeader->Oi_flags & Oi_OBJECT_PROC,
/* reuse the correlation cache, it's not needed for v1 format */
NdrCorrCache, sizeof(NdrCorrCache), &number_of_params );
}
@@ -1413,7 +1412,7 @@ LONG WINAPI NdrStubCall2(
SERVER_ROUTINE func;
LONG_PTR retval;
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
SERVER_ROUTINE *vtbl = *(SERVER_ROUTINE **)((CStdStubBuffer *)pThis)->pvServerObject;
func = vtbl[pRpcMsg->ProcNum];
@@ -1438,7 +1437,7 @@ LONG WINAPI NdrStubCall2(
break;
case STUBLESS_GETBUFFER:
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
NdrStubGetBuffer(pThis, pChannel, &stubMsg);
else
{
@@ -1480,7 +1479,7 @@ LONG WINAPI NdrStubCall2(
}
/* free the full pointer translation tables */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
NdrFullPointerXlatFree(stubMsg.FullPtrXlatTables);
/* free server function stack */
@@ -1565,7 +1564,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
async_call_data->pStubMsg = pStubMsg = (PMIDL_STUB_MESSAGE)(async_call_data + 1);
pRpcMsg = (PRPC_MESSAGE)(pStubMsg + 1);
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
{
const NDR_PROC_HEADER_RPC *header_rpc = (const NDR_PROC_HEADER_RPC *)&pFormat[0];
async_call_data->stack_size = header_rpc->stack_size;
@@ -1582,10 +1581,10 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
TRACE("proc num: %d\n", procedure_number);
/* create the full pointer translation tables, if requested */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
pStubMsg->FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT);
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)
+ if (pProcHeader->Oi_flags & Oi_OBJECT_PROC)
{
ERR("objects not supported\n");
I_RpcFree(async_call_data);
@@ -1631,7 +1630,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
else
{
pFormat = convert_old_args( pStubMsg, pFormat, async_call_data->stack_size,
- pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT,
+ pProcHeader->Oi_flags & Oi_OBJECT_PROC,
async_call_data->NdrCorrCache, sizeof(async_call_data->NdrCorrCache),
&async_call_data->number_of_params );
}
@@ -1641,11 +1640,11 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
pStubMsg->BufferLength = 0;
/* store the RPC flags away */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS)
+ if (pProcHeader->Oi_flags & Oi_HAS_RPCFLAGS)
pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags;
/* use alternate memory allocation routines */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC)
+ if (pProcHeader->Oi_flags & Oi_RPCSS_ALLOC_USED)
NdrRpcSmSetClientToOsf(pStubMsg);
if (Oif_flags.HasPipes)
@@ -1684,7 +1683,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
FIXME("pipes not supported yet\n");
else
{
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding);
#else
@@ -1711,7 +1710,7 @@ LONG_PTR CDECL DECLSPEC_HIDDEN ndr_async_client_call( PMIDL_STUB_DESC pStubDesc,
FIXME("pipes not supported yet\n");
else
{
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsSend(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
@@ -1761,7 +1760,7 @@ RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply)
TRACE( "RECEIVE\n" );
pStubMsg->RpcMsg->RpcFlags |= RPC_BUFFER_ASYNC;
/* receive the [out] params */
- if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE)
+ if (pProcHeader->handle_type == FC_AUTO_HANDLE)
#if 0
NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle);
#else
@@ -1798,7 +1797,7 @@ cleanup:
}
/* free the full pointer translation tables */
- if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR)
+ if (pProcHeader->Oi_flags & Oi_FULL_PTR_USED)
NdrFullPointerXlatFree(pStubMsg->FullPtrXlatTables);
/* free marshalling buffer */
diff --git a/dlls/rpcrt4/ndr_stubless.h b/dlls/rpcrt4/ndr_stubless.h
index 2e7beba..ebdb8c8 100644
--- a/dlls/rpcrt4/ndr_stubless.h
+++ b/dlls/rpcrt4/ndr_stubless.h
@@ -26,16 +26,16 @@
typedef struct _NDR_PROC_HEADER
{
/* type of handle to use:
- * RPC_FC_BIND_EXPLICIT = 0 - Explicit handle.
+ * 0 - Explicit handle.
* Handle is passed as a parameter to the function.
* Indicates that explicit handle information follows the header,
* which actually describes the handle.
- * RPC_FC_BIND_GENERIC = 31 - Implicit handle with custom binding routines
+ * FC_BIND_GENERIC = 31 - Implicit handle with custom binding routines
* (MIDL_STUB_DESC::IMPLICIT_HANDLE_INFO::pGenericBindingInfo)
- * RPC_FC_BIND_PRIMITIVE = 32 - Implicit handle using handle_t created by
+ * FC_BIND_PRIMITIVE = 32 - Implicit handle using handle_t created by
* calling application
- * RPC_FC_AUTO_HANDLE = 33 - Automatic handle
- * RPC_FC_CALLBACK_HANDLE = 34 - Implicit handle used for a callback: current handle
+ * FC_AUTO_HANDLE = 33 - Automatic handle
+ * FC_CALLBACK_HANDLE = 34 - Implicit handle used for a callback: current handle
* from last remote call
*/
unsigned char handle_type;
@@ -95,13 +95,11 @@ typedef struct _NDR_PROC_HEADER_RPC
typedef struct _NDR_PROC_PARTIAL_OIF_HEADER
{
/* the pre-computed client buffer size so that interpreter can skip all
- * or some (if the flag RPC_FC_PROC_OI2F_CLTMUSTSIZE is specified) of the
- * sizing pass */
+ * or some (if the flag ClientMustSize is specified) of the sizing pass */
unsigned short constant_client_buffer_size;
/* the pre-computed server buffer size so that interpreter can skip all
- * or some (if the flag RPC_FC_PROC_OI2F_SRVMUSTSIZE is specified) of the
- * sizing pass */
+ * or some (if the flag ServerMustSize is specified) of the sizing pass */
unsigned short constant_server_buffer_size;
INTERPRETER_OPT_FLAGS Oi2Flags;
--
2.7.4
June 13, 2018
[PATCH 1/3] ndrtypes.h: Add more constants.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
include/ndrtypes.h | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 124 insertions(+)
diff --git a/include/ndrtypes.h b/include/ndrtypes.h
index b353ce5..938dc65 100644
--- a/include/ndrtypes.h
+++ b/include/ndrtypes.h
@@ -168,8 +168,113 @@ typedef enum
FC_SMVARRAY, /* 0x1f */ /* small (<64k) varying array */
FC_LGVARRAY, /* 0x20 */ /* large (>= 64k) varying array */
FC_BOGUS_ARRAY, /* 0x21 */ /* complex array */
+
+ FC_C_CSTRING, /* 0x22 */ /* conformant char string */
+ FC_C_BSTRING, /* 0x23 */
+ FC_C_SSTRING, /* 0x24 */
+ FC_C_WSTRING, /* 0x25 */ /* conformant wchar string */
+ FC_CSTRING, /* 0x26 */ /* non-conformant char string */
+ FC_BSTRING, /* 0x27 */
+ FC_SSTRING, /* 0x28 */
+ FC_WSTRING, /* 0x29 */ /* non-conformant wchar string */
+
+ FC_ENCAPSULATED_UNION, /* 0x2a */
+ FC_NON_ENCAPSULATED_UNION, /* 0x2b */
+
+ FC_BYTE_COUNT_POINTER, /* 0x2c */ /* [byte_count] ACF attribute */
+
+ FC_TRANSMIT_AS, /* 0x2d */
+ FC_REPRESENT_AS, /* 0x2e */
+
+ FC_IP, /* 0x2f */ /* interface pointer */
+
+ FC_BIND_CONTEXT, /* 0x30 */
+
+ FC_BIND_GENERIC, /* 0x31 */
+ FC_BIND_PRIMITIVE, /* 0x32 */
+ FC_AUTO_HANDLE, /* 0x33 */
+ FC_CALLBACK_HANDLE, /* 0x34 */
+
+ FC_UNUSED1, /* 0x35 */
+
+ FC_POINTER, /* 0x36 */
+
+ FC_ALIGNM2, /* 0x37 */
+ FC_ALIGNM4, /* 0x38 */
+ FC_ALIGNM8, /* 0x39 */
+
+ FC_UNUSED2, /* 0x3a */
+ FC_UNUSED3, /* 0x3b */
+ FC_UNUSED4, /* 0x3c */
+
+ FC_STRUCTPAD1, /* 0x3d */
+ FC_STRUCTPAD2, /* 0x3e */
+ FC_STRUCTPAD3, /* 0x3f */
+ FC_STRUCTPAD4, /* 0x40 */
+ FC_STRUCTPAD5, /* 0x41 */
+ FC_STRUCTPAD6, /* 0x42 */
+ FC_STRUCTPAD7, /* 0x43 */
+
+ FC_STRING_SIZED, /* 0x44 */
+
+ FC_UNUSED5, /* 0x45 */
+
+ FC_NO_REPEAT, /* 0x46 */
+ FC_FIXED_REPEAT, /* 0x47 */
+ FC_VARIABLE_REPEAT, /* 0x48 */
+ FC_FIXED_OFFSET, /* 0x49 */
+ FC_VARIABLE_OFFSET, /* 0x4a */
+
+ FC_PP, /* 0x4b */ /* pointer layout */
+/* FC_PP: FC_PAD layouts */
+/* layouts: FC_NO_REPEAT FC_PAD instance */
+/* instance: NdrFcShort(memofs), NdrFcShort(bufofs), desc */
+
+ FC_EMBEDDED_COMPLEX, /* 0x4c */
+
+ FC_IN_PARAM, /* 0x4d */
+ FC_IN_PARAM_BASETYPE, /* 0x4e */
+ FC_IN_PARAM_NO_FREE_INST, /* 0x4f */
+ FC_IN_OUT_PARAM, /* 0x50 */
+ FC_OUT_PARAM, /* 0x51 */
+ FC_RETURN_PARAM, /* 0x52 */
+ FC_RETURN_PARAM_BASETYPE, /* 0x53 */
+
+ FC_DEREFERENCE, /* 0x54 */
+ FC_DIV_2, /* 0x55 */
+ FC_MULT_2, /* 0x56 */
+ FC_ADD_1, /* 0x57 */
+ FC_SUB_1, /* 0x58 */
+
+ FC_CALLBACK, /* 0x59 */
+
+ FC_CONSTANT_IID, /* 0x5a */
+
+ FC_END, /* 0x5b */
+ FC_PAD, /* 0x5c */
+
+ FC_HARD_STRUCT = 0xb1,
+
+ FC_TRANSMIT_AS_PTR, /* 0xb2 */
+ FC_REPRESENT_AS_PTR, /* 0xb3 */
+
+ FC_USER_MARSHAL, /* 0xb4 */
+
+ FC_PIPE, /* 0xb5 */
+ FC_BLKHOLE, /* 0xb6 */
+
+ FC_RANGE, /* 0xb7 */
+
+ FC_INT3264, /* 0xb8 */
+ FC_UINT3264, /* 0xb9 */
} FORMAT_CHARACTER;
+#define FC_ALLOCATE_ALL_NODES 0x01
+#define FC_DONT_FREE 0x02
+#define FC_ALLOCED_ON_STACK 0x04
+#define FC_SIMPLE_POINTER 0x08
+#define FC_POINTER_DEREF 0x10
+
/* flags for all handle types */
#define HANDLE_PARAM_IS_VIA_PTR 0x80
#define HANDLE_PARAM_IS_IN 0x40
@@ -182,4 +287,23 @@ typedef enum
#define NDR_CONTEXT_HANDLE_SERIALIZE 0x02
#define NDR_CONTEXT_HANDLE_CANNOT_BE_NULL 0x01
+#define Oi_FULL_PTR_USED 0x01
+#define Oi_RPCSS_ALLOC_USED 0x02
+#define Oi_OBJECT_PROC 0x04
+#define Oi_HAS_RPCFLAGS 0x08
+#define Oi_OBJ_USE_V2_INTERPRETER 0x20
+#define Oi_HAS_COMM_OR_FAULT 0x20
+#define Oi_USE_NEW_INIT_ROUTINES 0x40
+
+#define FC_NORMAL_CONFORMANCE (unsigned char) 0x00
+#define FC_POINTER_CONFORMANCE (unsigned char) 0x10
+#define FC_TOP_LEVEL_CONFORMANCE (unsigned char) 0x20
+#define FC_CONSTANT_CONFORMANCE (unsigned char) 0x40
+#define FC_TOP_LEVEL_MULTID_CONFORMANCE (unsigned char) 0x80
+
+#define USER_MARSHAL_UNIQUE 0x80
+#define USER_MARSHAL_REF 0x40
+#define USER_MARSHAL_POINTER 0xc0
+#define USER_MARSHAL_IID 0x20
+
#endif
--
2.7.4
June 13, 2018
Wine staging 3.10 release
by Alistair Leslie-Hughes
Binary packages for various distributions will be available from:
https://www.winehq.org/download
Summary of the past few weeks
* Rebased to current wine 3.10 (905 patches are applied to wine vanilla)
* Reviewed and upstreamed patches.
Added
* d3d11: Align deferred map info buffers to a 16 byte boundry.
* wintab32: Improved tablet/stylus support.
* winex11: Detect Vulkan library at runtime.
* UIAnimation: New dll.
* bcypt32: BCryptGenerateKeyPair/BCryptFinalizeKeyPair stubs
Where can you help
* Run Steam/Battle.net/UPlay.
* Try you favorite game: Assassin's Creed Syndicate, Gunsmith
* Test your favorite applications.
* Steal staging patches and get them accepted upstream.
As always, if you find a bug, please report it via
https://bugs.winehq.org
Best Regards
Alistair.
June 13, 2018
[PATCH v2 4/5] winedbg: Add a backend-specific vector for retrieving a thread's context.
by Zebediah Figura
This and the next patch remove references to specific context structs or
fields elsewhere than in the backends.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
v2: fix copy/paste error (thanks Jozef).
programs/winedbg/be_arm.c | 11 +++++++++++
programs/winedbg/be_arm64.c | 11 +++++++++++
programs/winedbg/be_cpu.h | 3 +++
programs/winedbg/be_i386.c | 7 +++++++
programs/winedbg/be_ppc.c | 11 +++++++++++
programs/winedbg/be_x86_64.c | 11 +++++++++++
programs/winedbg/gdbproxy.c | 2 +-
programs/winedbg/stack.c | 4 +---
programs/winedbg/tgt_active.c | 14 +-------------
9 files changed, 57 insertions(+), 17 deletions(-)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c
index b7e42e1..a0e8027 100644
--- a/programs/winedbg/be_arm.c
+++ b/programs/winedbg/be_arm.c
@@ -1889,6 +1889,16 @@ static BOOL be_arm_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
return memory_write_value(lvalue, size, &val);
}
+static BOOL be_arm_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __arm__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug an ARM process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_arm =
{
IMAGE_FILE_MACHINE_ARMNT,
@@ -1915,5 +1925,6 @@ struct backend_cpu be_arm =
be_arm_fetch_integer,
be_arm_fetch_float,
be_arm_store_integer,
+ be_arm_get_context,
};
#endif
diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c
index dfeb552..6aa26a6 100644
--- a/programs/winedbg/be_arm64.c
+++ b/programs/winedbg/be_arm64.c
@@ -278,6 +278,16 @@ void be_arm64_disasm_one_insn(ADDRESS64 *addr, int display)
dbg_printf("be_arm64_disasm_one_insn: not done\n");
}
+static BOOL be_arm64_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __aarch64__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug an ARM64 process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_arm64 =
{
IMAGE_FILE_MACHINE_ARM64,
@@ -304,5 +314,6 @@ struct backend_cpu be_arm64 =
be_arm64_fetch_integer,
be_arm64_fetch_float,
be_arm64_store_integer,
+ be_arm64_get_context,
};
#endif
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index 03776d0..aa7d9f0 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -21,6 +21,7 @@
enum be_cpu_addr {be_cpu_addr_pc, be_cpu_addr_stack, be_cpu_addr_frame};
enum be_xpoint_type {be_xpoint_break, be_xpoint_watch_exec, be_xpoint_watch_read,
be_xpoint_watch_write, be_xpoint_free=-1};
+
struct backend_cpu
{
const DWORD machine;
@@ -114,6 +115,8 @@ struct backend_cpu
BOOL (*fetch_float)(const struct dbg_lvalue* lvalue, unsigned size, long double*);
/* Writes an integer to memory */
BOOL (*store_integer)(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG);
+
+ BOOL (*get_context)(HANDLE thread, dbg_ctx_t *ctx);
};
/* some handy functions for non segmented CPUs */
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index bdc2ece..c7f5ac1 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -853,6 +853,12 @@ static BOOL be_i386_store_integer(const struct dbg_lvalue* lvalue, unsigned size
return memory_write_value(lvalue, size, &val);
}
+static BOOL be_i386_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+ ctx->x86.ContextFlags = WOW64_CONTEXT_ALL;
+ return Wow64GetThreadContext(thread, &ctx->x86);
+}
+
struct backend_cpu be_i386 =
{
IMAGE_FILE_MACHINE_I386,
@@ -879,5 +885,6 @@ struct backend_cpu be_i386 =
be_i386_fetch_integer,
be_i386_fetch_float,
be_i386_store_integer,
+ be_i386_get_context,
};
#endif
diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c
index f1543bf..baf77dc 100644
--- a/programs/winedbg/be_ppc.c
+++ b/programs/winedbg/be_ppc.c
@@ -180,6 +180,16 @@ static BOOL be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
return FALSE;
}
+static BOOL be_ppc_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __powerpc__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug a PowerPC process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_ppc =
{
IMAGE_FILE_MACHINE_POWERPC,
@@ -206,5 +216,6 @@ struct backend_cpu be_ppc =
be_ppc_fetch_integer,
be_ppc_fetch_float,
be_ppc_store_integer,
+ be_ppc_get_context,
};
#endif
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 450cc87..434f007 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -674,6 +674,16 @@ static BOOL be_x86_64_store_integer(const struct dbg_lvalue* lvalue, unsigned si
return memory_write_value(lvalue, size, &val);
}
+static BOOL be_x86_64_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __x86_64__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug an x86-64 process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_x86_64 =
{
IMAGE_FILE_MACHINE_AMD64,
@@ -700,5 +710,6 @@ struct backend_cpu be_x86_64 =
be_x86_64_fetch_integer,
be_x86_64_fetch_float,
be_x86_64_store_integer,
+ be_x86_64_get_context,
};
#endif
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index d5786b2..b11a8b0 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -552,7 +552,7 @@ static inline void cpu_register_hex_from(dbg_ctx_t* ctx, unsigned idx, const cha
static BOOL fetch_context(struct gdb_context *gdbctx, HANDLE h, dbg_ctx_t *ctx)
{
- if (!GetThreadContext(h, &ctx->ctx))
+ if (!gdbctx->process->be_cpu->get_context(h, ctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Can't get thread's context\n");
diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index a036107..820200d 100644
--- a/programs/winedbg/stack.c
+++ b/programs/winedbg/stack.c
@@ -354,11 +354,9 @@ static void backtrace_tid(struct dbg_process* pcs, DWORD tid)
dbg_ctx_t ctx = {0};
dbg_curr_tid = dbg_curr_thread->tid;
-
- ctx.ctx.ContextFlags = CONTEXT_FULL;
if (SuspendThread(dbg_curr_thread->handle) != -1)
{
- if (!GetThreadContext(dbg_curr_thread->handle, &ctx.ctx))
+ if (!pcs->be_cpu->get_context(dbg_curr_thread->handle, &ctx))
{
dbg_printf("Can't get context for thread %04x in current process\n",
tid);
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 8c94402..fccae0c 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -91,19 +91,7 @@ BOOL dbg_attach_debuggee(DWORD pid, BOOL cofe)
static unsigned dbg_fetch_context(void)
{
- dbg_context.ctx.ContextFlags = CONTEXT_CONTROL
- | CONTEXT_INTEGER
-#ifdef CONTEXT_FLOATING_POINT
- | CONTEXT_FLOATING_POINT
-#endif
-#ifdef CONTEXT_SEGMENTS
- | CONTEXT_SEGMENTS
-#endif
-#ifdef CONTEXT_DEBUG_REGISTERS
- | CONTEXT_DEBUG_REGISTERS
-#endif
- ;
- if (!GetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx))
+ if (!dbg_curr_process->be_cpu->get_context(dbg_curr_thread->handle, &dbg_context))
{
WINE_WARN("Can't get thread's context\n");
return FALSE;
--
2.7.4
June 13, 2018
[PATCH 5/5] winedbg: Add a backend-specific vector for setting a thread's context.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/be_arm.c | 5 +++++
programs/winedbg/be_arm64.c | 5 +++++
programs/winedbg/be_cpu.h | 1 +
programs/winedbg/be_i386.c | 6 ++++++
programs/winedbg/be_ppc.c | 6 ++++++
programs/winedbg/be_x86_64.c | 6 ++++++
programs/winedbg/gdbproxy.c | 10 ++++++----
programs/winedbg/tgt_active.c | 6 +++---
programs/winedbg/tgt_minidump.c | 8 ++++++++
9 files changed, 46 insertions(+), 7 deletions(-)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c
index c320704..4aa7260 100644
--- a/programs/winedbg/be_arm.c
+++ b/programs/winedbg/be_arm.c
@@ -1899,6 +1899,11 @@ static BOOL be_arm_get_context(HANDLE thread, dbg_ctx_t *ctx)
#endif
}
+static BOOL be_arm_set_context(HANDLE thread, const dbg_ctx_t *ctx)
+{
+ return SetThreadContext(thread, &ctx->ctx);
+}
+
struct backend_cpu be_arm =
{
IMAGE_FILE_MACHINE_ARMNT,
diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c
index 8ee4fb9..9cc05bb 100644
--- a/programs/winedbg/be_arm64.c
+++ b/programs/winedbg/be_arm64.c
@@ -288,6 +288,11 @@ static BOOL be_arm64_get_context(HANDLE thread, dbg_ctx_t *ctx)
#endif
}
+static BOOL be_arm64_set_context(HANDLE thread, const dbg_ctx_t *ctx)
+{
+ return SetThreadContext(thread, &ctx->ctx);
+}
+
struct backend_cpu be_arm64 =
{
IMAGE_FILE_MACHINE_ARM64,
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index aa7d9f0..1a67c06 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -117,6 +117,7 @@ struct backend_cpu
BOOL (*store_integer)(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG);
BOOL (*get_context)(HANDLE thread, dbg_ctx_t *ctx);
+ BOOL (*set_context)(HANDLE thread, const dbg_ctx_t *ctx);
};
/* some handy functions for non segmented CPUs */
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index c7f5ac1..f46ebb1 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -859,6 +859,11 @@ static BOOL be_i386_get_context(HANDLE thread, dbg_ctx_t *ctx)
return Wow64GetThreadContext(thread, &ctx->x86);
}
+static BOOL be_i386_set_context(HANDLE thread, const dbg_ctx_t *ctx)
+{
+ return Wow64SetThreadContext(thread, &ctx->x86);
+}
+
struct backend_cpu be_i386 =
{
IMAGE_FILE_MACHINE_I386,
@@ -886,5 +891,6 @@ struct backend_cpu be_i386 =
be_i386_fetch_float,
be_i386_store_integer,
be_i386_get_context,
+ be_i386_set_context,
};
#endif
diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c
index baf77dc..40aee55 100644
--- a/programs/winedbg/be_ppc.c
+++ b/programs/winedbg/be_ppc.c
@@ -190,6 +190,11 @@ static BOOL be_ppc_get_context(HANDLE thread, dbg_ctx_t *ctx)
#endif
}
+static BOOL be_ppc_set_context(HANDLE thread, const dbg_ctx_t *ctx)
+{
+ return SetThreadContext(thread, &ctx->ctx);
+}
+
struct backend_cpu be_ppc =
{
IMAGE_FILE_MACHINE_POWERPC,
@@ -217,5 +222,6 @@ struct backend_cpu be_ppc =
be_ppc_fetch_float,
be_ppc_store_integer,
be_ppc_get_context,
+ be_ppc_set_context,
};
#endif
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 434f007..15f84a6 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -684,6 +684,11 @@ static BOOL be_x86_64_get_context(HANDLE thread, dbg_ctx_t *ctx)
#endif
}
+static BOOL be_x86_64_set_context(HANDLE thread, const dbg_ctx_t *ctx)
+{
+ return SetThreadContext(thread, &ctx->ctx);
+}
+
struct backend_cpu be_x86_64 =
{
IMAGE_FILE_MACHINE_AMD64,
@@ -711,5 +716,6 @@ struct backend_cpu be_x86_64 =
be_x86_64_fetch_float,
be_x86_64_store_integer,
be_x86_64_get_context,
+ be_x86_64_set_context,
};
#endif
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index b11a8b0..81cd7de 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -768,7 +768,7 @@ static void resume_debuggee(struct gdb_context* gdbctx, DWORD cont)
{
if (dbg_curr_thread)
{
- if (!SetThreadContext(dbg_curr_thread->handle, &gdbctx->context.ctx))
+ if (!gdbctx->process->be_cpu->set_context(dbg_curr_thread->handle, &gdbctx->context))
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context on thread %04x\n", dbg_curr_thread->tid);
if (!ContinueDebugEvent(gdbctx->process->pid, dbg_curr_thread->tid, cont))
@@ -788,7 +788,7 @@ static void resume_debuggee_thread(struct gdb_context* gdbctx, DWORD cont, unsig
{
if(dbg_curr_thread->tid == threadid){
/* Windows debug and GDB don't seem to work well here, windows only likes ContinueDebugEvent being used on the reporter of the event */
- if (!SetThreadContext(dbg_curr_thread->handle, &gdbctx->context.ctx))
+ if (!gdbctx->process->be_cpu->set_context(dbg_curr_thread->handle, &gdbctx->context))
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context on thread %04x\n", dbg_curr_thread->tid);
if (!ContinueDebugEvent(gdbctx->process->pid, dbg_curr_thread->tid, cont))
@@ -1478,7 +1478,8 @@ static enum packet_return packet_write_registers(struct gdb_context* gdbctx)
for (i = 0; i < cpu_num_regs; i++)
cpu_register_hex_from(pctx, i, &ptr);
- if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, &pctx->ctx))
+ if (pctx != &gdbctx->context &&
+ !gdbctx->process->be_cpu->set_context(gdbctx->other_thread->handle, pctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context on thread %04x\n", gdbctx->other_thread->tid);
@@ -1677,7 +1678,8 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
}
cpu_register_hex_from(pctx, reg, (const char**)&ptr);
- if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, &pctx->ctx))
+ if (pctx != &gdbctx->context &&
+ !gdbctx->process->be_cpu->set_context(gdbctx->other_thread->handle, pctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context for thread %04x\n", gdbctx->other_thread->tid);
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index fccae0c..e5fd07d 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -344,7 +344,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
de->u.Exception.dwFirstChance);
if (cont && dbg_curr_thread)
{
- SetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx);
+ dbg_curr_process->be_cpu->set_context(dbg_curr_thread->handle, &dbg_context);
}
}
break;
@@ -527,7 +527,7 @@ static void dbg_resume_debuggee(DWORD cont)
dbg_curr_thread->exec_count);
if (dbg_curr_thread)
{
- if (!SetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx))
+ if (!dbg_curr_process->be_cpu->set_context(dbg_curr_thread->handle, &dbg_context))
dbg_printf("Cannot set ctx on %04lx\n", dbg_curr_tid);
}
}
@@ -989,7 +989,7 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
dbg_curr_process->be_cpu->single_step(&dbg_context, FALSE);
if (dbg_curr_thread->in_exception)
{
- SetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx);
+ dbg_curr_process->be_cpu->set_context(dbg_curr_thread->handle, &dbg_context);
ContinueDebugEvent(dbg_curr_pid, dbg_curr_tid, DBG_CONTINUE);
}
}
diff --git a/programs/winedbg/tgt_minidump.c b/programs/winedbg/tgt_minidump.c
index f168633..95af7a6 100644
--- a/programs/winedbg/tgt_minidump.c
+++ b/programs/winedbg/tgt_minidump.c
@@ -59,6 +59,14 @@ void minidump_write(const char* file, const EXCEPTION_RECORD* rec)
MINIDUMP_EXCEPTION_INFORMATION mei;
EXCEPTION_POINTERS ep;
+#ifdef __x86_64__
+ if (dbg_curr_process->be_cpu->machine != IMAGE_FILE_MACHINE_AMD64)
+ {
+ FIXME("Cannot write minidump for 32-bit process using 64-bit winedbg\n");
+ return;
+ }
+#endif
+
hFile = CreateFileA(file, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
--
2.7.4
June 12, 2018
[PATCH 4/5] winedbg: Add a backend-specific vector for retrieving a thread's context.
by Zebediah Figura
This and the next patch remove references to specific context structs or
fields elsewhere than in the backends.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/be_arm.c | 11 +++++++++++
programs/winedbg/be_arm64.c | 11 +++++++++++
programs/winedbg/be_cpu.h | 3 +++
programs/winedbg/be_i386.c | 7 +++++++
programs/winedbg/be_ppc.c | 11 +++++++++++
programs/winedbg/be_x86_64.c | 11 +++++++++++
programs/winedbg/gdbproxy.c | 2 +-
programs/winedbg/stack.c | 4 +---
programs/winedbg/tgt_active.c | 14 +-------------
9 files changed, 57 insertions(+), 17 deletions(-)
diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c
index b7e42e1..c320704 100644
--- a/programs/winedbg/be_arm.c
+++ b/programs/winedbg/be_arm.c
@@ -1889,6 +1889,16 @@ static BOOL be_arm_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
return memory_write_value(lvalue, size, &val);
}
+static BOOL be_arm_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __x86_64__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug an ARM process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_arm =
{
IMAGE_FILE_MACHINE_ARMNT,
@@ -1915,5 +1925,6 @@ struct backend_cpu be_arm =
be_arm_fetch_integer,
be_arm_fetch_float,
be_arm_store_integer,
+ be_arm_get_context,
};
#endif
diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c
index dfeb552..8ee4fb9 100644
--- a/programs/winedbg/be_arm64.c
+++ b/programs/winedbg/be_arm64.c
@@ -278,6 +278,16 @@ void be_arm64_disasm_one_insn(ADDRESS64 *addr, int display)
dbg_printf("be_arm64_disasm_one_insn: not done\n");
}
+static BOOL be_arm64_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __x86_64__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug an ARM64 process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_arm64 =
{
IMAGE_FILE_MACHINE_ARM64,
@@ -304,5 +314,6 @@ struct backend_cpu be_arm64 =
be_arm64_fetch_integer,
be_arm64_fetch_float,
be_arm64_store_integer,
+ be_arm64_get_context,
};
#endif
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index 03776d0..aa7d9f0 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -21,6 +21,7 @@
enum be_cpu_addr {be_cpu_addr_pc, be_cpu_addr_stack, be_cpu_addr_frame};
enum be_xpoint_type {be_xpoint_break, be_xpoint_watch_exec, be_xpoint_watch_read,
be_xpoint_watch_write, be_xpoint_free=-1};
+
struct backend_cpu
{
const DWORD machine;
@@ -114,6 +115,8 @@ struct backend_cpu
BOOL (*fetch_float)(const struct dbg_lvalue* lvalue, unsigned size, long double*);
/* Writes an integer to memory */
BOOL (*store_integer)(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG);
+
+ BOOL (*get_context)(HANDLE thread, dbg_ctx_t *ctx);
};
/* some handy functions for non segmented CPUs */
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index bdc2ece..c7f5ac1 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -853,6 +853,12 @@ static BOOL be_i386_store_integer(const struct dbg_lvalue* lvalue, unsigned size
return memory_write_value(lvalue, size, &val);
}
+static BOOL be_i386_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+ ctx->x86.ContextFlags = WOW64_CONTEXT_ALL;
+ return Wow64GetThreadContext(thread, &ctx->x86);
+}
+
struct backend_cpu be_i386 =
{
IMAGE_FILE_MACHINE_I386,
@@ -879,5 +885,6 @@ struct backend_cpu be_i386 =
be_i386_fetch_integer,
be_i386_fetch_float,
be_i386_store_integer,
+ be_i386_get_context,
};
#endif
diff --git a/programs/winedbg/be_ppc.c b/programs/winedbg/be_ppc.c
index f1543bf..baf77dc 100644
--- a/programs/winedbg/be_ppc.c
+++ b/programs/winedbg/be_ppc.c
@@ -180,6 +180,16 @@ static BOOL be_ppc_store_integer(const struct dbg_lvalue* lvalue, unsigned size,
return FALSE;
}
+static BOOL be_ppc_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __powerpc__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug a PowerPC process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_ppc =
{
IMAGE_FILE_MACHINE_POWERPC,
@@ -206,5 +216,6 @@ struct backend_cpu be_ppc =
be_ppc_fetch_integer,
be_ppc_fetch_float,
be_ppc_store_integer,
+ be_ppc_get_context,
};
#endif
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 450cc87..434f007 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -674,6 +674,16 @@ static BOOL be_x86_64_store_integer(const struct dbg_lvalue* lvalue, unsigned si
return memory_write_value(lvalue, size, &val);
}
+static BOOL be_x86_64_get_context(HANDLE thread, dbg_ctx_t *ctx)
+{
+#ifdef __x86_64__
+ ctx->ctx.ContextFlags = CONTEXT_ALL;
+ return GetThreadContext(thread, &ctx->ctx);
+#else
+ WINE_FIXME("Cannot debug an x86-64 process on this architecture.\n");
+#endif
+}
+
struct backend_cpu be_x86_64 =
{
IMAGE_FILE_MACHINE_AMD64,
@@ -700,5 +710,6 @@ struct backend_cpu be_x86_64 =
be_x86_64_fetch_integer,
be_x86_64_fetch_float,
be_x86_64_store_integer,
+ be_x86_64_get_context,
};
#endif
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index d5786b2..b11a8b0 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -552,7 +552,7 @@ static inline void cpu_register_hex_from(dbg_ctx_t* ctx, unsigned idx, const cha
static BOOL fetch_context(struct gdb_context *gdbctx, HANDLE h, dbg_ctx_t *ctx)
{
- if (!GetThreadContext(h, &ctx->ctx))
+ if (!gdbctx->process->be_cpu->get_context(h, ctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Can't get thread's context\n");
diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index a036107..820200d 100644
--- a/programs/winedbg/stack.c
+++ b/programs/winedbg/stack.c
@@ -354,11 +354,9 @@ static void backtrace_tid(struct dbg_process* pcs, DWORD tid)
dbg_ctx_t ctx = {0};
dbg_curr_tid = dbg_curr_thread->tid;
-
- ctx.ctx.ContextFlags = CONTEXT_FULL;
if (SuspendThread(dbg_curr_thread->handle) != -1)
{
- if (!GetThreadContext(dbg_curr_thread->handle, &ctx.ctx))
+ if (!pcs->be_cpu->get_context(dbg_curr_thread->handle, &ctx))
{
dbg_printf("Can't get context for thread %04x in current process\n",
tid);
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 8c94402..fccae0c 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -91,19 +91,7 @@ BOOL dbg_attach_debuggee(DWORD pid, BOOL cofe)
static unsigned dbg_fetch_context(void)
{
- dbg_context.ctx.ContextFlags = CONTEXT_CONTROL
- | CONTEXT_INTEGER
-#ifdef CONTEXT_FLOATING_POINT
- | CONTEXT_FLOATING_POINT
-#endif
-#ifdef CONTEXT_SEGMENTS
- | CONTEXT_SEGMENTS
-#endif
-#ifdef CONTEXT_DEBUG_REGISTERS
- | CONTEXT_DEBUG_REGISTERS
-#endif
- ;
- if (!GetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx))
+ if (!dbg_curr_process->be_cpu->get_context(dbg_curr_thread->handle, &dbg_context))
{
WINE_WARN("Can't get thread's context\n");
return FALSE;
--
2.7.4
June 12, 2018
[PATCH 3/5] winedbg: Use WOW64_CONTEXT instead of CONTEXT for i386 backend.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/be_cpu.h | 22 ++---
programs/winedbg/be_i386.c | 211 ++++++++++++++++++++--------------------
programs/winedbg/be_x86_64.c | 73 +++++++-------
programs/winedbg/debugger.h | 12 ++-
programs/winedbg/gdbproxy.c | 35 ++++---
programs/winedbg/memory.c | 2 +-
programs/winedbg/stack.c | 16 +--
programs/winedbg/tgt_active.c | 10 +-
programs/winedbg/tgt_minidump.c | 2 +-
programs/winedbg/winedbg.c | 2 +-
10 files changed, 199 insertions(+), 186 deletions(-)
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index 751ac9d..03776d0 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -37,13 +37,13 @@ struct backend_cpu
* in an ADDRESS64 (except an linear one).
* Non segmented CPU shall use be_cpu_build_addr
*/
- BOOL (*build_addr)(HANDLE hThread, const CONTEXT* ctx,
+ BOOL (*build_addr)(HANDLE hThread, const dbg_ctx_t *ctx,
ADDRESS64* addr, unsigned seg,
unsigned long offset);
/* Retrieves in addr an address related to the context (program counter, stack
* pointer, frame pointer)
*/
- BOOL (*get_addr)(HANDLE hThread, const CONTEXT* ctx,
+ BOOL (*get_addr)(HANDLE hThread, const dbg_ctx_t *ctx,
enum be_cpu_addr, ADDRESS64* addr);
/* returns which kind of information a given register number refers to */
@@ -53,13 +53,13 @@ struct backend_cpu
* context manipulation
* ------------------------------------------------------------------------------- */
/* Enables/disables CPU single step mode (depending on enable) */
- void (*single_step)(CONTEXT* ctx, BOOL enable);
+ void (*single_step)(dbg_ctx_t *ctx, BOOL enable);
/* Dumps out the content of the context */
- void (*print_context)(HANDLE hThread, const CONTEXT* ctx, int all_regs);
+ void (*print_context)(HANDLE hThread, const dbg_ctx_t *ctx, int all_regs);
/* Prints information about segments. Non segmented CPU should leave this
* function empty
*/
- void (*print_segment_info)(HANDLE hThread, const CONTEXT* ctx);
+ void (*print_segment_info)(HANDLE hThread, const dbg_ctx_t *ctx);
/* all the CONTEXT's relative variables, bound to this CPU */
const struct dbg_internal_var* context_vars;
@@ -89,22 +89,22 @@ struct backend_cpu
* -------------------------------------------------------------------------------*/
/* Inserts an Xpoint in the CPU context and/or debuggee address space */
BOOL (*insert_Xpoint)(HANDLE hProcess, const struct be_process_io* pio,
- CONTEXT* ctx, enum be_xpoint_type type,
+ dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size);
/* Removes an Xpoint in the CPU context and/or debuggee address space */
BOOL (*remove_Xpoint)(HANDLE hProcess, const struct be_process_io* pio,
- CONTEXT* ctx, enum be_xpoint_type type,
+ dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size);
/* Checks whether a given watchpoint has been triggered */
- BOOL (*is_watchpoint_set)(const CONTEXT* ctx, unsigned idx);
+ BOOL (*is_watchpoint_set)(const dbg_ctx_t *ctx, unsigned idx);
/* Clears the watchpoint indicator */
- void (*clear_watchpoint)(CONTEXT* ctx, unsigned idx);
+ void (*clear_watchpoint)(dbg_ctx_t *ctx, unsigned idx);
/* After a break instruction is executed, in the corresponding exception handler,
* some CPUs report the address of the insn after the break insn, some others
* report the address of the break insn itself.
* This function lets adjust the context PC to reflect this behavior.
*/
- int (*adjust_pc_for_break)(CONTEXT* ctx, BOOL way);
+ int (*adjust_pc_for_break)(dbg_ctx_t *ctx, BOOL way);
/* -------------------------------------------------------------------------------
* basic type read/write
* -------------------------------------------------------------------------------*/
@@ -118,5 +118,5 @@ struct backend_cpu
/* some handy functions for non segmented CPUs */
void* be_cpu_linearize(HANDLE hThread, const ADDRESS64*);
-BOOL be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
+BOOL be_cpu_build_addr(HANDLE hThread, const dbg_ctx_t *ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset);
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index 4d22708..bdc2ece 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -57,7 +57,7 @@ typedef struct _XMM_SAVE_AREA32 {
BYTE Reserved4[96]; /* 1a0 */
} XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
-static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD sel)
+static ADDRESS_MODE get_selector_type(HANDLE hThread, const WOW64_CONTEXT *ctx, WORD sel)
{
LDT_ENTRY le;
@@ -93,7 +93,7 @@ static void* be_i386_linearize(HANDLE hThread, const ADDRESS64* addr)
return NULL;
}
-static BOOL be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
+static BOOL be_i386_build_addr(HANDLE hThread, const dbg_ctx_t *ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset)
{
addr->Mode = AddrModeFlat;
@@ -101,7 +101,7 @@ static BOOL be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* ad
addr->Offset = offset;
if (seg)
{
- addr->Mode = get_selector_type(hThread, ctx, seg);
+ addr->Mode = get_selector_type(hThread, &ctx->x86, seg);
switch (addr->Mode)
{
case AddrModeReal:
@@ -119,17 +119,17 @@ static BOOL be_i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* ad
return TRUE;
}
-static BOOL be_i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
+static BOOL be_i386_get_addr(HANDLE hThread, const dbg_ctx_t *ctx,
enum be_cpu_addr bca, ADDRESS64* addr)
{
switch (bca)
{
case be_cpu_addr_pc:
- return be_i386_build_addr(hThread, ctx, addr, ctx->SegCs, ctx->Eip);
+ return be_i386_build_addr(hThread, ctx, addr, ctx->x86.SegCs, ctx->x86.Eip);
case be_cpu_addr_stack:
- return be_i386_build_addr(hThread, ctx, addr, ctx->SegSs, ctx->Esp);
+ return be_i386_build_addr(hThread, ctx, addr, ctx->x86.SegSs, ctx->x86.Esp);
case be_cpu_addr_frame:
- return be_i386_build_addr(hThread, ctx, addr, ctx->SegSs, ctx->Ebp);
+ return be_i386_build_addr(hThread, ctx, addr, ctx->x86.SegSs, ctx->x86.Ebp);
}
return FALSE;
}
@@ -145,16 +145,17 @@ static BOOL be_i386_get_register_info(int regno, enum be_cpu_addr* kind)
return FALSE;
}
-static void be_i386_single_step(CONTEXT* ctx, BOOL enable)
+static void be_i386_single_step(dbg_ctx_t *ctx, BOOL enable)
{
- if (enable) ctx->EFlags |= STEP_FLAG;
- else ctx->EFlags &= ~STEP_FLAG;
+ if (enable) ctx->x86.EFlags |= STEP_FLAG;
+ else ctx->x86.EFlags &= ~STEP_FLAG;
}
-static void be_i386_all_print_context(HANDLE hThread, const CONTEXT* ctx)
+static void be_i386_all_print_context(HANDLE hThread, const dbg_ctx_t *pctx)
{
static const char mxcsr_flags[16][4] = { "IE", "DE", "ZE", "OE", "UE", "PE", "DAZ", "IM",
"DM", "ZM", "OM", "UM", "PM", "R-", "R+", "FZ" };
+ const WOW64_CONTEXT *ctx = &pctx->x86;
XMM_SAVE_AREA32 *xmm_area;
long double ST[8]; /* These are for floating regs */
int cnt;
@@ -245,9 +246,10 @@ static void be_i386_all_print_context(HANDLE hThread, const CONTEXT* ctx)
dbg_printf("\n");
}
-static void be_i386_print_context(HANDLE hThread, const CONTEXT* ctx, int all_regs)
+static void be_i386_print_context(HANDLE hThread, const dbg_ctx_t *pctx, int all_regs)
{
static const char flags[] = "aVR-N--ODITSZ-A-P-C";
+ const WOW64_CONTEXT *ctx = &pctx->x86;
int i;
char buf[33];
@@ -287,72 +289,73 @@ static void be_i386_print_context(HANDLE hThread, const CONTEXT* ctx, int all_re
break;
}
- if (all_regs) be_i386_all_print_context(hThread, ctx); /* print floating regs */
+ if (all_regs) be_i386_all_print_context(hThread, pctx);
}
-static void be_i386_print_segment_info(HANDLE hThread, const CONTEXT* ctx)
+static void be_i386_print_segment_info(HANDLE hThread, const dbg_ctx_t *ctx)
{
- if (get_selector_type(hThread, ctx, ctx->SegCs) == AddrMode1616)
+ if (get_selector_type(hThread, &ctx->x86, ctx->x86.SegCs) == AddrMode1616)
{
- info_win32_segments(ctx->SegDs >> 3, 1);
- if (ctx->SegEs != ctx->SegDs) info_win32_segments(ctx->SegEs >> 3, 1);
+ info_win32_segments(ctx->x86.SegDs >> 3, 1);
+ if (ctx->x86.SegEs != ctx->x86.SegDs)
+ info_win32_segments(ctx->x86.SegEs >> 3, 1);
}
- info_win32_segments(ctx->SegFs >> 3, 1);
+ info_win32_segments(ctx->x86.SegFs >> 3, 1);
}
static struct dbg_internal_var be_i386_ctx[] =
{
- {CV_REG_AL, "AL", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Eax), dbg_itype_unsigned_char_int},
- {CV_REG_CL, "CL", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ecx), dbg_itype_unsigned_char_int},
- {CV_REG_DL, "DL", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Edx), dbg_itype_unsigned_char_int},
- {CV_REG_BL, "BL", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ebx), dbg_itype_unsigned_char_int},
- {CV_REG_AH, "AH", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, Eax)+1), dbg_itype_unsigned_char_int},
- {CV_REG_CH, "CH", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, Ecx)+1), dbg_itype_unsigned_char_int},
- {CV_REG_DH, "DH", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, Edx)+1), dbg_itype_unsigned_char_int},
- {CV_REG_BH, "BH", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, Ebx)+1), dbg_itype_unsigned_char_int},
- {CV_REG_AX, "AX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Eax), dbg_itype_unsigned_short_int},
- {CV_REG_CX, "CX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ecx), dbg_itype_unsigned_short_int},
- {CV_REG_DX, "DX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Edx), dbg_itype_unsigned_short_int},
- {CV_REG_BX, "BX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ebx), dbg_itype_unsigned_short_int},
- {CV_REG_SP, "SP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Esp), dbg_itype_unsigned_short_int},
- {CV_REG_BP, "BP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ebp), dbg_itype_unsigned_short_int},
- {CV_REG_SI, "SI", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Esi), dbg_itype_unsigned_short_int},
- {CV_REG_DI, "DI", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Edi), dbg_itype_unsigned_short_int},
- {CV_REG_EAX, "EAX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Eax), dbg_itype_unsigned_int},
- {CV_REG_ECX, "ECX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ecx), dbg_itype_unsigned_int},
- {CV_REG_EDX, "EDX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Edx), dbg_itype_unsigned_int},
- {CV_REG_EBX, "EBX", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ebx), dbg_itype_unsigned_int},
- {CV_REG_ESP, "ESP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Esp), dbg_itype_unsigned_int},
- {CV_REG_EBP, "EBP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Ebp), dbg_itype_unsigned_int},
- {CV_REG_ESI, "ESI", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Esi), dbg_itype_unsigned_int},
- {CV_REG_EDI, "EDI", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Edi), dbg_itype_unsigned_int},
- {CV_REG_ES, "ES", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, SegEs), dbg_itype_unsigned_short_int},
- {CV_REG_CS, "CS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, SegCs), dbg_itype_unsigned_short_int},
- {CV_REG_SS, "SS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, SegSs), dbg_itype_unsigned_short_int},
- {CV_REG_DS, "DS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, SegDs), dbg_itype_unsigned_short_int},
- {CV_REG_FS, "FS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, SegFs), dbg_itype_unsigned_short_int},
- {CV_REG_GS, "GS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, SegGs), dbg_itype_unsigned_short_int},
- {CV_REG_IP, "IP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Eip), dbg_itype_unsigned_short_int},
- {CV_REG_FLAGS, "FLAGS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, EFlags), dbg_itype_unsigned_short_int},
- {CV_REG_EIP, "EIP", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, Eip), dbg_itype_unsigned_int},
- {CV_REG_EFLAGS, "EFLAGS", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, EFlags), dbg_itype_unsigned_int},
- {CV_REG_ST0, "ST0", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[ 0]), dbg_itype_long_real},
- {CV_REG_ST0+1, "ST1", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[10]), dbg_itype_long_real},
- {CV_REG_ST0+2, "ST2", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[20]), dbg_itype_long_real},
- {CV_REG_ST0+3, "ST3", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[30]), dbg_itype_long_real},
- {CV_REG_ST0+4, "ST4", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[40]), dbg_itype_long_real},
- {CV_REG_ST0+5, "ST5", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[50]), dbg_itype_long_real},
- {CV_REG_ST0+6, "ST6", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[60]), dbg_itype_long_real},
- {CV_REG_ST0+7, "ST7", (DWORD_PTR*)FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[70]), dbg_itype_long_real},
- {CV_AMD64_XMM0, "XMM0", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[0])), dbg_itype_m128a},
- {CV_AMD64_XMM0+1, "XMM1", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[1])), dbg_itype_m128a},
- {CV_AMD64_XMM0+2, "XMM2", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[2])), dbg_itype_m128a},
- {CV_AMD64_XMM0+3, "XMM3", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[3])), dbg_itype_m128a},
- {CV_AMD64_XMM0+4, "XMM4", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[4])), dbg_itype_m128a},
- {CV_AMD64_XMM0+5, "XMM5", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[5])), dbg_itype_m128a},
- {CV_AMD64_XMM0+6, "XMM6", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[6])), dbg_itype_m128a},
- {CV_AMD64_XMM0+7, "XMM7", (DWORD_PTR*)(FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[7])), dbg_itype_m128a},
+ {CV_REG_AL, "AL", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Eax), dbg_itype_unsigned_char_int},
+ {CV_REG_CL, "CL", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ecx), dbg_itype_unsigned_char_int},
+ {CV_REG_DL, "DL", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Edx), dbg_itype_unsigned_char_int},
+ {CV_REG_BL, "BL", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ebx), dbg_itype_unsigned_char_int},
+ {CV_REG_AH, "AH", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, Eax)+1), dbg_itype_unsigned_char_int},
+ {CV_REG_CH, "CH", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, Ecx)+1), dbg_itype_unsigned_char_int},
+ {CV_REG_DH, "DH", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, Edx)+1), dbg_itype_unsigned_char_int},
+ {CV_REG_BH, "BH", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, Ebx)+1), dbg_itype_unsigned_char_int},
+ {CV_REG_AX, "AX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Eax), dbg_itype_unsigned_short_int},
+ {CV_REG_CX, "CX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ecx), dbg_itype_unsigned_short_int},
+ {CV_REG_DX, "DX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Edx), dbg_itype_unsigned_short_int},
+ {CV_REG_BX, "BX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ebx), dbg_itype_unsigned_short_int},
+ {CV_REG_SP, "SP", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Esp), dbg_itype_unsigned_short_int},
+ {CV_REG_BP, "BP", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ebp), dbg_itype_unsigned_short_int},
+ {CV_REG_SI, "SI", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Esi), dbg_itype_unsigned_short_int},
+ {CV_REG_DI, "DI", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Edi), dbg_itype_unsigned_short_int},
+ {CV_REG_EAX, "EAX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Eax), dbg_itype_unsigned_int},
+ {CV_REG_ECX, "ECX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ecx), dbg_itype_unsigned_int},
+ {CV_REG_EDX, "EDX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Edx), dbg_itype_unsigned_int},
+ {CV_REG_EBX, "EBX", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ebx), dbg_itype_unsigned_int},
+ {CV_REG_ESP, "ESP", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Esp), dbg_itype_unsigned_int},
+ {CV_REG_EBP, "EBP", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Ebp), dbg_itype_unsigned_int},
+ {CV_REG_ESI, "ESI", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Esi), dbg_itype_unsigned_int},
+ {CV_REG_EDI, "EDI", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Edi), dbg_itype_unsigned_int},
+ {CV_REG_ES, "ES", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, SegEs), dbg_itype_unsigned_short_int},
+ {CV_REG_CS, "CS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, SegCs), dbg_itype_unsigned_short_int},
+ {CV_REG_SS, "SS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, SegSs), dbg_itype_unsigned_short_int},
+ {CV_REG_DS, "DS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, SegDs), dbg_itype_unsigned_short_int},
+ {CV_REG_FS, "FS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, SegFs), dbg_itype_unsigned_short_int},
+ {CV_REG_GS, "GS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, SegGs), dbg_itype_unsigned_short_int},
+ {CV_REG_IP, "IP", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Eip), dbg_itype_unsigned_short_int},
+ {CV_REG_FLAGS, "FLAGS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, EFlags), dbg_itype_unsigned_short_int},
+ {CV_REG_EIP, "EIP", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, Eip), dbg_itype_unsigned_int},
+ {CV_REG_EFLAGS, "EFLAGS", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, EFlags), dbg_itype_unsigned_int},
+ {CV_REG_ST0, "ST0", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[ 0]), dbg_itype_long_real},
+ {CV_REG_ST0+1, "ST1", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[10]), dbg_itype_long_real},
+ {CV_REG_ST0+2, "ST2", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[20]), dbg_itype_long_real},
+ {CV_REG_ST0+3, "ST3", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[30]), dbg_itype_long_real},
+ {CV_REG_ST0+4, "ST4", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[40]), dbg_itype_long_real},
+ {CV_REG_ST0+5, "ST5", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[50]), dbg_itype_long_real},
+ {CV_REG_ST0+6, "ST6", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[60]), dbg_itype_long_real},
+ {CV_REG_ST0+7, "ST7", (DWORD_PTR*)FIELD_OFFSET(WOW64_CONTEXT, FloatSave.RegisterArea[70]), dbg_itype_long_real},
+ {CV_AMD64_XMM0, "XMM0", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[0])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+1, "XMM1", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[1])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+2, "XMM2", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[2])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+3, "XMM3", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[3])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+4, "XMM4", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[4])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+5, "XMM5", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[5])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+6, "XMM6", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[6])), dbg_itype_m128a},
+ {CV_AMD64_XMM0+7, "XMM7", (DWORD_PTR*)(FIELD_OFFSET(WOW64_CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[7])), dbg_itype_m128a},
{0, NULL, 0, dbg_itype_none}
};
@@ -477,8 +480,8 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
unsigned operand_size;
ADDRESS_MODE cs_addr_mode;
- cs_addr_mode = get_selector_type(dbg_curr_thread->handle, &dbg_context,
- dbg_context.SegCs);
+ cs_addr_mode = get_selector_type(dbg_curr_thread->handle, &dbg_context.x86,
+ dbg_context.x86.SegCs);
operand_size = get_size(cs_addr_mode);
/* get operand_size (also getting rid of the various prefixes */
@@ -498,7 +501,7 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
callee->Mode = cs_addr_mode;
if (!fetch_value((const char*)insn + 1, operand_size, &delta))
return FALSE;
- callee->Segment = dbg_context.SegCs;
+ callee->Segment = dbg_context.x86.SegCs;
callee->Offset = (DWORD)insn + 1 + (operand_size / 8) + delta;
return TRUE;
@@ -506,7 +509,7 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
if (!dbg_read_memory((const char*)insn + 1 + operand_size / 8,
&segment, sizeof(segment)))
return FALSE;
- callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context,
+ callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context.x86,
segment);
if (!fetch_value((const char*)insn + 1, operand_size, &delta))
return FALSE;
@@ -521,7 +524,7 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
switch ((ch >> 3) & 0x07)
{
case 0x02:
- segment = dbg_context.SegCs;
+ segment = dbg_context.x86.SegCs;
break;
case 0x03:
if (!dbg_read_memory((const char*)insn + 1 + operand_size / 8,
@@ -555,10 +558,10 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
if (!dbg_read_memory((const char*)addr + operand_size, &segment, sizeof(segment)))
return FALSE;
}
- else segment = dbg_context.SegCs;
+ else segment = dbg_context.x86.SegCs;
if (!dbg_read_memory((const char*)addr, &dst, sizeof(dst)))
return FALSE;
- callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context, segment);
+ callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context.x86, segment);
callee->Segment = segment;
callee->Offset = dst;
return TRUE;
@@ -567,14 +570,14 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
default:
switch (ch & 0x07)
{
- case 0x00: dst = dbg_context.Eax; break;
- case 0x01: dst = dbg_context.Ecx; break;
- case 0x02: dst = dbg_context.Edx; break;
- case 0x03: dst = dbg_context.Ebx; break;
- case 0x04: dst = dbg_context.Esp; break;
- case 0x05: dst = dbg_context.Ebp; break;
- case 0x06: dst = dbg_context.Esi; break;
- case 0x07: dst = dbg_context.Edi; break;
+ case 0x00: dst = dbg_context.x86.Eax; break;
+ case 0x01: dst = dbg_context.x86.Ecx; break;
+ case 0x02: dst = dbg_context.x86.Edx; break;
+ case 0x03: dst = dbg_context.x86.Ebx; break;
+ case 0x04: dst = dbg_context.x86.Esp; break;
+ case 0x05: dst = dbg_context.x86.Ebp; break;
+ case 0x06: dst = dbg_context.x86.Esi; break;
+ case 0x07: dst = dbg_context.x86.Edi; break;
}
if ((ch >> 6) != 0x03) /* indirect address */
{
@@ -589,10 +592,10 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
if (!dbg_read_memory((const char*)dst + operand_size, &segment, sizeof(segment)))
return FALSE;
}
- else segment = dbg_context.SegCs;
+ else segment = dbg_context.x86.SegCs;
if (!dbg_read_memory((const char*)dst, &delta, sizeof(delta)))
return FALSE;
- callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context,
+ callee->Mode = get_selector_type(dbg_curr_thread->handle, &dbg_context.x86,
segment);
callee->Segment = segment;
callee->Offset = delta;
@@ -600,7 +603,7 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee)
else
{
callee->Mode = cs_addr_mode;
- callee->Segment = dbg_context.SegCs;
+ callee->Segment = dbg_context.x86.SegCs;
callee->Offset = dst;
}
}
@@ -618,8 +621,8 @@ static BOOL be_i386_is_jump(const void* insn, ADDRESS64* jumpee)
unsigned operand_size;
ADDRESS_MODE cs_addr_mode;
- cs_addr_mode = get_selector_type(dbg_curr_thread->handle, &dbg_context,
- dbg_context.SegCs);
+ cs_addr_mode = get_selector_type(dbg_curr_thread->handle, &dbg_context.x86,
+ dbg_context.x86.SegCs);
operand_size = get_size(cs_addr_mode);
/* get operand_size (also getting rid of the various prefixes */
@@ -639,7 +642,7 @@ static BOOL be_i386_is_jump(const void* insn, ADDRESS64* jumpee)
jumpee->Mode = cs_addr_mode;
if (!fetch_value((const char*)insn + 1, operand_size, &delta))
return FALSE;
- jumpee->Segment = dbg_context.SegCs;
+ jumpee->Segment = dbg_context.x86.SegCs;
jumpee->Offset = (DWORD)insn + 1 + (operand_size / 8) + delta;
return TRUE;
default: WINE_FIXME("unknown %x\n", ch); return FALSE;
@@ -672,8 +675,10 @@ static BOOL be_i386_is_jump(const void* insn, ADDRESS64* jumpee)
#define DR7_ENABLE_MASK(dr) (1<<(DR7_LOCAL_ENABLE_SHIFT+DR7_ENABLE_SIZE*(dr)))
#define IS_DR7_SET(ctrl,dr) ((ctrl)&DR7_ENABLE_MASK(dr))
-static inline int be_i386_get_unused_DR(CONTEXT* ctx, DWORD** r)
+static inline int be_i386_get_unused_DR(dbg_ctx_t *pctx, DWORD** r)
{
+ WOW64_CONTEXT *ctx = &pctx->x86;
+
if (!IS_DR7_SET(ctx->Dr7, 0))
{
*r = &ctx->Dr0;
@@ -700,7 +705,7 @@ static inline int be_i386_get_unused_DR(CONTEXT* ctx, DWORD** r)
}
static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
- CONTEXT* ctx, enum be_xpoint_type type,
+ dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size)
{
unsigned char ch;
@@ -738,10 +743,10 @@ static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* p
}
*val = reg;
/* clear old values */
- ctx->Dr7 &= ~(0x0F << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg));
+ ctx->x86.Dr7 &= ~(0x0F << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg));
/* set the correct ones */
- ctx->Dr7 |= bits << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg);
- ctx->Dr7 |= DR7_ENABLE_MASK(reg) | DR7_LOCAL_SLOWDOWN;
+ ctx->x86.Dr7 |= bits << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg);
+ ctx->x86.Dr7 |= DR7_ENABLE_MASK(reg) | DR7_LOCAL_SLOWDOWN;
break;
default:
dbg_printf("Unknown bp type %c\n", type);
@@ -751,7 +756,7 @@ static BOOL be_i386_insert_Xpoint(HANDLE hProcess, const struct be_process_io* p
}
static BOOL be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
- CONTEXT* ctx, enum be_xpoint_type type,
+ dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size)
{
SIZE_T sz;
@@ -772,7 +777,7 @@ static BOOL be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_io* p
case be_xpoint_watch_read:
case be_xpoint_watch_write:
/* simply disable the entry */
- ctx->Dr7 &= ~DR7_ENABLE_MASK(val);
+ ctx->x86.Dr7 &= ~DR7_ENABLE_MASK(val);
break;
default:
dbg_printf("Unknown bp type %c\n", type);
@@ -781,24 +786,24 @@ static BOOL be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_io* p
return TRUE;
}
-static BOOL be_i386_is_watchpoint_set(const CONTEXT* ctx, unsigned idx)
+static BOOL be_i386_is_watchpoint_set(const dbg_ctx_t *ctx, unsigned idx)
{
- return ctx->Dr6 & (1 << idx);
+ return ctx->x86.Dr6 & (1 << idx);
}
-static void be_i386_clear_watchpoint(CONTEXT* ctx, unsigned idx)
+static void be_i386_clear_watchpoint(dbg_ctx_t *ctx, unsigned idx)
{
- ctx->Dr6 &= ~(1 << idx);
+ ctx->x86.Dr6 &= ~(1 << idx);
}
-static int be_i386_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
+static int be_i386_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
{
if (way)
{
- ctx->Eip--;
+ ctx->x86.Eip--;
return -1;
}
- ctx->Eip++;
+ ctx->x86.Eip++;
return 1;
}
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 280cdec..450cc87 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -31,23 +31,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
#define STEP_FLAG 0x00000100 /* single step flag */
-static BOOL be_x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx,
+static BOOL be_x86_64_get_addr(HANDLE hThread, const dbg_ctx_t *ctx,
enum be_cpu_addr bca, ADDRESS64* addr)
{
addr->Mode = AddrModeFlat;
switch (bca)
{
case be_cpu_addr_pc:
- addr->Segment = ctx->SegCs;
- addr->Offset = ctx->Rip;
+ addr->Segment = ctx->ctx.SegCs;
+ addr->Offset = ctx->ctx.Rip;
return TRUE;
case be_cpu_addr_stack:
- addr->Segment = ctx->SegSs;
- addr->Offset = ctx->Rsp;
+ addr->Segment = ctx->ctx.SegSs;
+ addr->Offset = ctx->ctx.Rsp;
return TRUE;
case be_cpu_addr_frame:
- addr->Segment = ctx->SegSs;
- addr->Offset = ctx->Rbp;
+ addr->Segment = ctx->ctx.SegSs;
+ addr->Offset = ctx->ctx.Rbp;
return TRUE;
default:
addr->Mode = -1;
@@ -67,10 +67,10 @@ static BOOL be_x86_64_get_register_info(int regno, enum be_cpu_addr* kind)
return FALSE;
}
-static void be_x86_64_single_step(CONTEXT* ctx, BOOL enable)
+static void be_x86_64_single_step(dbg_ctx_t *ctx, BOOL enable)
{
- if (enable) ctx->EFlags |= STEP_FLAG;
- else ctx->EFlags &= ~STEP_FLAG;
+ if (enable) ctx->ctx.EFlags |= STEP_FLAG;
+ else ctx->ctx.EFlags &= ~STEP_FLAG;
}
static inline long double m128a_to_longdouble(const M128A m)
@@ -81,12 +81,13 @@ static inline long double m128a_to_longdouble(const M128A m)
return *(long double*)&m;
}
-static void be_x86_64_print_context(HANDLE hThread, const CONTEXT* ctx,
+static void be_x86_64_print_context(HANDLE hThread, const dbg_ctx_t *pctx,
int all_regs)
{
static const char mxcsr_flags[16][4] = { "IE", "DE", "ZE", "OE", "UE", "PE", "DAZ", "IM",
"DM", "ZM", "OM", "UM", "PM", "R-", "R+", "FZ" };
static const char flags[] = "aVR-N--ODITSZ-A-P-C";
+ const CONTEXT *ctx = &pctx->ctx;
char buf[33];
int i;
@@ -183,7 +184,7 @@ static void be_x86_64_print_context(HANDLE hThread, const CONTEXT* ctx,
}
}
-static void be_x86_64_print_segment_info(HANDLE hThread, const CONTEXT* ctx)
+static void be_x86_64_print_segment_info(HANDLE hThread, const dbg_ctx_t *ctx)
{
}
@@ -390,7 +391,7 @@ static BOOL be_x86_64_is_func_call(const void* insn, ADDRESS64* callee)
/* that's the only mode we support anyway */
callee->Mode = AddrModeFlat;
- callee->Segment = dbg_context.SegCs;
+ callee->Segment = dbg_context.ctx.SegCs;
switch (ch)
{
@@ -435,14 +436,14 @@ static BOOL be_x86_64_is_func_call(const void* insn, ADDRESS64* callee)
default:
switch (f_rm(ch))
{
- case 0x00: dst = dbg_context.Rax; break;
- case 0x01: dst = dbg_context.Rcx; break;
- case 0x02: dst = dbg_context.Rdx; break;
- case 0x03: dst = dbg_context.Rbx; break;
- case 0x04: dst = dbg_context.Rsp; break;
- case 0x05: dst = dbg_context.Rbp; break;
- case 0x06: dst = dbg_context.Rsi; break;
- case 0x07: dst = dbg_context.Rdi; break;
+ case 0x00: dst = dbg_context.ctx.Rax; break;
+ case 0x01: dst = dbg_context.ctx.Rcx; break;
+ case 0x02: dst = dbg_context.ctx.Rdx; break;
+ case 0x03: dst = dbg_context.ctx.Rbx; break;
+ case 0x04: dst = dbg_context.ctx.Rsp; break;
+ case 0x05: dst = dbg_context.ctx.Rbp; break;
+ case 0x06: dst = dbg_context.ctx.Rsi; break;
+ case 0x07: dst = dbg_context.ctx.Rdi; break;
}
if (f_mod(ch) != 0x03)
WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) at %p\n", ch, insn);
@@ -494,8 +495,10 @@ extern void be_x86_64_disasm_one_insn(ADDRESS64* addr, int display);
#define DR7_ENABLE_MASK(dr) (1<<(DR7_LOCAL_ENABLE_SHIFT+DR7_ENABLE_SIZE*(dr)))
#define IS_DR7_SET(ctrl,dr) ((ctrl)&DR7_ENABLE_MASK(dr))
-static inline int be_x86_64_get_unused_DR(CONTEXT* ctx, DWORD64** r)
+static inline int be_x86_64_get_unused_DR(dbg_ctx_t *pctx, DWORD64** r)
{
+ CONTEXT *ctx = &pctx->ctx;
+
if (!IS_DR7_SET(ctx->Dr7, 0))
{
*r = &ctx->Dr0;
@@ -522,7 +525,7 @@ static inline int be_x86_64_get_unused_DR(CONTEXT* ctx, DWORD64** r)
}
static BOOL be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
- CONTEXT* ctx, enum be_xpoint_type type,
+ dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long* val, unsigned size)
{
unsigned char ch;
@@ -561,10 +564,10 @@ static BOOL be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io*
}
*val = reg;
/* clear old values */
- ctx->Dr7 &= ~(0x0F << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg));
+ ctx->ctx.Dr7 &= ~(0x0F << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg));
/* set the correct ones */
- ctx->Dr7 |= bits << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg);
- ctx->Dr7 |= DR7_ENABLE_MASK(reg) | DR7_LOCAL_SLOWDOWN;
+ ctx->ctx.Dr7 |= bits << (DR7_CONTROL_SHIFT + DR7_CONTROL_SIZE * reg);
+ ctx->ctx.Dr7 |= DR7_ENABLE_MASK(reg) | DR7_LOCAL_SLOWDOWN;
break;
default:
dbg_printf("Unknown bp type %c\n", type);
@@ -574,7 +577,7 @@ static BOOL be_x86_64_insert_Xpoint(HANDLE hProcess, const struct be_process_io*
}
static BOOL be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process_io* pio,
- CONTEXT* ctx, enum be_xpoint_type type,
+ dbg_ctx_t *ctx, enum be_xpoint_type type,
void* addr, unsigned long val, unsigned size)
{
SIZE_T sz;
@@ -594,7 +597,7 @@ static BOOL be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process_io*
case be_xpoint_watch_read:
case be_xpoint_watch_write:
/* simply disable the entry */
- ctx->Dr7 &= ~DR7_ENABLE_MASK(val);
+ ctx->ctx.Dr7 &= ~DR7_ENABLE_MASK(val);
break;
default:
dbg_printf("Unknown bp type %c\n", type);
@@ -603,24 +606,24 @@ static BOOL be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process_io*
return TRUE;
}
-static BOOL be_x86_64_is_watchpoint_set(const CONTEXT* ctx, unsigned idx)
+static BOOL be_x86_64_is_watchpoint_set(const dbg_ctx_t *ctx, unsigned idx)
{
- return ctx->Dr6 & (1 << idx);
+ return ctx->ctx.Dr6 & (1 << idx);
}
-static void be_x86_64_clear_watchpoint(CONTEXT* ctx, unsigned idx)
+static void be_x86_64_clear_watchpoint(dbg_ctx_t *ctx, unsigned idx)
{
- ctx->Dr6 &= ~(1 << idx);
+ ctx->ctx.Dr6 &= ~(1 << idx);
}
-static int be_x86_64_adjust_pc_for_break(CONTEXT* ctx, BOOL way)
+static int be_x86_64_adjust_pc_for_break(dbg_ctx_t *ctx, BOOL way)
{
if (way)
{
- ctx->Rip--;
+ ctx->ctx.Rip--;
return -1;
}
- ctx->Rip++;
+ ctx->ctx.Rip++;
return 1;
}
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index 0ceb150..490bd06 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -170,6 +170,12 @@ typedef struct tagTHREADNAME_INFO
DWORD dwFlags; /* Reserved for future use. Must be zero. */
} THREADNAME_INFO;
+typedef union dbg_ctx
+{
+ CONTEXT ctx;
+ WOW64_CONTEXT x86;
+} dbg_ctx_t;
+
struct dbg_thread
{
struct list entry;
@@ -196,7 +202,7 @@ struct dbg_thread
DWORD_PTR linear_pc;
DWORD_PTR linear_frame;
DWORD_PTR linear_stack;
- CONTEXT context; /* context we got out of stackwalk for this frame */
+ dbg_ctx_t context; /* context we got out of stackwalk for this frame */
BOOL is_ctx_valid; /* is the context above valid */
}* frames;
int num_frames;
@@ -255,7 +261,7 @@ extern struct dbg_process* dbg_curr_process;
extern DWORD_PTR dbg_curr_pid;
extern struct dbg_thread* dbg_curr_thread;
extern DWORD_PTR dbg_curr_tid;
-extern CONTEXT dbg_context;
+extern dbg_ctx_t dbg_context;
extern BOOL dbg_interactiveP;
extern HANDLE dbg_houtput;
@@ -396,7 +402,7 @@ extern void stack_backtrace(DWORD threadID);
extern BOOL stack_set_frame(int newframe);
extern BOOL stack_get_current_frame(IMAGEHLP_STACK_FRAME* ihsf);
extern BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pval);
-extern unsigned stack_fetch_frames(const CONTEXT* ctx);
+extern unsigned stack_fetch_frames(const dbg_ctx_t *ctx);
extern BOOL stack_get_current_symbol(SYMBOL_INFO* sym);
/* symbol.c */
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 8742135..d5786b2 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -95,7 +95,7 @@ struct gdb_context
/* current Win32 trap env */
unsigned last_sig;
BOOL in_trap;
- CONTEXT context;
+ dbg_ctx_t context;
/* Win32 information */
struct dbg_process* process;
/* Unix environment */
@@ -497,13 +497,13 @@ static struct cpu_register cpu_register_map[] = {
static const size_t cpu_num_regs = (sizeof(cpu_register_map) / sizeof(cpu_register_map[0]));
-static inline void* cpu_register_ptr(CONTEXT* ctx, unsigned idx)
+static inline void* cpu_register_ptr(dbg_ctx_t *ctx, unsigned idx)
{
assert(idx < cpu_num_regs);
return (char*)ctx + cpu_register_map[idx].ctx_offset;
}
-static inline DWORD64 cpu_register(CONTEXT* ctx, unsigned idx)
+static inline DWORD64 cpu_register(dbg_ctx_t *ctx, unsigned idx)
{
switch (cpu_register_map[idx].ctx_length)
{
@@ -518,7 +518,7 @@ static inline DWORD64 cpu_register(CONTEXT* ctx, unsigned idx)
}
}
-static inline void cpu_register_hex_from(CONTEXT* ctx, unsigned idx, const char** phex)
+static inline void cpu_register_hex_from(dbg_ctx_t* ctx, unsigned idx, const char **phex)
{
if (cpu_register_map[idx].gdb_length == cpu_register_map[idx].ctx_length)
hex_from(cpu_register_ptr(ctx, idx), *phex, cpu_register_map[idx].gdb_length);
@@ -550,10 +550,9 @@ static inline void cpu_register_hex_from(CONTEXT* ctx, unsigned idx, const
* =============================================== *
*/
-static BOOL fetch_context(struct gdb_context* gdbctx, HANDLE h, CONTEXT* ctx)
+static BOOL fetch_context(struct gdb_context *gdbctx, HANDLE h, dbg_ctx_t *ctx)
{
- ctx->ContextFlags = CONTEXT_ALL;
- if (!GetThreadContext(h, ctx))
+ if (!GetThreadContext(h, &ctx->ctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Can't get thread's context\n");
@@ -769,7 +768,7 @@ static void resume_debuggee(struct gdb_context* gdbctx, DWORD cont)
{
if (dbg_curr_thread)
{
- if (!SetThreadContext(dbg_curr_thread->handle, &gdbctx->context))
+ if (!SetThreadContext(dbg_curr_thread->handle, &gdbctx->context.ctx))
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context on thread %04x\n", dbg_curr_thread->tid);
if (!ContinueDebugEvent(gdbctx->process->pid, dbg_curr_thread->tid, cont))
@@ -789,7 +788,7 @@ static void resume_debuggee_thread(struct gdb_context* gdbctx, DWORD cont, unsig
{
if(dbg_curr_thread->tid == threadid){
/* Windows debug and GDB don't seem to work well here, windows only likes ContinueDebugEvent being used on the reporter of the event */
- if (!SetThreadContext(dbg_curr_thread->handle, &gdbctx->context))
+ if (!SetThreadContext(dbg_curr_thread->handle, &gdbctx->context.ctx))
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context on thread %04x\n", dbg_curr_thread->tid);
if (!ContinueDebugEvent(gdbctx->process->pid, dbg_curr_thread->tid, cont))
@@ -1443,7 +1442,7 @@ static enum packet_return packet_detach(struct gdb_context* gdbctx)
static enum packet_return packet_read_registers(struct gdb_context* gdbctx)
{
int i;
- CONTEXT ctx;
+ dbg_ctx_t ctx;
assert(gdbctx->in_trap);
@@ -1463,8 +1462,8 @@ static enum packet_return packet_read_registers(struct gdb_context* gdbctx)
static enum packet_return packet_write_registers(struct gdb_context* gdbctx)
{
unsigned i;
- CONTEXT ctx;
- CONTEXT* pctx = &gdbctx->context;
+ dbg_ctx_t ctx;
+ dbg_ctx_t *pctx = &gdbctx->context;
const char* ptr;
assert(gdbctx->in_trap);
@@ -1479,7 +1478,7 @@ static enum packet_return packet_write_registers(struct gdb_context* gdbctx)
for (i = 0; i < cpu_num_regs; i++)
cpu_register_hex_from(pctx, i, &ptr);
- if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, pctx))
+ if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, &pctx->ctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context on thread %04x\n", gdbctx->other_thread->tid);
@@ -1616,8 +1615,8 @@ static enum packet_return packet_write_memory(struct gdb_context* gdbctx)
static enum packet_return packet_read_register(struct gdb_context* gdbctx)
{
unsigned reg;
- CONTEXT ctx;
- CONTEXT* pctx = &gdbctx->context;
+ dbg_ctx_t ctx;
+ dbg_ctx_t *pctx = &gdbctx->context;
assert(gdbctx->in_trap);
reg = hex_to_int(gdbctx->in_packet, gdbctx->in_packet_len);
@@ -1650,8 +1649,8 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
{
unsigned reg;
char* ptr;
- CONTEXT ctx;
- CONTEXT* pctx = &gdbctx->context;
+ dbg_ctx_t ctx;
+ dbg_ctx_t *pctx = &gdbctx->context;
assert(gdbctx->in_trap);
@@ -1678,7 +1677,7 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
}
cpu_register_hex_from(pctx, reg, (const char**)&ptr);
- if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, pctx))
+ if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, &pctx->ctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
fprintf(stderr, "Cannot set context for thread %04x\n", gdbctx->other_thread->tid);
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c
index 6e65fa6..f3585f2 100644
--- a/programs/winedbg/memory.c
+++ b/programs/winedbg/memory.c
@@ -39,7 +39,7 @@ void* be_cpu_linearize(HANDLE hThread, const ADDRESS64* addr)
return (void*)(DWORD_PTR)addr->Offset;
}
-BOOL be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
+BOOL be_cpu_build_addr(HANDLE hThread, const dbg_ctx_t *ctx, ADDRESS64* addr,
unsigned seg, unsigned long offset)
{
addr->Mode = AddrModeFlat;
diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index 2ab4e60..a036107 100644
--- a/programs/winedbg/stack.c
+++ b/programs/winedbg/stack.c
@@ -184,14 +184,14 @@ static BOOL CALLBACK stack_read_mem(HANDLE hProc, DWORD64 addr,
*
* Do a backtrace on the current thread
*/
-unsigned stack_fetch_frames(const CONTEXT* _ctx)
+unsigned stack_fetch_frames(const dbg_ctx_t* _ctx)
{
STACKFRAME64 sf;
unsigned nf = 0;
/* as native stackwalk can modify the context passed to it, simply copy
* it to avoid any damage
*/
- CONTEXT ctx = *_ctx;
+ dbg_ctx_t ctx = *_ctx;
BOOL ret;
HeapFree(GetProcessHeap(), 0, dbg_curr_thread->frames);
@@ -351,21 +351,21 @@ static void backtrace_tid(struct dbg_process* pcs, DWORD tid)
dbg_printf("Unknown thread id (%04x) in process (%04x)\n", tid, pcs->pid);
else
{
- CONTEXT context;
+ dbg_ctx_t ctx = {0};
dbg_curr_tid = dbg_curr_thread->tid;
- memset(&context, 0, sizeof(context));
- context.ContextFlags = CONTEXT_FULL;
+
+ ctx.ctx.ContextFlags = CONTEXT_FULL;
if (SuspendThread(dbg_curr_thread->handle) != -1)
{
- if (!GetThreadContext(dbg_curr_thread->handle, &context))
+ if (!GetThreadContext(dbg_curr_thread->handle, &ctx.ctx))
{
dbg_printf("Can't get context for thread %04x in current process\n",
tid);
}
else
{
- stack_fetch_frames(&context);
+ stack_fetch_frames(&ctx);
backtrace();
}
ResumeThread(dbg_curr_thread->handle);
@@ -386,7 +386,7 @@ static void backtrace_all(void)
{
struct dbg_process* process = dbg_curr_process;
struct dbg_thread* thread = dbg_curr_thread;
- CONTEXT ctx = dbg_context;
+ dbg_ctx_t ctx = dbg_context;
DWORD cpid = dbg_curr_pid;
THREADENTRY32 entry;
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index d891cfe..8c94402 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -91,7 +91,7 @@ BOOL dbg_attach_debuggee(DWORD pid, BOOL cofe)
static unsigned dbg_fetch_context(void)
{
- dbg_context.ContextFlags = CONTEXT_CONTROL
+ dbg_context.ctx.ContextFlags = CONTEXT_CONTROL
| CONTEXT_INTEGER
#ifdef CONTEXT_FLOATING_POINT
| CONTEXT_FLOATING_POINT
@@ -103,7 +103,7 @@ static unsigned dbg_fetch_context(void)
| CONTEXT_DEBUG_REGISTERS
#endif
;
- if (!GetThreadContext(dbg_curr_thread->handle, &dbg_context))
+ if (!GetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx))
{
WINE_WARN("Can't get thread's context\n");
return FALSE;
@@ -356,7 +356,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
de->u.Exception.dwFirstChance);
if (cont && dbg_curr_thread)
{
- SetThreadContext(dbg_curr_thread->handle, &dbg_context);
+ SetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx);
}
}
break;
@@ -539,7 +539,7 @@ static void dbg_resume_debuggee(DWORD cont)
dbg_curr_thread->exec_count);
if (dbg_curr_thread)
{
- if (!SetThreadContext(dbg_curr_thread->handle, &dbg_context))
+ if (!SetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx))
dbg_printf("Cannot set ctx on %04lx\n", dbg_curr_tid);
}
}
@@ -1001,7 +1001,7 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
dbg_curr_process->be_cpu->single_step(&dbg_context, FALSE);
if (dbg_curr_thread->in_exception)
{
- SetThreadContext(dbg_curr_thread->handle, &dbg_context);
+ SetThreadContext(dbg_curr_thread->handle, &dbg_context.ctx);
ContinueDebugEvent(dbg_curr_pid, dbg_curr_tid, DBG_CONTINUE);
}
}
diff --git a/programs/winedbg/tgt_minidump.c b/programs/winedbg/tgt_minidump.c
index a17f32b..f168633 100644
--- a/programs/winedbg/tgt_minidump.c
+++ b/programs/winedbg/tgt_minidump.c
@@ -69,7 +69,7 @@ void minidump_write(const char* file, const EXCEPTION_RECORD* rec)
mei.ThreadId = dbg_curr_thread->tid;
mei.ExceptionPointers = &ep;
ep.ExceptionRecord = (EXCEPTION_RECORD*)rec;
- ep.ContextRecord = &dbg_context;
+ ep.ContextRecord = &dbg_context.ctx;
mei.ClientPointers = FALSE;
}
MiniDumpWriteDump(dbg_curr_process->handle, dbg_curr_process->pid,
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index b32b24c..b5ffd76 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -87,7 +87,7 @@ struct dbg_process* dbg_curr_process = NULL;
struct dbg_thread* dbg_curr_thread = NULL;
DWORD_PTR dbg_curr_tid = 0;
DWORD_PTR dbg_curr_pid = 0;
-CONTEXT dbg_context;
+dbg_ctx_t dbg_context;
BOOL dbg_interactiveP = FALSE;
HANDLE dbg_houtput = 0;
--
2.7.4
June 12, 2018
[PATCH 2/5] winedbg/gdbproxy: Remove unnecessary checks for supported context flags.
by Zebediah Figura
And simplify the assignment to use CONTEXT_ALL instead. If we don't support
reading from a register then we just ignore its value.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/gdbproxy.c | 478 ++++++++++++++++++++------------------------
1 file changed, 222 insertions(+), 256 deletions(-)
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index a9a65c2..8742135 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -199,10 +199,9 @@ struct cpu_register
size_t ctx_offset;
size_t ctx_length;
size_t gdb_length;
- ULONG ctx_flags;
};
-#define REG(r,gs,m) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs, m}
+#define REG(r,gs) {FIELD_OFFSET(CONTEXT, r), sizeof(((CONTEXT*)NULL)->r), gs}
#ifdef __i386__
typedef struct DECLSPEC_ALIGN(16) _M128A {
@@ -231,185 +230,185 @@ typedef struct _XMM_SAVE_AREA32 {
static const char target_xml[] = "";
static struct cpu_register cpu_register_map[] = {
- REG(Eax, 4, CONTEXT_INTEGER),
- REG(Ecx, 4, CONTEXT_INTEGER),
- REG(Edx, 4, CONTEXT_INTEGER),
- REG(Ebx, 4, CONTEXT_INTEGER),
- REG(Esp, 4, CONTEXT_CONTROL),
- REG(Ebp, 4, CONTEXT_CONTROL),
- REG(Esi, 4, CONTEXT_INTEGER),
- REG(Edi, 4, CONTEXT_INTEGER),
- REG(Eip, 4, CONTEXT_CONTROL),
- REG(EFlags, 4, CONTEXT_CONTROL),
- REG(SegCs, 4, CONTEXT_CONTROL),
- REG(SegSs, 4, CONTEXT_SEGMENTS),
- REG(SegDs, 4, CONTEXT_SEGMENTS),
- REG(SegEs, 4, CONTEXT_SEGMENTS),
- REG(SegFs, 4, CONTEXT_SEGMENTS),
- REG(SegGs, 4, CONTEXT_SEGMENTS),
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[ 0]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[10]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[20]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[30]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[40]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[50]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[60]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[70]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.ControlWord), 2, 4, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.StatusWord), 2, 4, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.TagWord), 2, 4, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, FloatSave.ErrorSelector), 2, 4, CONTEXT_FLOATING_POINT },
- REG(FloatSave.ErrorOffset, 4, CONTEXT_FLOATING_POINT ),
- { FIELD_OFFSET(CONTEXT, FloatSave.DataSelector), 2, 4, CONTEXT_FLOATING_POINT },
- REG(FloatSave.DataOffset, 4, CONTEXT_FLOATING_POINT ),
- { FIELD_OFFSET(CONTEXT, FloatSave.ErrorSelector)+2, 2, 4, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[0]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[1]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[2]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[3]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[4]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[5]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[6]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[7]), 16, 16, CONTEXT_EXTENDED_REGISTERS },
- { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, MxCsr), 4, 4, CONTEXT_EXTENDED_REGISTERS },
+ REG(Eax, 4),
+ REG(Ecx, 4),
+ REG(Edx, 4),
+ REG(Ebx, 4),
+ REG(Esp, 4),
+ REG(Ebp, 4),
+ REG(Esi, 4),
+ REG(Edi, 4),
+ REG(Eip, 4),
+ REG(EFlags, 4),
+ REG(SegCs, 4),
+ REG(SegSs, 4),
+ REG(SegDs, 4),
+ REG(SegEs, 4),
+ REG(SegFs, 4),
+ REG(SegGs, 4),
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[ 0]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[10]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[20]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[30]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[40]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[50]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[60]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.RegisterArea[70]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.ControlWord), 2, 4 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.StatusWord), 2, 4 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.TagWord), 2, 4 },
+ { FIELD_OFFSET(CONTEXT, FloatSave.ErrorSelector), 2, 4 },
+ REG(FloatSave.ErrorOffset, 4 ),
+ { FIELD_OFFSET(CONTEXT, FloatSave.DataSelector), 2, 4 },
+ REG(FloatSave.DataOffset, 4 ),
+ { FIELD_OFFSET(CONTEXT, FloatSave.ErrorSelector)+2, 2, 4 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[0]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[1]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[2]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[3]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[4]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[5]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[6]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, XmmRegisters[7]), 16, 16 },
+ { FIELD_OFFSET(CONTEXT, ExtendedRegisters) + FIELD_OFFSET(XMM_SAVE_AREA32, MxCsr), 4, 4 },
};
#elif defined(__powerpc__)
static const char target_xml[] = "";
static struct cpu_register cpu_register_map[] = {
- REG(Gpr0, 4, CONTEXT_INTEGER),
- REG(Gpr1, 4, CONTEXT_INTEGER),
- REG(Gpr2, 4, CONTEXT_INTEGER),
- REG(Gpr3, 4, CONTEXT_INTEGER),
- REG(Gpr4, 4, CONTEXT_INTEGER),
- REG(Gpr5, 4, CONTEXT_INTEGER),
- REG(Gpr6, 4, CONTEXT_INTEGER),
- REG(Gpr7, 4, CONTEXT_INTEGER),
- REG(Gpr8, 4, CONTEXT_INTEGER),
- REG(Gpr9, 4, CONTEXT_INTEGER),
- REG(Gpr10, 4, CONTEXT_INTEGER),
- REG(Gpr11, 4, CONTEXT_INTEGER),
- REG(Gpr12, 4, CONTEXT_INTEGER),
- REG(Gpr13, 4, CONTEXT_INTEGER),
- REG(Gpr14, 4, CONTEXT_INTEGER),
- REG(Gpr15, 4, CONTEXT_INTEGER),
- REG(Gpr16, 4, CONTEXT_INTEGER),
- REG(Gpr17, 4, CONTEXT_INTEGER),
- REG(Gpr18, 4, CONTEXT_INTEGER),
- REG(Gpr19, 4, CONTEXT_INTEGER),
- REG(Gpr20, 4, CONTEXT_INTEGER),
- REG(Gpr21, 4, CONTEXT_INTEGER),
- REG(Gpr22, 4, CONTEXT_INTEGER),
- REG(Gpr23, 4, CONTEXT_INTEGER),
- REG(Gpr24, 4, CONTEXT_INTEGER),
- REG(Gpr25, 4, CONTEXT_INTEGER),
- REG(Gpr26, 4, CONTEXT_INTEGER),
- REG(Gpr27, 4, CONTEXT_INTEGER),
- REG(Gpr28, 4, CONTEXT_INTEGER),
- REG(Gpr29, 4, CONTEXT_INTEGER),
- REG(Gpr30, 4, CONTEXT_INTEGER),
- REG(Gpr31, 4, CONTEXT_INTEGER),
- REG(Fpr0, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr1, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr2, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr3, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr4, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr5, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr6, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr7, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr8, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr9, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr10, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr11, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr12, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr13, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr14, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr15, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr16, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr17, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr18, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr19, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr20, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr21, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr22, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr23, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr24, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr25, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr26, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr27, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr28, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr29, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr30, 4, CONTEXT_FLOATING_POINT),
- REG(Fpr31, 4, CONTEXT_FLOATING_POINT),
+ REG(Gpr0, 4),
+ REG(Gpr1, 4),
+ REG(Gpr2, 4),
+ REG(Gpr3, 4),
+ REG(Gpr4, 4),
+ REG(Gpr5, 4),
+ REG(Gpr6, 4),
+ REG(Gpr7, 4),
+ REG(Gpr8, 4),
+ REG(Gpr9, 4),
+ REG(Gpr10, 4),
+ REG(Gpr11, 4),
+ REG(Gpr12, 4),
+ REG(Gpr13, 4),
+ REG(Gpr14, 4),
+ REG(Gpr15, 4),
+ REG(Gpr16, 4),
+ REG(Gpr17, 4),
+ REG(Gpr18, 4),
+ REG(Gpr19, 4),
+ REG(Gpr20, 4),
+ REG(Gpr21, 4),
+ REG(Gpr22, 4),
+ REG(Gpr23, 4),
+ REG(Gpr24, 4),
+ REG(Gpr25, 4),
+ REG(Gpr26, 4),
+ REG(Gpr27, 4),
+ REG(Gpr28, 4),
+ REG(Gpr29, 4),
+ REG(Gpr30, 4),
+ REG(Gpr31, 4),
+ REG(Fpr0, 4),
+ REG(Fpr1, 4),
+ REG(Fpr2, 4),
+ REG(Fpr3, 4),
+ REG(Fpr4, 4),
+ REG(Fpr5, 4),
+ REG(Fpr6, 4),
+ REG(Fpr7, 4),
+ REG(Fpr8, 4),
+ REG(Fpr9, 4),
+ REG(Fpr10, 4),
+ REG(Fpr11, 4),
+ REG(Fpr12, 4),
+ REG(Fpr13, 4),
+ REG(Fpr14, 4),
+ REG(Fpr15, 4),
+ REG(Fpr16, 4),
+ REG(Fpr17, 4),
+ REG(Fpr18, 4),
+ REG(Fpr19, 4),
+ REG(Fpr20, 4),
+ REG(Fpr21, 4),
+ REG(Fpr22, 4),
+ REG(Fpr23, 4),
+ REG(Fpr24, 4),
+ REG(Fpr25, 4),
+ REG(Fpr26, 4),
+ REG(Fpr27, 4),
+ REG(Fpr28, 4),
+ REG(Fpr29, 4),
+ REG(Fpr30, 4),
+ REG(Fpr31, 4),
- REG(Iar, 4, CONTEXT_CONTROL),
- REG(Msr, 4, CONTEXT_CONTROL),
- REG(Cr, 4, CONTEXT_INTEGER),
- REG(Lr, 4, CONTEXT_CONTROL),
- REG(Ctr, 4, CONTEXT_CONTROL),
- REG(Xer, 4, CONTEXT_INTEGER),
+ REG(Iar, 4),
+ REG(Msr, 4),
+ REG(Cr, 4),
+ REG(Lr, 4),
+ REG(Ctr, 4),
+ REG(Xer, 4),
/* FIXME: MQ is missing? FIELD_OFFSET(CONTEXT, Mq), */
/* see gdb/nlm/ppc.c */
};
#elif defined(__x86_64__)
static const char target_xml[] = "";
static struct cpu_register cpu_register_map[] = {
- REG(Rax, 8, CONTEXT_INTEGER),
- REG(Rbx, 8, CONTEXT_INTEGER),
- REG(Rcx, 8, CONTEXT_INTEGER),
- REG(Rdx, 8, CONTEXT_INTEGER),
- REG(Rsi, 8, CONTEXT_INTEGER),
- REG(Rdi, 8, CONTEXT_INTEGER),
- REG(Rbp, 8, CONTEXT_INTEGER),
- REG(Rsp, 8, CONTEXT_INTEGER),
- REG(R8, 8, CONTEXT_INTEGER),
- REG(R9, 8, CONTEXT_INTEGER),
- REG(R10, 8, CONTEXT_INTEGER),
- REG(R11, 8, CONTEXT_INTEGER),
- REG(R12, 8, CONTEXT_INTEGER),
- REG(R13, 8, CONTEXT_INTEGER),
- REG(R14, 8, CONTEXT_INTEGER),
- REG(R15, 8, CONTEXT_INTEGER),
- REG(Rip, 8, CONTEXT_CONTROL),
- REG(EFlags, 4, CONTEXT_CONTROL),
- REG(SegCs, 4, CONTEXT_CONTROL),
- REG(SegSs, 4, CONTEXT_CONTROL),
- REG(SegDs, 4, CONTEXT_SEGMENTS),
- REG(SegEs, 4, CONTEXT_SEGMENTS),
- REG(SegFs, 4, CONTEXT_SEGMENTS),
- REG(SegGs, 4, CONTEXT_SEGMENTS),
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 0]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 1]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 2]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 3]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 4]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 5]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 6]), 10, 10, CONTEXT_FLOATING_POINT },
- { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 7]), 10, 10, CONTEXT_FLOATING_POINT },
- REG(u.FltSave.ControlWord, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.StatusWord, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.TagWord, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.ErrorSelector, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.ErrorOffset, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.DataSelector, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.DataOffset, 4, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.ErrorOpcode, 4, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm0, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm1, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm2, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm3, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm4, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm5, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm6, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm7, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm8, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm9, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm10, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm11, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm12, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm13, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm14, 16, CONTEXT_FLOATING_POINT),
- REG(u.s.Xmm15, 16, CONTEXT_FLOATING_POINT),
- REG(u.FltSave.MxCsr, 4, CONTEXT_FLOATING_POINT),
+ REG(Rax, 8),
+ REG(Rbx, 8),
+ REG(Rcx, 8),
+ REG(Rdx, 8),
+ REG(Rsi, 8),
+ REG(Rdi, 8),
+ REG(Rbp, 8),
+ REG(Rsp, 8),
+ REG(R8, 8),
+ REG(R9, 8),
+ REG(R10, 8),
+ REG(R11, 8),
+ REG(R12, 8),
+ REG(R13, 8),
+ REG(R14, 8),
+ REG(R15, 8),
+ REG(Rip, 8),
+ REG(EFlags, 4),
+ REG(SegCs, 4),
+ REG(SegSs, 4),
+ REG(SegDs, 4),
+ REG(SegEs, 4),
+ REG(SegFs, 4),
+ REG(SegGs, 4),
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 0]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 1]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 2]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 3]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 4]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 5]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 6]), 10, 10 },
+ { FIELD_OFFSET(CONTEXT, u.FltSave.FloatRegisters[ 7]), 10, 10 },
+ REG(u.FltSave.ControlWord, 4),
+ REG(u.FltSave.StatusWord, 4),
+ REG(u.FltSave.TagWord, 4),
+ REG(u.FltSave.ErrorSelector, 4),
+ REG(u.FltSave.ErrorOffset, 4),
+ REG(u.FltSave.DataSelector, 4),
+ REG(u.FltSave.DataOffset, 4),
+ REG(u.FltSave.ErrorOpcode, 4),
+ REG(u.s.Xmm0, 16),
+ REG(u.s.Xmm1, 16),
+ REG(u.s.Xmm2, 16),
+ REG(u.s.Xmm3, 16),
+ REG(u.s.Xmm4, 16),
+ REG(u.s.Xmm5, 16),
+ REG(u.s.Xmm6, 16),
+ REG(u.s.Xmm7, 16),
+ REG(u.s.Xmm8, 16),
+ REG(u.s.Xmm9, 16),
+ REG(u.s.Xmm10, 16),
+ REG(u.s.Xmm11, 16),
+ REG(u.s.Xmm12, 16),
+ REG(u.s.Xmm13, 16),
+ REG(u.s.Xmm14, 16),
+ REG(u.s.Xmm15, 16),
+ REG(u.FltSave.MxCsr, 4),
};
#elif defined(__arm__)
static const char target_xml[] =
@@ -435,61 +434,61 @@ static const char target_xml[] =
"</feature></target>\n";
static struct cpu_register cpu_register_map[] = {
- REG(R0, 4, CONTEXT_INTEGER),
- REG(R1, 4, CONTEXT_INTEGER),
- REG(R2, 4, CONTEXT_INTEGER),
- REG(R3, 4, CONTEXT_INTEGER),
- REG(R4, 4, CONTEXT_INTEGER),
- REG(R5, 4, CONTEXT_INTEGER),
- REG(R6, 4, CONTEXT_INTEGER),
- REG(R7, 4, CONTEXT_INTEGER),
- REG(R8, 4, CONTEXT_INTEGER),
- REG(R9, 4, CONTEXT_INTEGER),
- REG(R10, 4, CONTEXT_INTEGER),
- REG(R11, 4, CONTEXT_INTEGER),
- REG(R12, 4, CONTEXT_INTEGER),
- REG(Sp, 4, CONTEXT_CONTROL),
- REG(Lr, 4, CONTEXT_CONTROL),
- REG(Pc, 4, CONTEXT_CONTROL),
- REG(Cpsr, 4, CONTEXT_CONTROL),
+ REG(R0, 4),
+ REG(R1, 4),
+ REG(R2, 4),
+ REG(R3, 4),
+ REG(R4, 4),
+ REG(R5, 4),
+ REG(R6, 4),
+ REG(R7, 4),
+ REG(R8, 4),
+ REG(R9, 4),
+ REG(R10, 4),
+ REG(R11, 4),
+ REG(R12, 4),
+ REG(Sp, 4),
+ REG(Lr, 4),
+ REG(Pc, 4),
+ REG(Cpsr, 4),
};
#elif defined(__aarch64__)
static const char target_xml[] = "";
static struct cpu_register cpu_register_map[] = {
- REG(Cpsr, 4, CONTEXT_CONTROL),
- REG(u.s.X0, 8, CONTEXT_INTEGER),
- REG(u.s.X1, 8, CONTEXT_INTEGER),
- REG(u.s.X2, 8, CONTEXT_INTEGER),
- REG(u.s.X3, 8, CONTEXT_INTEGER),
- REG(u.s.X4, 8, CONTEXT_INTEGER),
- REG(u.s.X5, 8, CONTEXT_INTEGER),
- REG(u.s.X6, 8, CONTEXT_INTEGER),
- REG(u.s.X7, 8, CONTEXT_INTEGER),
- REG(u.s.X8, 8, CONTEXT_INTEGER),
- REG(u.s.X9, 8, CONTEXT_INTEGER),
- REG(u.s.X10, 8, CONTEXT_INTEGER),
- REG(u.s.X11, 8, CONTEXT_INTEGER),
- REG(u.s.X12, 8, CONTEXT_INTEGER),
- REG(u.s.X13, 8, CONTEXT_INTEGER),
- REG(u.s.X14, 8, CONTEXT_INTEGER),
- REG(u.s.X15, 8, CONTEXT_INTEGER),
- REG(u.s.X16, 8, CONTEXT_INTEGER),
- REG(u.s.X17, 8, CONTEXT_INTEGER),
- REG(u.s.X18, 8, CONTEXT_INTEGER),
- REG(u.s.X19, 8, CONTEXT_INTEGER),
- REG(u.s.X20, 8, CONTEXT_INTEGER),
- REG(u.s.X21, 8, CONTEXT_INTEGER),
- REG(u.s.X22, 8, CONTEXT_INTEGER),
- REG(u.s.X23, 8, CONTEXT_INTEGER),
- REG(u.s.X24, 8, CONTEXT_INTEGER),
- REG(u.s.X25, 8, CONTEXT_INTEGER),
- REG(u.s.X26, 8, CONTEXT_INTEGER),
- REG(u.s.X27, 8, CONTEXT_INTEGER),
- REG(u.s.X28, 8, CONTEXT_INTEGER),
- REG(u.s.Fp, 8, CONTEXT_INTEGER),
- REG(u.s.Lr, 8, CONTEXT_INTEGER),
- REG(Sp, 8, CONTEXT_CONTROL),
- REG(Pc, 8, CONTEXT_CONTROL),
+ REG(Cpsr, 4),
+ REG(u.s.X0, 8),
+ REG(u.s.X1, 8),
+ REG(u.s.X2, 8),
+ REG(u.s.X3, 8),
+ REG(u.s.X4, 8),
+ REG(u.s.X5, 8),
+ REG(u.s.X6, 8),
+ REG(u.s.X7, 8),
+ REG(u.s.X8, 8),
+ REG(u.s.X9, 8),
+ REG(u.s.X10, 8),
+ REG(u.s.X11, 8),
+ REG(u.s.X12, 8),
+ REG(u.s.X13, 8),
+ REG(u.s.X14, 8),
+ REG(u.s.X15, 8),
+ REG(u.s.X16, 8),
+ REG(u.s.X17, 8),
+ REG(u.s.X18, 8),
+ REG(u.s.X19, 8),
+ REG(u.s.X20, 8),
+ REG(u.s.X21, 8),
+ REG(u.s.X22, 8),
+ REG(u.s.X23, 8),
+ REG(u.s.X24, 8),
+ REG(u.s.X25, 8),
+ REG(u.s.X26, 8),
+ REG(u.s.X27, 8),
+ REG(u.s.X28, 8),
+ REG(u.s.Fp, 8),
+ REG(u.s.Lr, 8),
+ REG(Sp, 8),
+ REG(Pc, 8),
};
#else
# error Define the registers map for your CPU
@@ -553,21 +552,7 @@ static inline void cpu_register_hex_from(CONTEXT* ctx, unsigned idx, const
static BOOL fetch_context(struct gdb_context* gdbctx, HANDLE h, CONTEXT* ctx)
{
- ctx->ContextFlags = CONTEXT_CONTROL
- | CONTEXT_INTEGER
-#if defined(__powerpc__) || defined(__i386__) || defined(__x86_64__)
- | CONTEXT_FLOATING_POINT
-#endif
-#ifdef CONTEXT_SEGMENTS
- | CONTEXT_SEGMENTS
-#endif
-#ifdef CONTEXT_DEBUG_REGISTERS
- | CONTEXT_DEBUG_REGISTERS
-#endif
-#ifdef CONTEXT_EXTENDED_REGISTERS
- | CONTEXT_EXTENDED_REGISTERS
-#endif
- ;
+ ctx->ContextFlags = CONTEXT_ALL;
if (!GetThreadContext(h, ctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
@@ -1135,10 +1120,6 @@ static enum packet_return packet_reply_status(struct gdb_context* gdbctx)
for (i = 0; i < cpu_num_regs; i++)
{
- ULONG flags = cpu_register_map[i].ctx_flags;
- if ((gdbctx->context.ContextFlags & flags) != flags)
- break;
-
/* FIXME: this call will also grow the buffer...
* unneeded, but not harmful
*/
@@ -1474,12 +1455,7 @@ static enum packet_return packet_read_registers(struct gdb_context* gdbctx)
packet_reply_open(gdbctx);
for (i = 0; i < cpu_num_regs; i++)
- {
- ULONG flags = cpu_register_map[i].ctx_flags;
- if ((gdbctx->context.ContextFlags & flags) != flags)
- break;
packet_reply_register_hex_to(gdbctx, i);
- }
packet_reply_close(gdbctx);
return packet_done;
}
@@ -1501,12 +1477,8 @@ static enum packet_return packet_write_registers(struct gdb_context* gdbctx)
ptr = gdbctx->in_packet;
for (i = 0; i < cpu_num_regs; i++)
- {
- ULONG flags = cpu_register_map[i].ctx_flags;
- if ((pctx->ContextFlags & flags) != flags)
- break;
cpu_register_hex_from(pctx, i, &ptr);
- }
+
if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, pctx))
{
if (gdbctx->trace & GDBPXY_TRC_WIN32_ERROR)
@@ -1704,12 +1676,6 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx)
if (!fetch_context(gdbctx, gdbctx->other_thread->handle, pctx = &ctx))
return packet_error;
}
- if ((pctx->ContextFlags & cpu_register_map[reg].ctx_flags) != cpu_register_map[reg].ctx_flags)
- {
- if (gdbctx->trace & GDBPXY_TRC_COMMAND_ERROR)
- fprintf(stderr, "Writing reg %u is not supported on this host\n", reg);
- return packet_error;
- }
cpu_register_hex_from(pctx, reg, (const char**)&ptr);
if (pctx != &gdbctx->context && !SetThreadContext(gdbctx->other_thread->handle, pctx))
--
2.7.4
June 12, 2018
[PATCH 1/5] winedbg: Make be_cpu process-specific.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/winedbg/be_cpu.h | 2 --
programs/winedbg/break.c | 40 ++++++++++++++--------------
programs/winedbg/db_disasm.c | 4 +--
programs/winedbg/dbg.y | 4 +--
programs/winedbg/debugger.h | 3 ++-
programs/winedbg/expr.c | 4 +--
programs/winedbg/gdbproxy.c | 17 ++++++------
programs/winedbg/info.c | 2 +-
programs/winedbg/memory.c | 26 +++++++++---------
programs/winedbg/stack.c | 10 +++----
programs/winedbg/symbol.c | 2 +-
programs/winedbg/tgt_active.c | 9 ++++---
programs/winedbg/tgt_minidump.c | 4 +--
programs/winedbg/types.c | 17 ++++++------
programs/winedbg/winedbg.c | 58 ++++++++++++++++++++---------------------
15 files changed, 101 insertions(+), 101 deletions(-)
diff --git a/programs/winedbg/be_cpu.h b/programs/winedbg/be_cpu.h
index d62b517..751ac9d 100644
--- a/programs/winedbg/be_cpu.h
+++ b/programs/winedbg/be_cpu.h
@@ -116,8 +116,6 @@ struct backend_cpu
BOOL (*store_integer)(const struct dbg_lvalue* lvalue, unsigned size, BOOL is_signed, LONGLONG);
};
-extern struct backend_cpu* be_cpu;
-
/* some handy functions for non segmented CPUs */
void* be_cpu_linearize(HANDLE hThread, const ADDRESS64*);
BOOL be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c
index cedeed7..2896c17 100644
--- a/programs/winedbg/break.c
+++ b/programs/winedbg/break.c
@@ -63,15 +63,13 @@ void break_set_xpoints(BOOL set)
addr = memory_to_linear_addr(&bp[i].addr);
if (set)
- ret = be_cpu->insert_Xpoint(dbg_curr_process->handle,
- dbg_curr_process->process_io,
- &dbg_context, bp[i].xpoint_type, addr,
- &bp[i].info, size);
+ ret = dbg_curr_process->be_cpu->insert_Xpoint(dbg_curr_process->handle,
+ dbg_curr_process->process_io, &dbg_context, bp[i].xpoint_type,
+ addr, &bp[i].info, size);
else
- ret = be_cpu->remove_Xpoint(dbg_curr_process->handle,
- dbg_curr_process->process_io,
- &dbg_context, bp[i].xpoint_type, addr,
- bp[i].info, size);
+ ret = dbg_curr_process->be_cpu->remove_Xpoint(dbg_curr_process->handle,
+ dbg_curr_process->process_io, &dbg_context, bp[i].xpoint_type,
+ addr, bp[i].info, size);
if (!ret)
{
dbg_printf("Invalid address (");
@@ -572,9 +570,9 @@ static int find_triggered_watch(void)
DWORD64 val = 0;
if (bp[i].refcount && bp[i].enabled && !is_xpoint_break(i) &&
- (be_cpu->is_watchpoint_set(&dbg_context, bp[i].info)))
+ (dbg_curr_process->be_cpu->is_watchpoint_set(&dbg_context, bp[i].info)))
{
- be_cpu->clear_watchpoint(&dbg_context, bp[i].info);
+ dbg_curr_process->be_cpu->clear_watchpoint(&dbg_context, bp[i].info);
if (get_watched_value(i, &val))
{
@@ -599,7 +597,7 @@ static int find_triggered_watch(void)
{
if (val != bp[i].w.oldval)
{
- be_cpu->clear_watchpoint(&dbg_context, bp[i].info);
+ dbg_curr_process->be_cpu->clear_watchpoint(&dbg_context, bp[i].info);
bp[i].w.oldval = val;
found = i;
/* cannot break, because two watch points may have been triggered on
@@ -805,7 +803,7 @@ void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_br
/* If not single-stepping, back up to the break instruction */
if (code == EXCEPTION_BREAKPOINT)
- addr->Offset += be_cpu->adjust_pc_for_break(&dbg_context, TRUE);
+ addr->Offset += dbg_curr_process->be_cpu->adjust_pc_for_break(&dbg_context, TRUE);
dbg_curr_thread->stopped_xpoint = find_xpoint(addr, be_xpoint_break);
dbg_curr_process->bp[0].enabled = FALSE; /* disable the step-over breakpoint */
@@ -821,7 +819,7 @@ void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_br
{
/* If not single-stepping, do not back up over the break instruction */
if (code == EXCEPTION_BREAKPOINT)
- addr->Offset += be_cpu->adjust_pc_for_break(&dbg_context, FALSE);
+ addr->Offset += dbg_curr_process->be_cpu->adjust_pc_for_break(&dbg_context, FALSE);
return;
}
}
@@ -833,7 +831,7 @@ void break_adjust_pc(ADDRESS64* addr, DWORD code, BOOL first_chance, BOOL* is_br
if (dbg_curr_thread->stopped_xpoint == -1 && code == EXCEPTION_BREAKPOINT)
{
*is_break = TRUE;
- addr->Offset += be_cpu->adjust_pc_for_break(&dbg_context, FALSE);
+ addr->Offset += dbg_curr_process->be_cpu->adjust_pc_for_break(&dbg_context, FALSE);
}
}
@@ -890,7 +888,7 @@ void break_restart_execution(int count)
dbg_printf("Not stopped at any breakpoint; argument ignored.\n");
}
- if (mode == dbg_exec_finish && be_cpu->is_function_return(linear))
+ if (mode == dbg_exec_finish && dbg_curr_process->be_cpu->is_function_return(linear))
{
mode = ret_mode = dbg_exec_step_into_insn;
}
@@ -901,7 +899,7 @@ void break_restart_execution(int count)
* FIXME - we need to check for things like thunks or trampolines,
* as the actual function may in fact have debug info.
*/
- if (be_cpu->is_function_call(linear, &callee))
+ if (dbg_curr_process->be_cpu->is_function_call(linear, &callee))
{
status = symbol_get_function_line_status(&callee);
#if 0
@@ -936,7 +934,7 @@ void break_restart_execution(int count)
switch (mode)
{
case dbg_exec_cont: /* Continuous execution */
- be_cpu->single_step(&dbg_context, FALSE);
+ dbg_curr_process->be_cpu->single_step(&dbg_context, FALSE);
break_set_xpoints(TRUE);
break;
@@ -968,16 +966,16 @@ void break_restart_execution(int count)
case dbg_exec_finish:
case dbg_exec_step_over_insn: /* Stepping over a call */
case dbg_exec_step_over_line: /* Stepping over a call */
- if (be_cpu->is_step_over_insn(linear))
+ if (dbg_curr_process->be_cpu->is_step_over_insn(linear))
{
- be_cpu->disasm_one_insn(&addr, FALSE);
+ dbg_curr_process->be_cpu->disasm_one_insn(&addr, FALSE);
dbg_curr_process->bp[0].addr = addr;
dbg_curr_process->bp[0].enabled = TRUE;
dbg_curr_process->bp[0].refcount = 1;
dbg_curr_process->bp[0].skipcount = 0;
dbg_curr_process->bp[0].xpoint_type = be_xpoint_break;
dbg_curr_process->bp[0].condition = NULL;
- be_cpu->single_step(&dbg_context, FALSE);
+ dbg_curr_process->be_cpu->single_step(&dbg_context, FALSE);
break_set_xpoints(TRUE);
break;
}
@@ -985,7 +983,7 @@ void break_restart_execution(int count)
case dbg_exec_step_into_line: /* Single-stepping a line */
case dbg_exec_step_into_insn: /* Single-stepping an instruction */
- be_cpu->single_step(&dbg_context, TRUE);
+ dbg_curr_process->be_cpu->single_step(&dbg_context, TRUE);
break;
default: RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
}
diff --git a/programs/winedbg/db_disasm.c b/programs/winedbg/db_disasm.c
index fc25e1c..9bdfb90 100644
--- a/programs/winedbg/db_disasm.c
+++ b/programs/winedbg/db_disasm.c
@@ -1800,8 +1800,8 @@ void be_i386_disasm_one_insn(ADDRESS64 *addr, int display)
short_addr ? 2 : 4, FALSE );
get_value_inc( address.Segment, addr, /* segment */
2, FALSE );
- be_cpu->build_addr(dbg_curr_thread->handle, &dbg_context,
- &address, address.Segment, address.Offset);
+ dbg_curr_process->be_cpu->build_addr(dbg_curr_thread->handle,
+ &dbg_context, &address, address.Segment, address.Offset);
if( db_display )
{
print_address( &address, TRUE );
diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y
index 61acb90..6b080a5 100644
--- a/programs/winedbg/dbg.y
+++ b/programs/winedbg/dbg.y
@@ -270,8 +270,8 @@ info_command:
tINFO tBREAK { break_info(); }
| tINFO tSHARE { info_win32_module(0); }
| tINFO tSHARE expr_rvalue { info_win32_module($3); }
- | tINFO tREGS { be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0); }
- | tINFO tALLREGS { be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 1); }
+ | tINFO tREGS { dbg_curr_process->be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0); }
+ | tINFO tALLREGS { dbg_curr_process->be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 1); }
| tINFO tSEGMENTS expr_rvalue { info_win32_segments($3 >> 3, 1); }
| tINFO tSEGMENTS { info_win32_segments(0, -1); }
| tINFO tSTACK tNUM { stack_info($3); }
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index a1aac82..0ceb150 100644
--- a/programs/winedbg/debugger.h
+++ b/programs/winedbg/debugger.h
@@ -39,7 +39,7 @@
#include "oaidl.h"
#include <wine/list.h>
-#define ADDRSIZE (be_cpu->pointer_size)
+#define ADDRSIZE (dbg_curr_process->be_cpu->pointer_size)
#define ADDRWIDTH (ADDRSIZE * 2)
/* the debugger uses these exceptions for its internal use */
@@ -228,6 +228,7 @@ struct dbg_process
void* pio_data;
const WCHAR* imageName;
struct list threads;
+ struct backend_cpu* be_cpu;
BOOL continue_on_first_exception : 1,
active_debuggee : 1;
struct dbg_breakpoint bp[MAX_BREAKPOINTS];
diff --git a/programs/winedbg/expr.c b/programs/winedbg/expr.c
index 96a617c..d18ff8d 100644
--- a/programs/winedbg/expr.c
+++ b/programs/winedbg/expr.c
@@ -546,8 +546,8 @@ struct dbg_lvalue expr_eval(struct expr* exp)
case EXP_OP_SEG:
rtn.type.id = dbg_itype_segptr;
rtn.type.module = 0;
- be_cpu->build_addr(dbg_curr_thread->handle, &dbg_context, &rtn.addr,
- types_extract_as_integer(&exp1), types_extract_as_integer(&exp2));
+ dbg_curr_process->be_cpu->build_addr(dbg_curr_thread->handle, &dbg_context, &rtn.addr,
+ types_extract_as_integer(&exp1), types_extract_as_integer(&exp2));
break;
case EXP_OP_LOR:
exp->un.binop.result = (types_extract_as_integer(&exp1) || types_extract_as_integer(&exp2));
diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
index 3ecf629..a9a65c2 100644
--- a/programs/winedbg/gdbproxy.c
+++ b/programs/winedbg/gdbproxy.c
@@ -886,7 +886,8 @@ static void wait_for_debuggee(struct gdb_context* gdbctx)
static void detach_debuggee(struct gdb_context* gdbctx, BOOL kill)
{
- be_cpu->single_step(&gdbctx->context, FALSE);
+ assert(gdbctx->process->be_cpu);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, FALSE);
resume_debuggee(gdbctx, DBG_CONTINUE);
if (!kill)
DebugActiveProcessStop(gdbctx->process->pid);
@@ -1309,13 +1310,13 @@ static enum packet_return packet_verbose_cont(struct gdb_context* gdbctx)
switch (gdbctx->in_packet[actionIndex[i] + 1])
{
case 's': /* step */
- be_cpu->single_step(&gdbctx->context, TRUE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, TRUE);
/* fall through*/
case 'c': /* continue */
resume_debuggee_thread(gdbctx, DBG_CONTINUE, threadID);
break;
case 'S': /* step Sig, */
- be_cpu->single_step(&gdbctx->context, TRUE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, TRUE);
/* fall through */
case 'C': /* continue sig */
hex_from(&sig, gdbctx->in_packet + actionIndex[i] + 2, 1);
@@ -1352,13 +1353,13 @@ static enum packet_return packet_verbose_cont(struct gdb_context* gdbctx)
switch (gdbctx->in_packet[actionIndex[defaultAction] + 1])
{
case 's': /* step */
- be_cpu->single_step(&gdbctx->context, TRUE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, TRUE);
/* fall through */
case 'c': /* continue */
resume_debuggee_thread(gdbctx, DBG_CONTINUE, threadID);
break;
case 'S':
- be_cpu->single_step(&gdbctx->context, TRUE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, TRUE);
/* fall through */
case 'C': /* continue sig */
hex_from(&sig, gdbctx->in_packet + actionIndex[defaultAction] + 2, 1);
@@ -1375,7 +1376,7 @@ static enum packet_return packet_verbose_cont(struct gdb_context* gdbctx)
} /* if(defaultAction >=0) */
wait_for_debuggee(gdbctx);
- be_cpu->single_step(&gdbctx->context, FALSE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, FALSE);
return packet_reply_status(gdbctx);
}
@@ -2090,10 +2091,10 @@ static enum packet_return packet_step(struct gdb_context* gdbctx)
if (gdbctx->trace & GDBPXY_TRC_COMMAND_FIXME)
fprintf(stderr, "NIY: step on %04x, while last thread is %04x\n",
gdbctx->exec_thread->tid, dbg_curr_thread->tid);
- be_cpu->single_step(&gdbctx->context, TRUE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, TRUE);
resume_debuggee(gdbctx, DBG_CONTINUE);
wait_for_debuggee(gdbctx);
- be_cpu->single_step(&gdbctx->context, FALSE);
+ gdbctx->process->be_cpu->single_step(&gdbctx->context, FALSE);
return packet_reply_status(gdbctx);
}
diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c
index 83341c0..c965759 100644
--- a/programs/winedbg/info.c
+++ b/programs/winedbg/info.c
@@ -974,7 +974,7 @@ void info_win32_exception(void)
{
case AddrModeFlat:
dbg_printf(" in %d-bit code (%s)",
- be_cpu->pointer_size * 8,
+ dbg_curr_process->be_cpu->pointer_size * 8,
memory_offset_to_string(hexbuf, addr.Offset, 0));
break;
case AddrModeReal:
diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c
index 970e81a..6e65fa6 100644
--- a/programs/winedbg/memory.c
+++ b/programs/winedbg/memory.c
@@ -50,20 +50,20 @@ BOOL be_cpu_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
void* memory_to_linear_addr(const ADDRESS64* addr)
{
- return be_cpu->linearize(dbg_curr_thread->handle, addr);
+ return dbg_curr_process->be_cpu->linearize(dbg_curr_thread->handle, addr);
}
BOOL memory_get_current_pc(ADDRESS64* addr)
{
- assert(be_cpu->get_addr);
- return be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
+ assert(dbg_curr_process->be_cpu->get_addr);
+ return dbg_curr_process->be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
be_cpu_addr_pc, addr);
}
BOOL memory_get_current_stack(ADDRESS64* addr)
{
- assert(be_cpu->get_addr);
- return be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
+ assert(dbg_curr_process->be_cpu->get_addr);
+ return dbg_curr_process->be_cpu->get_addr(dbg_curr_thread->handle, &dbg_context,
be_cpu_addr_stack, addr);
}
@@ -374,17 +374,17 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
{
case btInt:
case btLong:
- if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
if (size == 1) goto print_char;
dbg_print_hex(size, val_int);
break;
case btUInt:
case btULong:
- if (!be_cpu->fetch_integer(lvalue, size, FALSE, &val_int)) return;
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, size, FALSE, &val_int)) return;
dbg_print_hex(size, val_int);
break;
case btFloat:
- if (!be_cpu->fetch_float(lvalue, size, &val_real)) return;
+ if (!dbg_curr_process->be_cpu->fetch_float(lvalue, size, &val_real)) return;
dbg_printf("%Lf", val_real);
break;
case btChar:
@@ -392,7 +392,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
/* sometimes WCHAR is defined as btChar with size = 2, so discrimate
* Ansi/Unicode based on size, not on basetype
*/
- if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
print_char:
if (size == 1 && isprint((char)val_int))
dbg_printf("'%c'", (char)val_int);
@@ -407,7 +407,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
dbg_printf("%d", (int)val_int);
break;
case btBool:
- if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
dbg_printf("%s", val_int ? "true" : "false");
break;
default:
@@ -455,7 +455,7 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue)
* (not supported yet in dbghelp)
* Assuming 4 as for an int
*/
- if (!be_cpu->fetch_integer(lvalue, 4, TRUE, &val_int)) return;
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, 4, TRUE, &val_int)) return;
if (types_get_info(&type, TI_GET_CHILDRENCOUNT, &count))
{
@@ -631,7 +631,7 @@ BOOL memory_disasm_one_insn(ADDRESS64* addr)
dbg_printf("-- no code accessible --\n");
return FALSE;
}
- be_cpu->disasm_one_insn(addr, TRUE);
+ dbg_curr_process->be_cpu->disasm_one_insn(addr, TRUE);
dbg_printf("\n");
return TRUE;
}
@@ -685,7 +685,7 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len)
return FALSE;
}
- for (div = be_cpu->context_vars; div->name; div++)
+ for (div = dbg_curr_process->be_cpu->context_vars; div->name; div++)
{
if (div->val == regno)
{
diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index f49480a..2ab4e60 100644
--- a/programs/winedbg/stack.c
+++ b/programs/winedbg/stack.c
@@ -121,7 +121,7 @@ BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pv
{
enum be_cpu_addr kind;
- if (!be_cpu->get_register_info(div->val, &kind)) return FALSE;
+ if (!dbg_curr_process->be_cpu->get_register_info(div->val, &kind)) return FALSE;
/* reuse some known registers directly out of stackwalk details */
switch (kind)
@@ -198,9 +198,9 @@ unsigned stack_fetch_frames(const CONTEXT* _ctx)
dbg_curr_thread->frames = NULL;
memset(&sf, 0, sizeof(sf));
- be_cpu->get_addr(dbg_curr_thread->handle, &ctx, be_cpu_addr_frame, &sf.AddrFrame);
- be_cpu->get_addr(dbg_curr_thread->handle, &ctx, be_cpu_addr_pc, &sf.AddrPC);
- be_cpu->get_addr(dbg_curr_thread->handle, &ctx, be_cpu_addr_stack, &sf.AddrStack);
+ dbg_curr_process->be_cpu->get_addr(dbg_curr_thread->handle, &ctx, be_cpu_addr_frame, &sf.AddrFrame);
+ dbg_curr_process->be_cpu->get_addr(dbg_curr_thread->handle, &ctx, be_cpu_addr_pc, &sf.AddrPC);
+ dbg_curr_process->be_cpu->get_addr(dbg_curr_thread->handle, &ctx, be_cpu_addr_stack, &sf.AddrStack);
/* don't confuse StackWalk by passing in inconsistent addresses */
if ((sf.AddrPC.Mode == AddrModeFlat) && (sf.AddrFrame.Mode != AddrModeFlat))
@@ -209,7 +209,7 @@ unsigned stack_fetch_frames(const CONTEXT* _ctx)
sf.AddrFrame.Mode = AddrModeFlat;
}
- while ((ret = StackWalk64(be_cpu->machine, dbg_curr_process->handle,
+ while ((ret = StackWalk64(dbg_curr_process->be_cpu->machine, dbg_curr_process->handle,
dbg_curr_thread->handle, &sf, &ctx, stack_read_mem,
SymFunctionTableAccess64, SymGetModuleBase64, NULL)) ||
nf == 0) /* we always register first frame information */
diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c
index 1040187..aa88ffc 100644
--- a/programs/winedbg/symbol.c
+++ b/programs/winedbg/symbol.c
@@ -590,7 +590,7 @@ enum dbg_line_status symbol_get_function_line_status(const ADDRESS64* addr)
/* some compilers insert thunks in their code without debug info associated
* take care of this situation
*/
- if (be_cpu->is_jump((void*)lin, &jumpee))
+ if (dbg_curr_process->be_cpu->is_jump((void*)lin, &jumpee))
return symbol_get_function_line_status(&jumpee);
return dbg_no_line_info;
}
diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c
index 07edccc..d891cfe 100644
--- a/programs/winedbg/tgt_active.c
+++ b/programs/winedbg/tgt_active.c
@@ -148,7 +148,8 @@ static BOOL dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec)
case AddrMode1616: name = "16 bit"; break;
case AddrMode1632: name = "segmented 32 bit"; break;
case AddrModeReal: name = "vm86"; break;
- case AddrModeFlat: name = be_cpu->pointer_size == 4 ? "32 bit" : "64 bit"; break;
+ case AddrModeFlat: name = dbg_curr_process->be_cpu->pointer_size == 4
+ ? "32 bit" : "64 bit"; break;
}
dbg_printf("In %s mode.\n", name);
dbg_curr_thread->addr_mode = addr.Mode;
@@ -158,9 +159,9 @@ static BOOL dbg_exception_prolog(BOOL is_debug, const EXCEPTION_RECORD* rec)
if (!is_debug)
{
/* This is a real crash, dump some info */
- be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0);
+ dbg_curr_process->be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0);
stack_info(-1);
- be_cpu->print_segment_info(dbg_curr_thread->handle, &dbg_context);
+ dbg_curr_process->be_cpu->print_segment_info(dbg_curr_thread->handle, &dbg_context);
stack_backtrace(dbg_curr_tid);
}
else
@@ -997,7 +998,7 @@ static BOOL tgt_process_active_close_process(struct dbg_process* pcs, BOOL kill)
/* needed for single stepping (ugly).
* should this be handled inside the server ???
*/
- be_cpu->single_step(&dbg_context, FALSE);
+ dbg_curr_process->be_cpu->single_step(&dbg_context, FALSE);
if (dbg_curr_thread->in_exception)
{
SetThreadContext(dbg_curr_thread->handle, &dbg_context);
diff --git a/programs/winedbg/tgt_minidump.c b/programs/winedbg/tgt_minidump.c
index 5bf5a60..a17f32b 100644
--- a/programs/winedbg/tgt_minidump.c
+++ b/programs/winedbg/tgt_minidump.c
@@ -477,9 +477,9 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data)
min(sizeof(dbg_context), mes->ThreadContext.DataSize));
memory_get_current_pc(&addr);
stack_fetch_frames(&dbg_context);
- be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0);
+ dbg_curr_process->be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0);
stack_info(-1);
- be_cpu->print_segment_info(dbg_curr_thread->handle, &dbg_context);
+ dbg_curr_process->be_cpu->print_segment_info(dbg_curr_thread->handle, &dbg_context);
stack_backtrace(mes->ThreadId);
source_list_from_addr(&addr, 0);
}
diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c
index 3268d7e..696a9fd 100644
--- a/programs/winedbg/types.c
+++ b/programs/winedbg/types.c
@@ -92,11 +92,11 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue,
{
case btChar:
case btInt:
- if (!be_cpu->fetch_integer(lvalue, (unsigned)size, s = TRUE, &rtn))
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, (unsigned)size, s = TRUE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case btUInt:
- if (!be_cpu->fetch_integer(lvalue, (unsigned)size, s = FALSE, &rtn))
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, (unsigned)size, s = FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case btFloat:
@@ -106,17 +106,17 @@ LONGLONG types_extract_as_longlong(const struct dbg_lvalue* lvalue,
if (issigned) *issigned = s;
break;
case SymTagPointerType:
- if (!be_cpu->fetch_integer(lvalue, sizeof(void*), s = FALSE, &rtn))
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, sizeof(void*), s = FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagArrayType:
case SymTagUDT:
- if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagEnum:
/* FIXME: we don't handle enum size */
- if (!be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
+ if (!dbg_curr_process->be_cpu->fetch_integer(lvalue, sizeof(unsigned), s = FALSE, &rtn))
RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
break;
case SymTagFunctionType:
@@ -173,7 +173,7 @@ BOOL types_store_value(struct dbg_lvalue* lvalue_to, const struct dbg_lvalue* lv
}
/* FIXME: should support floats as well */
val = types_extract_as_longlong(lvalue_from, NULL, &is_signed);
- return be_cpu->store_integer(lvalue_to, size, is_signed, val);
+ return dbg_curr_process->be_cpu->store_integer(lvalue_to, size, is_signed, val);
}
/******************************************************************
@@ -302,9 +302,10 @@ BOOL types_array_index(const struct dbg_lvalue* lvalue, int index, struct dbg_lv
result->addr = lvalue->addr;
break;
case SymTagPointerType:
- if (!memory_read_value(lvalue, be_cpu->pointer_size, &result->addr.Offset)) return FALSE;
+ if (!memory_read_value(lvalue, dbg_curr_process->be_cpu->pointer_size, &result->addr.Offset))
+ return FALSE;
result->addr.Mode = AddrModeFlat;
- switch (be_cpu->pointer_size)
+ switch (dbg_curr_process->be_cpu->pointer_size)
{
case 4: result->addr.Offset = (DWORD)result->addr.Offset; break;
case 8: break;
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c
index e0ad4d8..b32b24c 100644
--- a/programs/winedbg/winedbg.c
+++ b/programs/winedbg/winedbg.c
@@ -241,7 +241,7 @@ const struct dbg_internal_var* dbg_get_internal_var(const char* name)
{
if (!strcmp(div->name, name)) return div;
}
- for (div = be_cpu->context_vars; div->name; div++)
+ for (div = dbg_curr_process->be_cpu->context_vars; div->name; div++)
{
if (!strcasecmp(div->name, name))
{
@@ -279,6 +279,20 @@ struct dbg_process* dbg_get_process_h(HANDLE h)
return NULL;
}
+#ifdef __i386__
+extern struct backend_cpu be_i386;
+#elif defined(__powerpc__)
+extern struct backend_cpu be_ppc;
+#elif defined(__x86_64__)
+extern struct backend_cpu be_x86_64;
+#elif defined(__arm__) && !defined(__ARMEB__)
+extern struct backend_cpu be_arm;
+#elif defined(__aarch64__) && !defined(__AARCH64EB__)
+extern struct backend_cpu be_arm64;
+#else
+# error CPU unknown
+#endif
+
struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, HANDLE h)
{
struct dbg_process* p;
@@ -318,6 +332,20 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid,
p->source_end_line = -1;
list_add_head(&dbg_process_list, &p->entry);
+
+#ifdef __i386__
+ p->be_cpu = &be_i386;
+#elif defined(__powerpc__)
+ p->be_cpu = &be_ppc;
+#elif defined(__x86_64__)
+ p->be_cpu = &be_x86_64;
+#elif defined(__arm__) && !defined(__ARMEB__)
+ p->be_cpu = &be_arm;
+#elif defined(__aarch64__) && !defined(__AARCH64EB__)
+ p->be_cpu = &be_arm64;
+#else
+# error CPU unknown
+#endif
return p;
}
@@ -609,40 +637,12 @@ static LONG CALLBACK top_filter( EXCEPTION_POINTERS *ptr )
return EXCEPTION_EXECUTE_HANDLER;
}
-struct backend_cpu* be_cpu;
-#ifdef __i386__
-extern struct backend_cpu be_i386;
-#elif defined(__powerpc__)
-extern struct backend_cpu be_ppc;
-#elif defined(__x86_64__)
-extern struct backend_cpu be_x86_64;
-#elif defined(__arm__) && !defined(__ARMEB__)
-extern struct backend_cpu be_arm;
-#elif defined(__aarch64__) && !defined(__AARCH64EB__)
-extern struct backend_cpu be_arm64;
-#else
-# error CPU unknown
-#endif
-
int main(int argc, char** argv)
{
int retv = 0;
HANDLE hFile = INVALID_HANDLE_VALUE;
enum dbg_start ds;
-#ifdef __i386__
- be_cpu = &be_i386;
-#elif defined(__powerpc__)
- be_cpu = &be_ppc;
-#elif defined(__x86_64__)
- be_cpu = &be_x86_64;
-#elif defined(__arm__) && !defined(__ARMEB__)
- be_cpu = &be_arm;
-#elif defined(__aarch64__) && !defined(__AARCH64EB__)
- be_cpu = &be_arm64;
-#else
-# error CPU unknown
-#endif
/* Initialize the output */
dbg_houtput = GetStdHandle(STD_OUTPUT_HANDLE);
--
2.7.4
June 12, 2018
[PATCH] msi/tests: Avoid ARRAY_SIZE-like macros
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msi/tests/db.c | 4 +---
dlls/msi/tests/install.c | 4 +---
dlls/msi/tests/patch.c | 12 +++---------
3 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 477ab0ad39..ff54a95ab1 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -3033,8 +3033,6 @@ static const struct {
{ name9, data9, sizeof data9 },
};
-#define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
-
static void generate_transform_manual(void)
{
IStorage *stg = NULL;
@@ -3056,7 +3054,7 @@ static void generate_transform_manual(void)
r = IStorage_SetClass( stg, &CLSID_MsiTransform );
ok(r == S_OK, "failed to set storage type\n");
- for (i=0; i<NUM_TRANSFORM_TABLES; i++)
+ for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
{
r = IStorage_CreateStream( stg, table_transform_data[i].name,
STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 3eb6c80422..951f0e7222 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -3671,8 +3671,6 @@ static const struct {
{ name3, data3, sizeof data3 },
};
-#define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
-
static void generate_transform_manual(void)
{
IStorage *stg = NULL;
@@ -3694,7 +3692,7 @@ static void generate_transform_manual(void)
r = IStorage_SetClass(stg, &CLSID_MsiTransform);
ok(r == S_OK, "failed to set storage type\n");
- for (i=0; i<NUM_TRANSFORM_TABLES; i++)
+ for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
{
r = IStorage_CreateStream(stg, table_transform_data[i].name,
STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c
index b6e990b461..a09084002e 100644
--- a/dlls/msi/tests/patch.c
+++ b/dlls/msi/tests/patch.c
@@ -446,8 +446,6 @@ static const struct table_data table_patch_data[] = {
{ p_name6, p_data6, sizeof p_data6 }
};
-#define NUM_PATCH_TABLES (sizeof table_patch_data/sizeof table_patch_data[0])
-
static const WCHAR t1_name0[] = { 0x4840, 0x430f, 0x422f, 0 }; /* File */
static const WCHAR t1_name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
static const WCHAR t1_name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
@@ -519,8 +517,6 @@ static const struct table_data table_transform1_data[] = {
{ t1_name3, t1_data3, sizeof t1_data3 }
};
-#define NUM_TRANSFORM1_TABLES (sizeof table_transform1_data/sizeof table_transform1_data[0])
-
static const WCHAR t2_name0[] = { 0x4840, 0x430f, 0x422f, 0 }; /* File */
static const WCHAR t2_name1[] = { 0x4840, 0x4216, 0x4327, 0x4824, 0 }; /* Media */
static const WCHAR t2_name2[] = { 0x4840, 0x3b3f, 0x43f2, 0x4438, 0x45b1, 0 }; /* _Columns */
@@ -644,8 +640,6 @@ static const struct table_data table_transform2_data[] = {
{ t2_name9, t2_data9, sizeof t2_data9 }
};
-#define NUM_TRANSFORM2_TABLES (sizeof table_transform2_data/sizeof table_transform2_data[0])
-
static void write_tables( IStorage *stg, const struct table_data *tables, UINT num_tables )
{
IStream *stm;
@@ -692,7 +686,7 @@ static void create_patch( const char *filename )
r = IStorage_SetClass( stg, &CLSID_MsiPatch );
ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
- write_tables( stg, table_patch_data, NUM_PATCH_TABLES );
+ write_tables( stg, table_patch_data, ARRAY_SIZE( table_patch_data ));
r = IStorage_CreateStorage( stg, p_name7, mode, 0, 0, &stg1 );
ok( r == S_OK, "failed to create substorage 0x%08x\n", r );
@@ -700,7 +694,7 @@ static void create_patch( const char *filename )
r = IStorage_SetClass( stg1, &CLSID_MsiTransform );
ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
- write_tables( stg1, table_transform1_data, NUM_TRANSFORM1_TABLES );
+ write_tables( stg1, table_transform1_data, ARRAY_SIZE( table_transform1_data ));
IStorage_Release( stg1 );
r = IStorage_CreateStorage( stg, p_name8, mode, 0, 0, &stg2 );
@@ -709,7 +703,7 @@ static void create_patch( const char *filename )
r = IStorage_SetClass( stg2, &CLSID_MsiTransform );
ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
- write_tables( stg2, table_transform2_data, NUM_TRANSFORM2_TABLES );
+ write_tables( stg2, table_transform2_data, ARRAY_SIZE( table_transform2_data ));
IStorage_Release( stg2 );
IStorage_Release( stg );
}
--
2.14.4
June 12, 2018
Problems in winemaker.1
by esr@thyrsus.com
This is automatically generated email about markup problems in a man
page for which you appear to be responsible. If you are not the right
person or list, please tell me so I can correct my database.
See http://catb.org/~esr/doclifter/bugs.html for details on how and
why these patches were generated. Feel free to email me with any
questions. Note: These patches do not change the modification date of
any manual page. You may wish to do that by hand.
I apologize if this message seems spammy or impersonal. The volume of
markup bugs I am tracking is over five hundred - there is no real
alternative to generating bugmail from a database and template.
--
Eric S. Raymond
Problems with winemaker.1:
Unbalanced group in command synopsis. You probably forgot
to open or close a [ ] or { } group properly.
--- winemaker.1-unpatched 2014-06-02 09:52:02.517334795 -0400
+++ winemaker.1 2014-06-02 09:54:21.272566508 -0400
@@ -29,7 +29,6 @@
.br
[
.BR "--generated-files " "] [ " "--nogenerated-files " "]
-]
.br
[
.BR "--wine32 " "]
June 12, 2018
Re: [PATCH v2 5/5] wined3d: Set stream stride and offset even when buffer is NULL.
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39087
Your paranoid android.
=== w1064 (64 bit visual) ===
visual.c:8592: Test failed: Got unexpected color 0x00007580 for quad 2 (different colors).
June 12, 2018
[PATCH v2 5/5] wined3d: Set stream stride and offset even when buffer is NULL.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
v2: Get rid of more todo_wine.
dlls/d3d10core/tests/device.c | 4 ++--
dlls/d3d11/tests/d3d11.c | 3 ---
dlls/d3d8/device.c | 8 ++++++++
dlls/d3d9/device.c | 8 ++++++++
dlls/d3d9/tests/device.c | 2 +-
dlls/d3d9/tests/visual.c | 2 +-
dlls/d3dx10_43/tests/d3dx10.c | 4 ++--
dlls/wined3d/device.c | 6 ++----
8 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c
index 2687ec52b76..8fba7a3badd 100644
--- a/dlls/d3d10core/tests/device.c
+++ b/dlls/d3d10core/tests/device.c
@@ -5493,8 +5493,8 @@ float4 main(float4 color : COLOR) : SV_TARGET
for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
{
ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i);
- todo_wine ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
- todo_wine ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
+ ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
+ ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
}
ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset);
ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]);
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index c641372bc8e..ee8d465cb4e 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -10647,11 +10647,8 @@ static void test_clear_state(void)
for (i = 0; i < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
{
ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i);
- todo_wine_if(i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)
- {
ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
- }
}
ID3D11DeviceContext_IAGetIndexBuffer(context, tmp_buffer, &format, offset);
ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]);
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 616886bcafa..e4869c2618e 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -3102,6 +3102,14 @@ static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
iface, stream_idx, buffer, stride);
wined3d_mutex_lock();
+ if (!stride)
+ {
+ struct wined3d_buffer *wined3d_buffer;
+ unsigned int cur_offset;
+
+ hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
+ &cur_offset, &stride);
+ }
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
buffer_impl ? buffer_impl->wined3d_buffer : NULL, 0, stride);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 5d0f5071836..e32bc14af5b 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -3348,6 +3348,14 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface,
iface, stream_idx, buffer, offset, stride);
wined3d_mutex_lock();
+ if (!stride)
+ {
+ struct wined3d_buffer *wined3d_buffer;
+ unsigned int cur_offset;
+
+ hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
+ &cur_offset, &stride);
+ }
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
buffer_impl ? buffer_impl->wined3d_buffer : NULL, offset, stride);
wined3d_mutex_unlock();
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index b71058de486..66bf5b00c50 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -2973,7 +2973,7 @@ static void test_draw_primitive(void)
ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
ok(!current_vb, "Unexpected vb %p.\n", current_vb);
ok(!offset, "Unexpected offset %u.\n", offset);
- todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
+ ok(!stride, "Unexpected stride %u.\n", stride);
/* NULL index buffer, valid vertex declaration, NULL stream source. */
hr = IDirect3DDevice9_SetIndices(device, NULL);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 1e213abeb18..95982e05155 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -23132,7 +23132,7 @@ static void test_drawindexedprimitiveup(void)
ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
ok(!vb, "Unexpected vb %p.\n", vb);
ok(!offset, "Unexpected offset %u.\n", offset);
- todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
+ ok(!stride, "Unexpected stride %u.\n", stride);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 2bf92cdb589..cd61d766e8e 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -480,8 +480,8 @@ float4 main(float4 color : COLOR) : SV_TARGET
for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
{
ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i);
- todo_wine ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
- todo_wine ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
+ ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
+ ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
}
ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset);
ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 8ef74b6ef0f..6776c5c5e0c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1389,12 +1389,10 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
}
stream->buffer = buffer;
+ stream->stride = stride;
+ stream->offset = offset;
if (buffer)
- {
- stream->stride = stride;
- stream->offset = offset;
wined3d_buffer_incref(buffer);
- }
if (!device->recording)
wined3d_cs_emit_set_stream_source(device->cs, stream_idx, buffer, offset, stride);
--
2.16.1
June 12, 2018
[PATCH v2 4/5] wined3d: Declare the correct number and type of fragment shader color outputs.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
v2: Reuse shader_glsl_sprintf_cast() in
shader_glsl_generate_color_output(), avoid semantic string comparison.
Let me know if you prefer the old version after all (and the old patch
doesn't apply anymore).
dlls/wined3d/glsl_shader.c | 128 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 111 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index cd4780a6419..d5dc8be136a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -3318,12 +3318,12 @@ static void shader_glsl_get_swizzle(const struct wined3d_shader_src_param *param
shader_glsl_swizzle_to_str(param->swizzle, fixup, mask, swizzle_str);
}
-static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, const char *src_param,
+static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *buffer, const char *arg,
enum wined3d_component_type dst_type, enum wined3d_component_type src_type)
{
if (dst_type == src_type)
{
- string_buffer_sprintf(dst_param, "%s", src_param);
+ string_buffer_sprintf(buffer, "%s", arg);
return;
}
@@ -3332,10 +3332,10 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
switch (dst_type)
{
case WINED3D_TYPE_INT:
- string_buffer_sprintf(dst_param, "floatBitsToInt(%s)", src_param);
+ string_buffer_sprintf(buffer, "floatBitsToInt(%s)", arg);
return;
case WINED3D_TYPE_UINT:
- string_buffer_sprintf(dst_param, "floatBitsToUint(%s)", src_param);
+ string_buffer_sprintf(buffer, "floatBitsToUint(%s)", arg);
return;
default:
break;
@@ -3344,18 +3344,18 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
if (src_type == WINED3D_TYPE_UINT && dst_type == WINED3D_TYPE_FLOAT)
{
- string_buffer_sprintf(dst_param, "uintBitsToFloat(%s)", src_param);
+ string_buffer_sprintf(buffer, "uintBitsToFloat(%s)", arg);
return;
}
if (src_type == WINED3D_TYPE_INT && dst_type == WINED3D_TYPE_FLOAT)
{
- string_buffer_sprintf(dst_param, "intBitsToFloat(%s)", src_param);
+ string_buffer_sprintf(buffer, "intBitsToFloat(%s)", arg);
return;
}
FIXME("Unhandled cast from %#x to %#x.\n", src_type, dst_type);
- string_buffer_sprintf(dst_param, "%s", src_param);
+ string_buffer_sprintf(buffer, "%s", arg);
}
/* From a given parameter token, generate the corresponding GLSL string.
@@ -7616,9 +7616,48 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer,
shader_addline(buffer, "#extension GL_EXT_texture_array : enable\n");
}
+static void shader_glsl_generate_color_output(struct wined3d_string_buffer *buffer,
+ const struct wined3d_gl_info *gl_info, const struct wined3d_shader *shader,
+ struct wined3d_string_buffer_list *string_buffers)
+{
+ const struct wined3d_shader_signature *output_signature = &shader->output_signature;
+ struct wined3d_string_buffer *src, *assignment;
+ unsigned int i;
+
+ if (output_signature->element_count)
+ {
+ src = string_buffer_get(string_buffers);
+ assignment = string_buffer_get(string_buffers);
+ for (i = 0; i < output_signature->element_count; ++i)
+ {
+ const struct wined3d_shader_signature_element *output = &output_signature->elements[i];
+
+ /* register_idx is set to ~0u for non-color outputs. */
+ if (output->register_idx == ~0u)
+ continue;
+ shader_addline(buffer, "color_out%u = ", output->semantic_idx);
+ string_buffer_sprintf(src, "ps_out[%u]", output->semantic_idx);
+ shader_glsl_sprintf_cast(assignment, src->buffer, output->component_type, WINED3D_TYPE_FLOAT);
+ shader_addline(buffer, "%s;\n", assignment->buffer);
+ }
+ string_buffer_release(string_buffers, src);
+ string_buffer_release(string_buffers, assignment);
+ }
+ else
+ {
+ DWORD mask = shader->reg_maps.rt_mask;
+
+ while (mask)
+ {
+ i = wined3d_bit_scan(&mask);
+ shader_addline(buffer, "color_out%u = ps_out[%u];\n", i, i);
+ }
+ }
+}
+
static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_info,
struct wined3d_string_buffer *buffer, const struct wined3d_shader *shader,
- const struct ps_compile_args *args)
+ const struct ps_compile_args *args, struct wined3d_string_buffer_list *string_buffers)
{
const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps;
@@ -7637,6 +7676,26 @@ static void shader_glsl_generate_ps_epilogue(const struct wined3d_gl_info *gl_in
if (reg_maps->sample_mask)
shader_addline(buffer, "gl_SampleMask[0] = floatBitsToInt(sample_mask);\n");
+
+ if (!needs_legacy_glsl_syntax(gl_info))
+ shader_glsl_generate_color_output(buffer, gl_info, shader, string_buffers);
+}
+
+static const char *shader_glsl_get_ps_output_format(enum wined3d_component_type component_type)
+{
+ static const char formats[][6] =
+ {
+ "", /* WINED3D_TYPE_UNKNOWN */
+ "uvec4", /* WINED3D_TYPE_UINT */
+ "ivec4", /* WINED3D_TYPE_INT */
+ "vec4", /* WINED3D_TYPE_FLOAT */
+ };
+ if (component_type < WINED3D_TYPE_UNKNOWN || component_type > WINED3D_TYPE_FLOAT)
+ {
+ WARN("Unexpected component_type %#x.\n", component_type);
+ return formats[WINED3D_TYPE_FLOAT];
+ }
+ return formats[component_type];
}
/* Context activation is done by the caller. */
@@ -7819,9 +7878,35 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
if (!needs_legacy_glsl_syntax(gl_info))
{
- if (shader_glsl_use_explicit_attrib_location(gl_info))
- shader_addline(buffer, "layout(location = 0) ");
- shader_addline(buffer, "out vec4 ps_out[%u];\n", gl_info->limits.buffers);
+ const struct wined3d_shader_signature *output_signature = &shader->output_signature;
+
+ shader_addline(buffer, "vec4 ps_out[%u];\n", gl_info->limits.buffers);
+ if (output_signature->element_count)
+ {
+ for (i = 0; i < output_signature->element_count; ++i)
+ {
+ const struct wined3d_shader_signature_element *output = &output_signature->elements[i];
+
+ if (output->register_idx == ~0u)
+ continue;
+ if (shader_glsl_use_explicit_attrib_location(gl_info))
+ shader_addline(buffer, "layout(location = %u) ", output->semantic_idx);
+ shader_addline(buffer, "out %s color_out%u;\n",
+ shader_glsl_get_ps_output_format(output->component_type), output->semantic_idx);
+ }
+ }
+ else
+ {
+ DWORD mask = reg_maps->rt_mask;
+
+ while (mask)
+ {
+ i = wined3d_bit_scan(&mask);
+ if (shader_glsl_use_explicit_attrib_location(gl_info))
+ shader_addline(buffer, "layout(location = %u) ", i);
+ shader_addline(buffer, "out vec4 color_out%u;\n", i);
+ }
+ }
}
if (shader->limits->constant_float + extra_constants_needed >= gl_info->limits.glsl_ps_float_constants)
@@ -7906,7 +7991,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
/* In SM4+ the shader epilogue is generated by the "ret" instruction. */
if (reg_maps->shader_version.major < 4)
- shader_glsl_generate_ps_epilogue(gl_info, buffer, shader, args);
+ shader_glsl_generate_ps_epilogue(gl_info, buffer, shader, args, string_buffers);
shader_addline(buffer, "}\n");
@@ -8403,7 +8488,7 @@ static void shader_glsl_generate_shader_epilogue(const struct wined3d_shader_con
switch (shader->reg_maps.shader_version.type)
{
case WINED3D_SHADER_TYPE_PIXEL:
- shader_glsl_generate_ps_epilogue(gl_info, buffer, shader, priv->cur_ps_args);
+ shader_glsl_generate_ps_epilogue(gl_info, buffer, shader, priv->cur_ps_args, priv->string_buffers);
break;
case WINED3D_SHADER_TYPE_VERTEX:
shader_glsl_generate_vs_epilogue(gl_info, buffer, shader, priv->cur_vs_args);
@@ -9539,9 +9624,10 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
if (!needs_legacy_glsl_syntax(gl_info))
{
+ shader_addline(buffer, "vec4 ps_out[1];\n");
if (shader_glsl_use_explicit_attrib_location(gl_info))
shader_addline(buffer, "layout(location = 0) ");
- shader_addline(buffer, "out vec4 ps_out[1];\n");
+ shader_addline(buffer, "out vec4 color_out0;\n");
}
shader_addline(buffer, "vec4 tmp0, tmp1;\n");
@@ -9881,6 +9967,8 @@ static GLuint shader_glsl_generate_ffp_fragment_shader(struct shader_glsl_priv *
shader_glsl_generate_fog_code(buffer, gl_info, settings->fog);
shader_glsl_generate_alpha_test(buffer, gl_info, alpha_test_func);
+ if (!needs_legacy_glsl_syntax(gl_info))
+ shader_addline(buffer, "color_out0 = ps_out[0];\n");
shader_addline(buffer, "}\n");
@@ -10422,13 +10510,17 @@ static void set_glsl_shader_program(const struct wined3d_context *context, const
}
}
checkGLcall("glBindAttribLocation");
- string_buffer_release(&priv->string_buffers, tmp_name);
if (!needs_legacy_glsl_syntax(gl_info))
{
- GL_EXTCALL(glBindFragDataLocation(program_id, 0, "ps_out"));
- checkGLcall("glBindFragDataLocation");
+ for (i = 0; i < MAX_RENDER_TARGET_VIEWS; ++i)
+ {
+ string_buffer_sprintf(tmp_name, "color_out%u", i);
+ GL_EXTCALL(glBindFragDataLocation(program_id, i, tmp_name->buffer));
+ checkGLcall("glBindFragDataLocation");
+ }
}
+ string_buffer_release(&priv->string_buffers, tmp_name);
}
if (hshader)
@@ -12796,6 +12888,8 @@ static GLuint glsl_blitter_generate_program(struct wined3d_glsl_blitter *blitter
shader_glsl_add_version_declaration(buffer, gl_info);
shader_addline(buffer, "uniform sampler%s sampler;\n", tex_type);
declare_in_varying(gl_info, buffer, FALSE, "vec3 out_texcoord;\n");
+ /* TODO: Declare the out variable with the correct type (and put it in the
+ * blitter args). */
if (!needs_legacy_glsl_syntax(gl_info))
shader_addline(buffer, "out vec4 ps_out[1];\n");
--
2.16.1
June 12, 2018
[PATCH 3/5] wined3d: Get rid of enum wined3d_data_type.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
With the previous patch it became a subset of the public enum
wined3d_component_type.
dlls/wined3d/glsl_shader.c | 96 +++++++++++++++++++++---------------------
dlls/wined3d/shader.c | 28 ++++++------
dlls/wined3d/shader_sm1.c | 14 +++---
dlls/wined3d/shader_sm4.c | 72 +++++++++++++++----------------
dlls/wined3d/wined3d_private.h | 13 ++----
5 files changed, 108 insertions(+), 115 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index ffe0c2d7e14..cd4780a6419 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -88,7 +88,7 @@ struct glsl_sample_function
struct wined3d_string_buffer *name;
unsigned int coord_mask;
unsigned int deriv_mask;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
BOOL output_single_component;
unsigned int offset_size;
};
@@ -2522,15 +2522,15 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
switch (reg_maps->resource_info[entry->resource_idx].data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
sampler_type_prefix = "";
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
sampler_type_prefix = "i";
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
sampler_type_prefix = "u";
break;
@@ -2638,17 +2638,17 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
switch (reg_maps->uav_resource_info[i].data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
image_type_prefix = "";
read_format = "r32f";
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
image_type_prefix = "i";
read_format = "r32i";
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
image_type_prefix = "u";
read_format = "r32ui";
break;
@@ -2844,7 +2844,7 @@ static void shader_glsl_fixup_scalar_register_variable(char *register_name,
/** Writes the GLSL variable name that corresponds to the register that the
* DX opcode parameter is trying to access */
static void shader_glsl_get_register_name(const struct wined3d_shader_register *reg,
- enum wined3d_data_type data_type, char *register_name, BOOL *is_color,
+ enum wined3d_component_type data_type, char *register_name, BOOL *is_color,
const struct wined3d_shader_instruction *ins)
{
/* oPos, oFog and oPts in D3D */
@@ -3080,16 +3080,16 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
case WINED3D_IMMCONST_SCALAR:
switch (data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
sprintf(register_name, "uintBitsToFloat(%#xu)", reg->u.immconst_data[0]);
else
wined3d_ftoa(*(const float *)reg->u.immconst_data, register_name);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
sprintf(register_name, "%#x", reg->u.immconst_data[0]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
sprintf(register_name, "%#xu", reg->u.immconst_data[0]);
break;
default:
@@ -3101,7 +3101,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
case WINED3D_IMMCONST_VEC4:
switch (data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
if (gl_info->supported[ARB_SHADER_BIT_ENCODING])
{
sprintf(register_name, "uintBitsToFloat(uvec4(%#xu, %#xu, %#xu, %#xu))",
@@ -3118,12 +3118,12 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
imm_str[0], imm_str[1], imm_str[2], imm_str[3]);
}
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
sprintf(register_name, "ivec4(%#x, %#x, %#x, %#x)",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
sprintf(register_name, "uvec4(%#xu, %#xu, %#xu, %#xu)",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
@@ -3319,22 +3319,22 @@ static void shader_glsl_get_swizzle(const struct wined3d_shader_src_param *param
}
static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, const char *src_param,
- enum wined3d_data_type dst_data_type, enum wined3d_data_type src_data_type)
+ enum wined3d_component_type dst_type, enum wined3d_component_type src_type)
{
- if (dst_data_type == src_data_type)
+ if (dst_type == src_type)
{
string_buffer_sprintf(dst_param, "%s", src_param);
return;
}
- if (src_data_type == WINED3D_DATA_FLOAT)
+ if (src_type == WINED3D_TYPE_FLOAT)
{
- switch (dst_data_type)
+ switch (dst_type)
{
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
string_buffer_sprintf(dst_param, "floatBitsToInt(%s)", src_param);
return;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
string_buffer_sprintf(dst_param, "floatBitsToUint(%s)", src_param);
return;
default:
@@ -3342,19 +3342,19 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
}
}
- if (src_data_type == WINED3D_DATA_UINT && dst_data_type == WINED3D_DATA_FLOAT)
+ if (src_type == WINED3D_TYPE_UINT && dst_type == WINED3D_TYPE_FLOAT)
{
string_buffer_sprintf(dst_param, "uintBitsToFloat(%s)", src_param);
return;
}
- if (src_data_type == WINED3D_DATA_INT && dst_data_type == WINED3D_DATA_FLOAT)
+ if (src_type == WINED3D_TYPE_INT && dst_type == WINED3D_TYPE_FLOAT)
{
string_buffer_sprintf(dst_param, "intBitsToFloat(%s)", src_param);
return;
}
- FIXME("Unhandled cast from %#x to %#x.\n", src_data_type, dst_data_type);
+ FIXME("Unhandled cast from %#x to %#x.\n", src_type, dst_type);
string_buffer_sprintf(dst_param, "%s", src_param);
}
@@ -3363,11 +3363,11 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
* caller needs this information as well. */
static void shader_glsl_add_src_param_ext(const struct wined3d_shader_instruction *ins,
const struct wined3d_shader_src_param *wined3d_src, DWORD mask, struct glsl_src_param *glsl_src,
- enum wined3d_data_type data_type)
+ enum wined3d_component_type data_type)
{
struct shader_glsl_ctx_priv *priv = ins->ctx->backend_data;
struct wined3d_string_buffer *reg_name = string_buffer_get(priv->string_buffers);
- enum wined3d_data_type param_data_type;
+ enum wined3d_component_type param_data_type;
BOOL is_color = FALSE;
char swizzle_str[6];
@@ -3392,10 +3392,10 @@ static void shader_glsl_add_src_param_ext(const struct wined3d_shader_instructio
case WINED3DSPR_PRIMID:
case WINED3DSPR_THREADGROUPID:
case WINED3DSPR_THREADID:
- param_data_type = WINED3D_DATA_INT;
+ param_data_type = WINED3D_TYPE_INT;
break;
default:
- param_data_type = WINED3D_DATA_FLOAT;
+ param_data_type = WINED3D_TYPE_FLOAT;
break;
}
@@ -3430,7 +3430,7 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *
/* Append the destination part of the instruction to the buffer, return the effective write mask */
static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer,
const struct wined3d_shader_instruction *ins, const struct wined3d_shader_dst_param *dst,
- enum wined3d_data_type data_type)
+ enum wined3d_component_type data_type)
{
struct glsl_dst_param glsl_dst;
DWORD mask;
@@ -3439,15 +3439,15 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer,
{
switch (data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, "%s%s = %s(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, "%s%s = %sintBitsToFloat(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, "%s%s = %suintBitsToFloat(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
@@ -4009,7 +4009,7 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins)
shader_glsl_add_src_param(ins, &ins->src[1], write_mask, &src1_param);
shader_addline(buffer, "%s %% %s);\n", src0_param.param_str, src1_param.param_str);
- shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_DATA_FLOAT);
+ shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_TYPE_FLOAT);
shader_addline(buffer, "tmp0%s);\n", dst_mask);
}
else
@@ -4287,7 +4287,7 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
dst.write_mask = ins->dst[0].write_mask & (WINED3DSP_WRITEMASK_0 << i);
if (tmp_dst && (write_mask = shader_glsl_get_write_mask(&dst, mask_char)))
shader_addline(buffer, "tmp0%s = %sBitsToFloat(", mask_char,
- dst.reg.data_type == WINED3D_DATA_INT ? "int" : "uint");
+ dst.reg.data_type == WINED3D_TYPE_INT ? "int" : "uint");
else if (!(write_mask = shader_glsl_append_dst_ext(buffer, ins, &dst, dst.reg.data_type)))
continue;
@@ -4301,7 +4301,7 @@ static void shader_glsl_bitwise_op(const struct wined3d_shader_instruction *ins)
if (tmp_dst)
{
- shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_DATA_FLOAT);
+ shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], WINED3D_TYPE_FLOAT);
shader_glsl_get_write_mask(&ins->dst[0], mask_char);
shader_addline(buffer, "tmp0%s);\n", mask_char);
}
@@ -5441,7 +5441,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
struct wined3d_string_buffer *buffer = ins->ctx->buffer;
enum wined3d_shader_resource_type resource_type;
struct wined3d_string_buffer *address;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
unsigned int resource_idx, stride;
const char *op, *resource;
DWORD coord_mask;
@@ -5457,7 +5457,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
return;
}
resource = "g";
- data_type = WINED3D_DATA_UINT;
+ data_type = WINED3D_TYPE_UINT;
coord_mask = 1;
stride = reg_maps->tgsm[resource_idx].stride;
}
@@ -5509,7 +5509,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMax";
else
op = "imageAtomicMax";
- if (data_type != WINED3D_DATA_INT)
+ if (data_type != WINED3D_TYPE_INT)
{
FIXME("Unhandled opcode %#x for unsigned integers.\n", ins->handler_idx);
return;
@@ -5521,7 +5521,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMin";
else
op = "imageAtomicMin";
- if (data_type != WINED3D_DATA_INT)
+ if (data_type != WINED3D_TYPE_INT)
{
FIXME("Unhandled opcode %#x for unsigned integers.\n", ins->handler_idx);
return;
@@ -5540,7 +5540,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMax";
else
op = "imageAtomicMax";
- if (data_type != WINED3D_DATA_UINT)
+ if (data_type != WINED3D_TYPE_UINT)
{
FIXME("Unhandled opcode %#x for signed integers.\n", ins->handler_idx);
return;
@@ -5552,7 +5552,7 @@ static void shader_glsl_atomic(const struct wined3d_shader_instruction *ins)
op = "atomicMin";
else
op = "imageAtomicMin";
- if (data_type != WINED3D_DATA_UINT)
+ if (data_type != WINED3D_TYPE_UINT)
{
FIXME("Unhandled opcode %#x for signed integers.\n", ins->handler_idx);
return;
@@ -5636,7 +5636,7 @@ static void shader_glsl_ld_uav(const struct wined3d_shader_instruction *ins)
const struct wined3d_shader_version *version = ®_maps->shader_version;
enum wined3d_shader_resource_type resource_type;
struct glsl_src_param image_coord_param;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
DWORD coord_mask, write_mask;
unsigned int uav_idx;
char dst_swizzle[6];
@@ -5757,7 +5757,7 @@ static void shader_glsl_store_uav(const struct wined3d_shader_instruction *ins)
const struct wined3d_shader_version *version = ®_maps->shader_version;
struct glsl_src_param image_coord_param, image_data_param;
enum wined3d_shader_resource_type resource_type;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
unsigned int uav_idx;
DWORD coord_mask;
@@ -5947,7 +5947,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
enum wined3d_shader_resource_type resource_type;
enum wined3d_shader_register_type reg_type;
unsigned int resource_idx, bind_idx, i;
- enum wined3d_data_type dst_data_type;
+ enum wined3d_component_type dst_data_type;
struct glsl_src_param lod_param;
BOOL supports_mipmaps;
char dst_swizzle[6];
@@ -5955,7 +5955,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
dst_data_type = ins->dst[0].reg.data_type;
if (ins->flags == WINED3DSI_RESINFO_UINT)
- dst_data_type = WINED3D_DATA_UINT;
+ dst_data_type = WINED3D_TYPE_UINT;
else if (ins->flags)
FIXME("Unhandled flags %#x.\n", ins->flags);
@@ -5983,7 +5983,7 @@ static void shader_glsl_resinfo(const struct wined3d_shader_instruction *ins)
write_mask = shader_glsl_append_dst_ext(buffer, ins, &ins->dst[0], dst_data_type);
shader_glsl_get_swizzle(&ins->src[1], FALSE, write_mask, dst_swizzle);
- if (dst_data_type == WINED3D_DATA_UINT)
+ if (dst_data_type == WINED3D_TYPE_UINT)
shader_addline(buffer, "uvec4(");
else
shader_addline(buffer, "vec4(");
@@ -6036,21 +6036,21 @@ static void shader_glsl_sample_info(const struct wined3d_shader_instruction *ins
const struct wined3d_shader_dst_param *dst = ins->dst;
const struct wined3d_shader_src_param *src = ins->src;
enum wined3d_shader_resource_type resource_type;
- enum wined3d_data_type dst_data_type;
+ enum wined3d_component_type dst_data_type;
unsigned int resource_idx, bind_idx;
char dst_swizzle[6];
DWORD write_mask;
dst_data_type = dst->reg.data_type;
if (ins->flags == WINED3DSI_SAMPLE_INFO_UINT)
- dst_data_type = WINED3D_DATA_UINT;
+ dst_data_type = WINED3D_TYPE_UINT;
else if (ins->flags)
FIXME("Unhandled flags %#x.\n", ins->flags);
write_mask = shader_glsl_append_dst_ext(buffer, ins, dst, dst_data_type);
shader_glsl_get_swizzle(src, FALSE, write_mask, dst_swizzle);
- if (dst_data_type == WINED3D_DATA_UINT)
+ if (dst_data_type == WINED3D_TYPE_UINT)
shader_addline(buffer, "uvec4(");
else
shader_addline(buffer, "vec4(");
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index a2c3f00559a..192e95f4473 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1270,7 +1270,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
break;
}
reg_maps->resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->resource_info[reg_idx].flags = WINED3D_VIEW_BUFFER_RAW;
}
else if (ins.handler_idx == WINED3DSIH_DCL_RESOURCE_STRUCTURED)
@@ -1282,7 +1282,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
break;
}
reg_maps->resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->resource_info[reg_idx].flags = 0;
reg_maps->resource_info[reg_idx].stride = ins.declaration.structured_resource.byte_stride / 4;
}
@@ -1356,7 +1356,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
if (ins.flags)
FIXME("Ignoring raw UAV flags %#x.\n", ins.flags);
reg_maps->uav_resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->uav_resource_info[reg_idx].flags = WINED3D_VIEW_BUFFER_RAW;
}
else if (ins.handler_idx == WINED3DSIH_DCL_UAV_STRUCTURED)
@@ -1370,7 +1370,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
if (ins.flags)
FIXME("Ignoring structured UAV flags %#x.\n", ins.flags);
reg_maps->uav_resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_BUFFER;
- reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_DATA_UINT;
+ reg_maps->uav_resource_info[reg_idx].data_type = WINED3D_TYPE_UINT;
reg_maps->uav_resource_info[reg_idx].flags = 0;
reg_maps->uav_resource_info[reg_idx].stride = ins.declaration.structured_resource.byte_stride / 4;
}
@@ -1609,7 +1609,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, DWORD co
TRACE("Setting fake 2D resource for 1.x pixelshader.\n");
reg_maps->resource_info[reg_idx].type = WINED3D_SHADER_RESOURCE_TEXTURE_2D;
- reg_maps->resource_info[reg_idx].data_type = WINED3D_DATA_FLOAT;
+ reg_maps->resource_info[reg_idx].data_type = WINED3D_TYPE_FLOAT;
shader_record_sample(reg_maps, reg_idx, reg_idx, reg_idx);
/* texbem is only valid with < 1.4 pixel shaders */
@@ -2122,15 +2122,15 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
shader_dump_uav_flags(buffer, flags);
switch (semantic->resource_data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, " (float)");
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, " (int)");
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, " (uint)");
break;
@@ -2434,13 +2434,13 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
case WINED3D_IMMCONST_SCALAR:
switch (reg->data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, "%.8e", *(const float *)reg->u.immconst_data);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, "%d", reg->u.immconst_data[0]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, "%u", reg->u.immconst_data[0]);
break;
default:
@@ -2452,17 +2452,17 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
case WINED3D_IMMCONST_VEC4:
switch (reg->data_type)
{
- case WINED3D_DATA_FLOAT:
+ case WINED3D_TYPE_FLOAT:
shader_addline(buffer, "%.8e, %.8e, %.8e, %.8e",
*(const float *)®->u.immconst_data[0], *(const float *)®->u.immconst_data[1],
*(const float *)®->u.immconst_data[2], *(const float *)®->u.immconst_data[3]);
break;
- case WINED3D_DATA_INT:
+ case WINED3D_TYPE_INT:
shader_addline(buffer, "%d, %d, %d, %d",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
break;
- case WINED3D_DATA_UINT:
+ case WINED3D_TYPE_UINT:
shader_addline(buffer, "%u, %u, %u, %u",
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c
index 0c6bb933174..b57b67b8dcc 100644
--- a/dlls/wined3d/shader_sm1.c
+++ b/dlls/wined3d/shader_sm1.c
@@ -468,7 +468,7 @@ static void shader_parse_src_param(DWORD param, const struct wined3d_shader_src_
{
src->reg.type = ((param & WINED3D_SM1_REGISTER_TYPE_MASK) >> WINED3D_SM1_REGISTER_TYPE_SHIFT)
| ((param & WINED3D_SM1_REGISTER_TYPE_MASK2) >> WINED3D_SM1_REGISTER_TYPE_SHIFT2);
- src->reg.data_type = WINED3D_DATA_FLOAT;
+ src->reg.data_type = WINED3D_TYPE_FLOAT;
src->reg.idx[0].offset = param & WINED3D_SM1_REGISTER_NUMBER_MASK;
src->reg.idx[0].rel_addr = rel_addr;
src->reg.idx[1].offset = ~0U;
@@ -482,7 +482,7 @@ static void shader_parse_dst_param(DWORD param, const struct wined3d_shader_src_
{
dst->reg.type = ((param & WINED3D_SM1_REGISTER_TYPE_MASK) >> WINED3D_SM1_REGISTER_TYPE_SHIFT)
| ((param & WINED3D_SM1_REGISTER_TYPE_MASK2) >> WINED3D_SM1_REGISTER_TYPE_SHIFT2);
- dst->reg.data_type = WINED3D_DATA_FLOAT;
+ dst->reg.data_type = WINED3D_TYPE_FLOAT;
dst->reg.idx[0].offset = param & WINED3D_SM1_REGISTER_NUMBER_MASK;
dst->reg.idx[0].rel_addr = rel_addr;
dst->reg.idx[1].offset = ~0U;
@@ -645,12 +645,12 @@ static void shader_sm1_read_semantic(const DWORD **ptr, struct wined3d_shader_se
{
semantic->resource_type = resource_type_table[resource_type];
}
- semantic->resource_data_type = WINED3D_DATA_FLOAT;
+ semantic->resource_data_type = WINED3D_TYPE_FLOAT;
shader_parse_dst_param(dst_token, NULL, &semantic->reg);
}
static void shader_sm1_read_immconst(const DWORD **ptr, struct wined3d_shader_src_param *src_param,
- enum wined3d_immconst_type type, enum wined3d_data_type data_type)
+ enum wined3d_immconst_type type, enum wined3d_component_type data_type)
{
unsigned int count = type == WINED3D_IMMCONST_VEC4 ? 4 : 1;
src_param->reg.type = WINED3DSPR_IMMCONST;
@@ -761,17 +761,17 @@ static void shader_sm1_read_instruction(void *data, const DWORD **ptr, struct wi
else if (ins->handler_idx == WINED3DSIH_DEF)
{
shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
- shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_DATA_FLOAT);
+ shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_TYPE_FLOAT);
}
else if (ins->handler_idx == WINED3DSIH_DEFB)
{
shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
- shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_SCALAR, WINED3D_DATA_UINT);
+ shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_SCALAR, WINED3D_TYPE_UINT);
}
else if (ins->handler_idx == WINED3DSIH_DEFI)
{
shader_sm1_read_dst_param(priv, &p, &priv->dst_param, &priv->dst_rel_addr);
- shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_DATA_INT);
+ shader_sm1_read_immconst(&p, &priv->src_param[0], WINED3D_IMMCONST_VEC4, WINED3D_TYPE_INT);
}
else
{
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index 69947d21c14..338bae3a8dd 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -506,26 +506,26 @@ static const enum wined3d_shader_resource_type resource_type_table[] =
/* WINED3D_SM4_RESOURCE_TEXTURE_CUBEARRAY */ WINED3D_SHADER_RESOURCE_TEXTURE_CUBEARRAY,
};
-static const enum wined3d_data_type data_type_table[] =
-{
- /* 0 */ WINED3D_DATA_FLOAT,
- /* WINED3D_SM4_DATA_UNORM */ WINED3D_DATA_FLOAT,
- /* WINED3D_SM4_DATA_SNORM */ WINED3D_DATA_FLOAT,
- /* WINED3D_SM4_DATA_INT */ WINED3D_DATA_INT,
- /* WINED3D_SM4_DATA_UINT */ WINED3D_DATA_UINT,
- /* WINED3D_SM4_DATA_FLOAT */ WINED3D_DATA_FLOAT,
+static const enum wined3d_component_type data_type_table[] =
+{
+ /* 0 */ WINED3D_TYPE_FLOAT,
+ /* WINED3D_SM4_DATA_UNORM */ WINED3D_TYPE_FLOAT,
+ /* WINED3D_SM4_DATA_SNORM */ WINED3D_TYPE_FLOAT,
+ /* WINED3D_SM4_DATA_INT */ WINED3D_TYPE_INT,
+ /* WINED3D_SM4_DATA_UINT */ WINED3D_TYPE_UINT,
+ /* WINED3D_SM4_DATA_FLOAT */ WINED3D_TYPE_FLOAT,
};
static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param);
+ enum wined3d_component_type data_type, struct wined3d_shader_src_param *src_param);
static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_dst_param *dst_param);
+ enum wined3d_component_type data_type, struct wined3d_shader_dst_param *dst_param);
static void shader_sm4_read_conditional_op(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &priv->src_param[0]);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &priv->src_param[0]);
ins->flags = (opcode_token & WINED3D_SM4_CONDITIONAL_NZ) ?
WINED3D_SHADER_CONDITIONAL_OP_NZ : WINED3D_SHADER_CONDITIONAL_OP_Z;
}
@@ -579,7 +579,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
ins->declaration.semantic.resource_type = resource_type_table[resource_type];
}
uav = opcode != WINED3D_SM4_OP_DCL_RESOURCE;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.semantic.reg);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.semantic.reg);
components = *tokens++;
if ((components & 0xfff0) != (components & 0xf) * 0x1110)
@@ -589,7 +589,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
if (!data_type || (data_type >= ARRAY_SIZE(data_type_table)))
{
FIXME("Unhandled data type %#x.\n", data_type);
- ins->declaration.semantic.resource_data_type = WINED3D_DATA_FLOAT;
+ ins->declaration.semantic.resource_data_type = WINED3D_TYPE_FLOAT;
}
else
{
@@ -604,7 +604,7 @@ static void shader_sm4_read_dcl_constant_buffer(struct wined3d_shader_instructio
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.src);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.src);
if (opcode_token & WINED3D_SM4_INDEX_TYPE_MASK)
ins->flags |= WINED3DSI_INDEXED_DYNAMIC;
}
@@ -616,14 +616,14 @@ static void shader_sm4_read_dcl_sampler(struct wined3d_shader_instruction *ins,
ins->flags = (opcode_token & WINED3D_SM4_SAMPLER_MODE_MASK) >> WINED3D_SM4_SAMPLER_MODE_SHIFT;
if (ins->flags & ~WINED3D_SM4_SAMPLER_COMPARISON)
FIXME("Unhandled sampler mode %#x.\n", ins->flags);
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.dst);
}
static void shader_sm4_read_dcl_index_range(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT,
&ins->declaration.index_range.first_register);
ins->declaration.index_range.last_register = *tokens;
}
@@ -680,14 +680,14 @@ static void shader_sm4_read_declaration_dst(struct wined3d_shader_instruction *i
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.dst);
}
static void shader_sm4_read_declaration_register_semantic(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT,
&ins->declaration.register_semantic.reg);
ins->declaration.register_semantic.sysval_semantic = *tokens;
}
@@ -697,7 +697,7 @@ static void shader_sm4_read_dcl_input_ps(struct wined3d_shader_instruction *ins,
struct wined3d_sm4_data *priv)
{
ins->flags = (opcode_token & WINED3D_SM4_INTERPOLATION_MODE_MASK) >> WINED3D_SM4_INTERPOLATION_MODE_SHIFT;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.dst);
}
static void shader_sm4_read_dcl_input_ps_siv(struct wined3d_shader_instruction *ins,
@@ -705,7 +705,7 @@ static void shader_sm4_read_dcl_input_ps_siv(struct wined3d_shader_instruction *
struct wined3d_sm4_data *priv)
{
ins->flags = (opcode_token & WINED3D_SM4_INTERPOLATION_MODE_MASK) >> WINED3D_SM4_INTERPOLATION_MODE_SHIFT;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT,
&ins->declaration.register_semantic.reg);
ins->declaration.register_semantic.sysval_semantic = *tokens;
}
@@ -731,7 +731,7 @@ static void shader_sm5_read_fcall(struct wined3d_shader_instruction *ins,
struct wined3d_sm4_data *priv)
{
priv->src_param[0].reg.u.fp_body_idx = *tokens++;
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &priv->src_param[0]);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &priv->src_param[0]);
}
static void shader_sm5_read_dcl_function_body(struct wined3d_shader_instruction *ins,
@@ -812,7 +812,7 @@ static void shader_sm5_read_dcl_uav_raw(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.dst);
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
}
@@ -820,7 +820,7 @@ static void shader_sm5_read_dcl_uav_structured(struct wined3d_shader_instruction
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT,
&ins->declaration.structured_resource.reg);
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
ins->declaration.structured_resource.byte_stride = *tokens;
@@ -832,7 +832,7 @@ static void shader_sm5_read_dcl_tgsm_raw(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT, &ins->declaration.tgsm_raw.reg);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT, &ins->declaration.tgsm_raw.reg);
ins->declaration.tgsm_raw.byte_count = *tokens;
if (ins->declaration.tgsm_raw.byte_count % 4)
FIXME("Byte count %u is not multiple of 4.\n", ins->declaration.tgsm_raw.byte_count);
@@ -842,7 +842,7 @@ static void shader_sm5_read_dcl_tgsm_structured(struct wined3d_shader_instructio
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_FLOAT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_FLOAT,
&ins->declaration.tgsm_structured.reg);
ins->declaration.tgsm_structured.byte_stride = *tokens++;
ins->declaration.tgsm_structured.structure_count = *tokens;
@@ -854,7 +854,7 @@ static void shader_sm5_read_dcl_resource_structured(struct wined3d_shader_instru
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT,
&ins->declaration.structured_resource.reg);
ins->declaration.structured_resource.byte_stride = *tokens;
if (ins->declaration.structured_resource.byte_stride % 4)
@@ -865,7 +865,7 @@ static void shader_sm5_read_dcl_resource_raw(struct wined3d_shader_instruction *
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_TYPE_UINT, &ins->declaration.dst);
}
static void shader_sm5_read_sync(struct wined3d_shader_instruction *ins,
@@ -1196,23 +1196,23 @@ static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_sha
}
}
-static enum wined3d_data_type map_data_type(char t)
+static enum wined3d_component_type map_data_type(char t)
{
switch (t)
{
case 'f':
- return WINED3D_DATA_FLOAT;
+ return WINED3D_TYPE_FLOAT;
case 'i':
- return WINED3D_DATA_INT;
+ return WINED3D_TYPE_INT;
case 'u':
case 'O':
case 'R':
case 'S':
case 'U':
- return WINED3D_DATA_UINT;
+ return WINED3D_TYPE_UINT;
default:
ERR("Invalid data type '%c'.\n", t);
- return WINED3D_DATA_FLOAT;
+ return WINED3D_TYPE_FLOAT;
}
}
@@ -1376,7 +1376,7 @@ static BOOL shader_sm4_read_reg_idx(struct wined3d_sm4_data *priv, const DWORD *
reg_idx->offset = *(*ptr)++;
else
reg_idx->offset = 0;
- shader_sm4_read_src_param(priv, ptr, end, WINED3D_DATA_INT, rel_addr);
+ shader_sm4_read_src_param(priv, ptr, end, WINED3D_TYPE_INT, rel_addr);
}
else
{
@@ -1388,7 +1388,7 @@ static BOOL shader_sm4_read_reg_idx(struct wined3d_sm4_data *priv, const DWORD *
}
static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_register *param,
+ enum wined3d_component_type data_type, struct wined3d_shader_register *param,
enum wined3d_shader_src_modifier *modifier)
{
enum wined3d_sm4_register_type register_type;
@@ -1520,7 +1520,7 @@ static BOOL shader_sm4_read_param(struct wined3d_sm4_data *priv, const DWORD **p
}
static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_src_param *src_param)
+ enum wined3d_component_type data_type, struct wined3d_shader_src_param *src_param)
{
DWORD token;
@@ -1571,7 +1571,7 @@ static BOOL shader_sm4_read_src_param(struct wined3d_sm4_data *priv, const DWORD
}
static BOOL shader_sm4_read_dst_param(struct wined3d_sm4_data *priv, const DWORD **ptr, const DWORD *end,
- enum wined3d_data_type data_type, struct wined3d_shader_dst_param *dst_param)
+ enum wined3d_component_type data_type, struct wined3d_shader_dst_param *dst_param)
{
enum wined3d_shader_src_modifier modifier;
DWORD token;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 3d637005353..9c72ffdbe85 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -499,13 +499,6 @@ enum wined3d_shader_register_type
WINED3DSPR_RASTERIZER,
};
-enum wined3d_data_type
-{
- WINED3D_DATA_FLOAT,
- WINED3D_DATA_INT,
- WINED3D_DATA_UINT,
-};
-
enum wined3d_immconst_type
{
WINED3D_IMMCONST_SCALAR,
@@ -930,7 +923,7 @@ struct wined3d_shader_version
struct wined3d_shader_resource_info
{
enum wined3d_shader_resource_type type;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
unsigned int flags;
unsigned int stride;
};
@@ -1068,7 +1061,7 @@ struct wined3d_shader_register_index
struct wined3d_shader_register
{
enum wined3d_shader_register_type type;
- enum wined3d_data_type data_type;
+ enum wined3d_component_type data_type;
struct wined3d_shader_register_index idx[2];
enum wined3d_immconst_type immconst_type;
union
@@ -1104,7 +1097,7 @@ struct wined3d_shader_semantic
enum wined3d_decl_usage usage;
UINT usage_idx;
enum wined3d_shader_resource_type resource_type;
- enum wined3d_data_type resource_data_type;
+ enum wined3d_component_type resource_data_type;
struct wined3d_shader_dst_param reg;
};
--
2.16.1
June 12, 2018
[PATCH 2/5] wined3d: Get rid of unnecessary enum wined3d_data_type values.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
This is what eventually came out of trying to rework
https://source.winehq.org/patches/data/147005 to use
shader_glsl_sprintf_cast(). Tests seem to still pass.
Aside from that, I don't know if there is any plan to use the values
I'm dropping in this patch in the future. If so, just shoot this
patch (and the next) down.
dlls/wined3d/glsl_shader.c | 12 -----------
dlls/wined3d/shader.c | 12 -----------
dlls/wined3d/shader_sm4.c | 48 ++++++++++++++++++------------------------
dlls/wined3d/wined3d_private.h | 6 ------
4 files changed, 21 insertions(+), 57 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 86259ae4755..ffe0c2d7e14 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -2523,8 +2523,6 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
switch (reg_maps->resource_info[entry->resource_idx].data_type)
{
case WINED3D_DATA_FLOAT:
- case WINED3D_DATA_UNORM:
- case WINED3D_DATA_SNORM:
sampler_type_prefix = "";
break;
@@ -2641,8 +2639,6 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
switch (reg_maps->uav_resource_info[i].data_type)
{
case WINED3D_DATA_FLOAT:
- case WINED3D_DATA_UNORM:
- case WINED3D_DATA_SNORM:
image_type_prefix = "";
read_format = "r32f";
break;
@@ -3093,8 +3089,6 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
case WINED3D_DATA_INT:
sprintf(register_name, "%#x", reg->u.immconst_data[0]);
break;
- case WINED3D_DATA_RESOURCE:
- case WINED3D_DATA_SAMPLER:
case WINED3D_DATA_UINT:
sprintf(register_name, "%#xu", reg->u.immconst_data[0]);
break;
@@ -3129,8 +3123,6 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
break;
- case WINED3D_DATA_RESOURCE:
- case WINED3D_DATA_SAMPLER:
case WINED3D_DATA_UINT:
sprintf(register_name, "uvec4(%#xu, %#xu, %#xu, %#xu)",
reg->u.immconst_data[0], reg->u.immconst_data[1],
@@ -3342,8 +3334,6 @@ static void shader_glsl_sprintf_cast(struct wined3d_string_buffer *dst_param, co
case WINED3D_DATA_INT:
string_buffer_sprintf(dst_param, "floatBitsToInt(%s)", src_param);
return;
- case WINED3D_DATA_RESOURCE:
- case WINED3D_DATA_SAMPLER:
case WINED3D_DATA_UINT:
string_buffer_sprintf(dst_param, "floatBitsToUint(%s)", src_param);
return;
@@ -3457,8 +3447,6 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_string_buffer *buffer,
shader_addline(buffer, "%s%s = %sintBitsToFloat(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
break;
- case WINED3D_DATA_RESOURCE:
- case WINED3D_DATA_SAMPLER:
case WINED3D_DATA_UINT:
shader_addline(buffer, "%s%s = %suintBitsToFloat(",
glsl_dst.reg_name, glsl_dst.mask_str, shift_glsl_tab[dst->shift]);
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 20d4f0773dd..a2c3f00559a 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2134,14 +2134,6 @@ static void shader_dump_decl_usage(struct wined3d_string_buffer *buffer,
shader_addline(buffer, " (uint)");
break;
- case WINED3D_DATA_UNORM:
- shader_addline(buffer, " (unorm)");
- break;
-
- case WINED3D_DATA_SNORM:
- shader_addline(buffer, " (snorm)");
- break;
-
default:
shader_addline(buffer, " (unknown)");
break;
@@ -2448,8 +2440,6 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
case WINED3D_DATA_INT:
shader_addline(buffer, "%d", reg->u.immconst_data[0]);
break;
- case WINED3D_DATA_RESOURCE:
- case WINED3D_DATA_SAMPLER:
case WINED3D_DATA_UINT:
shader_addline(buffer, "%u", reg->u.immconst_data[0]);
break;
@@ -2472,8 +2462,6 @@ static void shader_dump_register(struct wined3d_string_buffer *buffer,
reg->u.immconst_data[0], reg->u.immconst_data[1],
reg->u.immconst_data[2], reg->u.immconst_data[3]);
break;
- case WINED3D_DATA_RESOURCE:
- case WINED3D_DATA_SAMPLER:
case WINED3D_DATA_UINT:
shader_addline(buffer, "%u, %u, %u, %u",
reg->u.immconst_data[0], reg->u.immconst_data[1],
diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c
index b119e8feaa8..69947d21c14 100644
--- a/dlls/wined3d/shader_sm4.c
+++ b/dlls/wined3d/shader_sm4.c
@@ -509,8 +509,8 @@ static const enum wined3d_shader_resource_type resource_type_table[] =
static const enum wined3d_data_type data_type_table[] =
{
/* 0 */ WINED3D_DATA_FLOAT,
- /* WINED3D_SM4_DATA_UNORM */ WINED3D_DATA_UNORM,
- /* WINED3D_SM4_DATA_SNORM */ WINED3D_DATA_SNORM,
+ /* WINED3D_SM4_DATA_UNORM */ WINED3D_DATA_FLOAT,
+ /* WINED3D_SM4_DATA_SNORM */ WINED3D_DATA_FLOAT,
/* WINED3D_SM4_DATA_INT */ WINED3D_DATA_INT,
/* WINED3D_SM4_DATA_UINT */ WINED3D_DATA_UINT,
/* WINED3D_SM4_DATA_FLOAT */ WINED3D_DATA_FLOAT,
@@ -565,8 +565,8 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
{
enum wined3d_sm4_resource_type resource_type;
enum wined3d_sm4_data_type data_type;
- enum wined3d_data_type reg_data_type;
DWORD components;
+ BOOL uav;
resource_type = (opcode_token & WINED3D_SM4_RESOURCE_TYPE_MASK) >> WINED3D_SM4_RESOURCE_TYPE_SHIFT;
if (!resource_type || (resource_type >= ARRAY_SIZE(resource_type_table)))
@@ -578,8 +578,8 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
{
ins->declaration.semantic.resource_type = resource_type_table[resource_type];
}
- reg_data_type = opcode == WINED3D_SM4_OP_DCL_RESOURCE ? WINED3D_DATA_RESOURCE : WINED3D_DATA_UAV;
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], reg_data_type, &ins->declaration.semantic.reg);
+ uav = opcode != WINED3D_SM4_OP_DCL_RESOURCE;
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.semantic.reg);
components = *tokens++;
if ((components & 0xfff0) != (components & 0xf) * 0x1110)
@@ -596,7 +596,7 @@ static void shader_sm4_read_dcl_resource(struct wined3d_shader_instruction *ins,
ins->declaration.semantic.resource_data_type = data_type_table[data_type];
}
- if (reg_data_type == WINED3D_DATA_UAV)
+ if (uav)
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
}
@@ -616,14 +616,14 @@ static void shader_sm4_read_dcl_sampler(struct wined3d_shader_instruction *ins,
ins->flags = (opcode_token & WINED3D_SM4_SAMPLER_MODE_MASK) >> WINED3D_SM4_SAMPLER_MODE_SHIFT;
if (ins->flags & ~WINED3D_SM4_SAMPLER_COMPARISON)
FIXME("Unhandled sampler mode %#x.\n", ins->flags);
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_SAMPLER, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
}
static void shader_sm4_read_dcl_index_range(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_OPAQUE,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
&ins->declaration.index_range.first_register);
ins->declaration.index_range.last_register = *tokens;
}
@@ -731,7 +731,7 @@ static void shader_sm5_read_fcall(struct wined3d_shader_instruction *ins,
struct wined3d_sm4_data *priv)
{
priv->src_param[0].reg.u.fp_body_idx = *tokens++;
- shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_OPAQUE, &priv->src_param[0]);
+ shader_sm4_read_src_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &priv->src_param[0]);
}
static void shader_sm5_read_dcl_function_body(struct wined3d_shader_instruction *ins,
@@ -812,7 +812,7 @@ static void shader_sm5_read_dcl_uav_raw(struct wined3d_shader_instruction *ins,
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UAV, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
}
@@ -820,7 +820,7 @@ static void shader_sm5_read_dcl_uav_structured(struct wined3d_shader_instruction
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UAV,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
&ins->declaration.structured_resource.reg);
ins->flags = (opcode_token & WINED3D_SM5_UAV_FLAGS_MASK) >> WINED3D_SM5_UAV_FLAGS_SHIFT;
ins->declaration.structured_resource.byte_stride = *tokens;
@@ -854,7 +854,7 @@ static void shader_sm5_read_dcl_resource_structured(struct wined3d_shader_instru
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_RESOURCE,
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT,
&ins->declaration.structured_resource.reg);
ins->declaration.structured_resource.byte_stride = *tokens;
if (ins->declaration.structured_resource.byte_stride % 4)
@@ -865,7 +865,7 @@ static void shader_sm5_read_dcl_resource_raw(struct wined3d_shader_instruction *
DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count,
struct wined3d_sm4_data *priv)
{
- shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_RESOURCE, &ins->declaration.dst);
+ shader_sm4_read_dst_param(priv, &tokens, &tokens[token_count], WINED3D_DATA_UINT, &ins->declaration.dst);
}
static void shader_sm5_read_sync(struct wined3d_shader_instruction *ins,
@@ -875,15 +875,13 @@ static void shader_sm5_read_sync(struct wined3d_shader_instruction *ins,
ins->flags = (opcode_token & WINED3D_SM5_SYNC_FLAGS_MASK) >> WINED3D_SM5_SYNC_FLAGS_SHIFT;
}
-/*
- * f -> WINED3D_DATA_FLOAT
- * i -> WINED3D_DATA_INT
- * u -> WINED3D_DATA_UINT
- * O -> WINED3D_DATA_OPAQUE
- * R -> WINED3D_DATA_RESOURCE
- * S -> WINED3D_DATA_SAMPLER
- * U -> WINED3D_DATA_UAV
- */
+/* f -> FLOAT
+ * i -> INT
+ * u -> UINT
+ * O -> OPAQUE
+ * R -> RESOURCE
+ * S -> SAMPLER
+ * U -> UAV */
static const struct wined3d_sm4_opcode_info opcode_table[] =
{
{WINED3D_SM4_OP_ADD, WINED3DSIH_ADD, "f", "ff"},
@@ -1207,15 +1205,11 @@ static enum wined3d_data_type map_data_type(char t)
case 'i':
return WINED3D_DATA_INT;
case 'u':
- return WINED3D_DATA_UINT;
case 'O':
- return WINED3D_DATA_OPAQUE;
case 'R':
- return WINED3D_DATA_RESOURCE;
case 'S':
- return WINED3D_DATA_SAMPLER;
case 'U':
- return WINED3D_DATA_UAV;
+ return WINED3D_DATA_UINT;
default:
ERR("Invalid data type '%c'.\n", t);
return WINED3D_DATA_FLOAT;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d190f7ccfd6..3d637005353 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -503,13 +503,7 @@ enum wined3d_data_type
{
WINED3D_DATA_FLOAT,
WINED3D_DATA_INT,
- WINED3D_DATA_RESOURCE,
- WINED3D_DATA_SAMPLER,
- WINED3D_DATA_UAV,
WINED3D_DATA_UINT,
- WINED3D_DATA_UNORM,
- WINED3D_DATA_SNORM,
- WINED3D_DATA_OPAQUE,
};
enum wined3d_immconst_type
--
2.16.1
June 12, 2018
[PATCH 1/5] wined3d: Generate shader epilogue before conditional returns.
by Matteo Bruni
Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
---
dlls/wined3d/glsl_shader.c | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index a99762b151f..86259ae4755 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -5131,20 +5131,20 @@ static void shader_glsl_default(const struct wined3d_shader_instruction *ins)
shader_addline(ins->ctx->buffer, "default:\n");
}
-static void shader_glsl_generate_conditional_op(const struct wined3d_shader_instruction *ins,
- const char *op)
+static void shader_glsl_generate_condition(const struct wined3d_shader_instruction *ins)
{
struct glsl_src_param src_param;
const char *condition;
condition = ins->flags == WINED3D_SHADER_CONDITIONAL_OP_NZ ? "bool" : "!bool";
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src_param);
- shader_addline(ins->ctx->buffer, "if (%s(%s)) %s\n", condition, src_param.param_str, op);
+ shader_addline(ins->ctx->buffer, "if (%s(%s))\n", condition, src_param.param_str);
}
static void shader_glsl_if(const struct wined3d_shader_instruction *ins)
{
- shader_glsl_generate_conditional_op(ins, "{");
+ shader_glsl_generate_condition(ins);
+ shader_addline(ins->ctx->buffer, "{\n");
}
static void shader_glsl_ifc(const struct wined3d_shader_instruction *ins)
@@ -5203,15 +5203,29 @@ static void shader_glsl_conditional_op(const struct wined3d_shader_instruction *
switch (ins->handler_idx)
{
- case WINED3DSIH_BREAKP: op = "break;"; break;
- case WINED3DSIH_CONTINUEP: op = "continue;"; break;
- case WINED3DSIH_RETP: op = "return;"; break;
+ case WINED3DSIH_BREAKP:
+ op = "break;";
+ break;
+ case WINED3DSIH_CONTINUEP:
+ op = "continue;";
+ break;
+ case WINED3DSIH_RETP:
+ op = "return;";
+ break;
default:
ERR("Unhandled opcode %#x.\n", ins->handler_idx);
return;
}
- shader_glsl_generate_conditional_op(ins, op);
+ shader_glsl_generate_condition(ins);
+ if (ins->handler_idx == WINED3DSIH_RETP)
+ {
+ shader_addline(ins->ctx->buffer, "{\n");
+ shader_glsl_generate_shader_epilogue(ins->ctx);
+ }
+ shader_addline(ins->ctx->buffer, " %s\n", op);
+ if (ins->handler_idx == WINED3DSIH_RETP)
+ shader_addline(ins->ctx->buffer, "}\n");
}
static void shader_glsl_continue(const struct wined3d_shader_instruction *ins)
@@ -6764,7 +6778,8 @@ static void shader_glsl_texkill(const struct wined3d_shader_instruction *ins)
{
if (ins->ctx->reg_maps->shader_version.major >= 4)
{
- shader_glsl_generate_conditional_op(ins, "discard;");
+ shader_glsl_generate_condition(ins);
+ shader_addline(ins->ctx->buffer, " discard;\n");
}
else
{
--
2.16.1
June 12, 2018
[PATCH 2/2] schedsvc: Retry opening a .job file only in case of sharing violation. (v2)
by Dmitry Timoshkov
And turn loud ERR() into a TRACE() like it is in other places.
v2: fix a copy/paste typo.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/schedsvc/atsvc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index f6ea0f0e23..b8adc7279d 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -558,7 +558,7 @@ static BOOL load_job(const WCHAR *name, struct job_t *info)
if (file == INVALID_HANDLE_VALUE)
{
TRACE("Failed to open %s, error %u\n", debugstr_w(name), GetLastError());
- if (try++ >= 3) break;
+ if (GetLastError() != ERROR_SHARING_VIOLATION || try++ >= 3) break;
Sleep(100);
continue;
}
@@ -872,9 +872,9 @@ static void update_job_status(struct job_t *job)
hfile = CreateFileW(job->name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (hfile != INVALID_HANDLE_VALUE) break;
- if (try++ >= 3)
+ if (GetLastError() != ERROR_SHARING_VIOLATION || try++ >= 3)
{
- ERR("Failed to update %s, error %u\n", debugstr_w(job->name), GetLastError());
+ TRACE("Failed to update %s, error %u\n", debugstr_w(job->name), GetLastError());
return;
}
Sleep(100);
--
2.16.3
June 12, 2018
[PATCH 1/2] mstask: Retry opening a .job file only in case of sharing violation.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 7499826937..69f1e5f95c 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -1444,7 +1444,7 @@ static HRESULT WINAPI MSTASK_IPersistFile_Load(IPersistFile *iface, LPCOLESTR fi
file = CreateFileW(file_name, access, sharing, NULL, OPEN_EXISTING, 0, 0);
if (file != INVALID_HANDLE_VALUE) break;
- if (try++ >= 3)
+ if (GetLastError() != ERROR_SHARING_VIOLATION || try++ >= 3)
{
TRACE("Failed to open %s, error %u\n", debugstr_w(file_name), GetLastError());
return HRESULT_FROM_WIN32(GetLastError());
--
2.16.3
June 12, 2018
[PATCH 2/2] schedsvc: Retry opening a .job file only in case of sharing violation.
by Dmitry Timoshkov
And turn loud ERR() into a TRACE() like it is in other places.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/schedsvc/atsvc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index f6ea0f0e23..91a6af2e2f 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -558,7 +558,7 @@ static BOOL load_job(const WCHAR *name, struct job_t *info)
if (file == INVALID_HANDLE_VALUE)
{
TRACE("Failed to open %s, error %u\n", debugstr_w(name), GetLastError());
- if (try++ >= 3) break;
+ if (GetLastError() != ERROR_SHARING_VIOLATION || try++ >= 3)
Sleep(100);
continue;
}
@@ -872,9 +872,9 @@ static void update_job_status(struct job_t *job)
hfile = CreateFileW(job->name, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (hfile != INVALID_HANDLE_VALUE) break;
- if (try++ >= 3)
+ if (GetLastError() != ERROR_SHARING_VIOLATION || try++ >= 3)
{
- ERR("Failed to update %s, error %u\n", debugstr_w(job->name), GetLastError());
+ TRACE("Failed to update %s, error %u\n", debugstr_w(job->name), GetLastError());
return;
}
Sleep(100);
--
2.16.3
June 12, 2018
[PATCH 1/2] mstask: Retry opening a .job file only in case of sharing violation.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 7499826937..69f1e5f95c 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -1444,7 +1444,7 @@ static HRESULT WINAPI MSTASK_IPersistFile_Load(IPersistFile *iface, LPCOLESTR fi
file = CreateFileW(file_name, access, sharing, NULL, OPEN_EXISTING, 0, 0);
if (file != INVALID_HANDLE_VALUE) break;
- if (try++ >= 3)
+ if (GetLastError() != ERROR_SHARING_VIOLATION || try++ >= 3)
{
TRACE("Failed to open %s, error %u\n", debugstr_w(file_name), GetLastError());
return HRESULT_FROM_WIN32(GetLastError());
--
2.16.3
June 12, 2018
[PATCH] msvcr100: Fix lldiv implementation
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/msvcrt/math.c | 9 ++++-----
dlls/ucrtbase/tests/misc.c | 4 ++--
2 files changed, 6 insertions(+), 7 deletions(-)
June 12, 2018
Re: [PATCH v2 2/2] msvcrt: Don't reimplement call_unwind_func().
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 12, 2018
Re: [PATCH v2 1/2] msvcrt: Avoid using inline assembly in call_unwind_func().
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 12, 2018
Re: [PATCH 3/3] msvcrt: Implement quick_exit and _crt_at_quick_exit
by Piotr Caban
On 06/12/18 09:43, Fabian Maurer wrote:
> > Why don't you just call onexit functions instead of reimplementing it?
>
> > Note that you don't need to call MSVCRT__initialize_onexit_table when
>
> > quick_exit table is declared static.
>
> What do you mean? AFAIK the onquickexit functions are different
> functions than the one registered onexit, no? So I need to have a second
> function that uses a different table. Or put the shared functionality
> into a shared function.
atexit and at_quick_exit needs to manage similar table of functions.
Because of that there's a set of helper functions that can be used to
accomplish it (*_onexit_table functions). It's even documented that it's
used internally: https://msdn.microsoft.com/en-us/library/mt670601.aspx
Thanks,
Piotr
June 12, 2018
Re: [PATCH 2/3] msvcrt: Add quick_exit
by Piotr Caban
On 06/12/18 09:40, Fabian Maurer wrote:
> > quick_exit function should not call exit. I'm attaching a test that
>
> > shows that atexit callbacks should not be called.
>
> I know, and MSVCRT__exit only calls ExitProcess, not calling any callbacks.
I've misread the patch, sorry for that (MSVCRT_exit / MSVCRT__exit).
Thanks,
Piotr
June 12, 2018
[PATCH] mshtml: Support input event.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/mshtml/htmldoc.c | 12 ++++++++----
dlls/mshtml/htmlelem.c | 12 ++++++++----
dlls/mshtml/htmlevent.c | 5 ++++-
dlls/mshtml/htmlevent.h | 1 +
dlls/mshtml/htmlwindow.c | 2 +-
5 files changed, 22 insertions(+), 10 deletions(-)
June 12, 2018
Re: [PATCH] msxml3: Accept NormalizeAttributeValues property
by Nikolay Sivov
If it's set to 'false' it's fine, because it's a default.If application
enables normalization, we'll be returning wrong document content. This
will need at least a test, for normalization functionality and default
property value.
June 12, 2018
Re: [PATCH 7/8] comctl32/taskdialog: Create buttons without templates.
by Nikolay Sivov
This one gives compiler warning:
gcc -m32 -c -o taskdialog.o
../../../../wine-git/dlls/comctl32/taskdialog.c -I. \
-I../../../../wine-git/dlls/comctl32 -I../../include
-I../../../../wine-git/include -D__WINESRC__ \
-D_COMCTL32_ -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement \
-Wempty-body -Wignored-qualifiers -Wshift-overflow=2
-Wstrict-prototypes -Wtype-limits \
-Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith
-Wlogical-op -gdwarf-2 \
-gstrict-dwarf -fno-omit-frame-pointer -g -O2
../../../../wine-git/dlls/comctl32/taskdialog.c:111:21: warning:
‘taskdialog_add_control’ defined but not used [-Wunused-function]
static unsigned int taskdialog_add_control(struct
taskdialog_template_desc *desc, WORD id, const WCHAR *class,
It should be merged with 8/8. Please resend as a standalone patch after
first 6 patches are accepted.
June 12, 2018
[PATCH] jscript: Use global accumulator for storing function call results.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/jscript/compile.c | 4 ++--
dlls/jscript/engine.c | 31 ++++++++++++++-----------------
dlls/jscript/engine.h | 2 +-
dlls/jscript/jscript.c | 2 ++
dlls/jscript/jscript.h | 1 +
dlls/jscript/tests/lang.js | 21 +++++++++++++++++++++
6 files changed, 41 insertions(+), 20 deletions(-)
June 12, 2018
Re: [PATCH 6/8] comctl32/taskdialog: Create content without templates.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 12, 2018
Re: [PATCH 5/8] comctl32/taskdialog: Create main instruction without templates.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 12, 2018
Re: [PATCH 4/8] comctl32/taskdialog: Support dynamic layout.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 12, 2018
Re: [PATCH 3/8] comctl32/taskdialog: Add taskdialog_destroy().
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 12, 2018
Re: [PATCH 2/8] comctl32/taskdialog: Remove unused parameter.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 12, 2018
Re: [PATCH 1/8] comctl32/taskdialog: Zero out taskdialog_info at initialization.
by Nikolay Sivov
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com>
June 12, 2018
[PATCH 2/2] testbot/build: Fix the CountCPUs() indentation.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/build/Build.pl | 18 +++++++++---------
testbot/bin/build/Reconfig.pl | 14 +++++++-------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index a7ecb1f1c..f516cf184 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -109,8 +109,8 @@ sub ApplyPatch($)
") >>$LogDir/Build.log 2>&1");
if ($? != 0)
{
- LogMsg "Autoconf failed\n";
- return undef;
+ LogMsg "Autoconf failed\n";
+ return undef;
}
}
@@ -120,13 +120,13 @@ sub ApplyPatch($)
my $ncpus;
sub CountCPUs()
{
- if (open(my $fh, "<", "/proc/cpuinfo"))
- {
- # Linux
- map { $ncpus++ if (/^processor/); } <$fh>;
- close($fh);
- }
- $ncpus ||= 1;
+ if (open(my $fh, "<", "/proc/cpuinfo"))
+ {
+ # Linux
+ map { $ncpus++ if (/^processor/); } <$fh>;
+ close($fh);
+ }
+ $ncpus ||= 1;
}
sub BuildNative()
diff --git a/testbot/bin/build/Reconfig.pl b/testbot/bin/build/Reconfig.pl
index f84c80458..977df6e12 100755
--- a/testbot/bin/build/Reconfig.pl
+++ b/testbot/bin/build/Reconfig.pl
@@ -102,13 +102,13 @@ sub GitPull()
my $ncpus;
sub CountCPUs()
{
- if (open(my $fh, "<", "/proc/cpuinfo"))
- {
- # Linux
- map { $ncpus++ if (/^processor/); } <$fh>;
- close($fh);
- }
- $ncpus ||= 1;
+ if (open(my $fh, "<", "/proc/cpuinfo"))
+ {
+ # Linux
+ map { $ncpus++ if (/^processor/); } <$fh>;
+ close($fh);
+ }
+ $ncpus ||= 1;
}
sub BuildTestAgentd()
--
2.17.1
June 12, 2018
[PATCH 1/2] testbot/build: Always rebuild all the impacted test executables.
by Francois Gouget
This means Build.pl no longer needs the PatchType and BaseName
parameters. But still keep support for them for compatibility with
WineRunBuild.pl.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
Later on this will make it possible to reduce the number of build tasks
(and associated reverts), and to have only one job per patch.
testbot/bin/build/Build.pl | 104 +++++++++++++++++--------------------
1 file changed, 48 insertions(+), 56 deletions(-)
diff --git a/testbot/bin/build/Build.pl b/testbot/bin/build/Build.pl
index 77bc9ca9d..a7ecb1f1c 100755
--- a/testbot/bin/build/Build.pl
+++ b/testbot/bin/build/Build.pl
@@ -6,6 +6,7 @@
# resulting 32 and 64 bit binaries.
#
# Copyright 2009 Ge van Geldorp
+# Copyright 2012-2014, 2017-2018 Francois Gouget
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -83,7 +84,7 @@ sub ApplyPatch($)
if ($? != 0)
{
LogMsg "Patch failed to apply\n";
- return 0;
+ return undef;
}
my $Impacts = GetPatchImpact($PatchFile, "nounits");
@@ -96,7 +97,7 @@ sub ApplyPatch($)
if ($? != 0)
{
LogMsg "make_makefiles failed\n";
- return 0;
+ return undef;
}
}
@@ -109,11 +110,11 @@ sub ApplyPatch($)
if ($? != 0)
{
LogMsg "Autoconf failed\n";
- return 0;
+ return undef;
}
}
- return 1;
+ return $Impacts;
}
my $ncpus;
@@ -136,57 +137,71 @@ sub BuildNative()
system("( cd $DataDir/build-native && set -x && " .
" time make -j$ncpus __tooldeps__ " .
") >>$LogDir/Build.log 2>&1");
-
if ($? != 0)
{
- LogMsg "Build native failed\n";
+ LogMsg "Rebuild of native tools failed\n";
return !1;
}
return 1;
}
-sub BuildTestExecutable($$$)
+sub BuildTestExecutables($$)
{
- my ($BaseName, $PatchType, $Bits) = @_;
+ my ($Impacts, $Bits) = @_;
- my $TestsDir = "$PatchType/$BaseName/tests";
- my $TestExecutable = "$TestsDir/$BaseName";
- if ($PatchType eq "programs")
+ my (@BuildDirs, @TestExes);
+ foreach my $TestInfo (values %{$Impacts->{Tests}})
{
- $TestExecutable .= ".exe";
+ push @BuildDirs, $TestInfo->{Path};
+ my $TestExe = "$TestInfo->{Path}/$TestInfo->{ExeBase}.exe";
+ push @TestExes, $TestExe;
+ unlink("$DataDir/build-mingw$Bits/$TestExe"); # Ignore errors
}
- $TestExecutable .= "_test.exe";
- unlink("$DataDir/build-mingw${Bits}/$TestExecutable");
- InfoMsg "\nBuilding the $Bits-bit test executable\n";
+ InfoMsg "\nBuilding the $Bits-bit test executable(s)\n";
system("( cd $DataDir/build-mingw$Bits && set -x && " .
- " time make -j$ncpus $TestsDir " .
+ " time make -j$ncpus ". join(" ", sort @BuildDirs) .
") >>$LogDir/Build.log 2>&1");
if ($? != 0)
{
LogMsg "Rebuild of $Bits-bit crossbuild failed\n";
return !1;
}
- if (! -f "$DataDir/build-mingw${Bits}/$TestExecutable")
+
+ my $Success = 1;
+ foreach my $TestExe (@TestExes)
{
- LogMsg "Make didn't produce a $TestExecutable file\n";
- return !1;
+ if (!-f "$DataDir/build-mingw$Bits/$TestExe")
+ {
+ LogMsg "Make didn't produce a $TestExe file\n";
+ $Success = undef;
+ }
}
- return 1;
+ return $Success;
}
$ENV{PATH} = "/usr/lib/ccache:/usr/bin:/bin";
delete $ENV{ENV};
-# Start with clean logfile
+# Start with a clean logfile
unlink("$LogDir/Build.log");
-my ($PatchFile, $PatchType, $BaseName, $BitIndicators) = @ARGV;
-if (! $PatchFile || ! $PatchType || ! $BaseName || !$BitIndicators)
+my ($PatchFile, $BitIndicators);
+if (@ARGV == 2)
{
- FatalError "Usage: Build.pl <patchfile> <patchtype> <basename> <bits>\n";
+ ($PatchFile, $BitIndicators) = @ARGV;
+}
+else
+{
+ # FIXME Remove support for the legacy parameters
+ my ($_PatchType, $_BaseName);
+ ($PatchFile, $_PatchType, $_BaseName, $BitIndicators) = @ARGV;
+}
+if (! $PatchFile || !$BitIndicators)
+{
+ FatalError "Usage: Build.pl <patchfile> <bits>\n";
}
# Untaint parameters
@@ -203,36 +218,16 @@ else
FatalError "Invalid patch file $PatchFile\n";
}
-if ($PatchType =~ m/^patch(dlls|programs)$/)
-{
- $PatchType = $1;
-}
-else
-{
- FatalError "Invalid patch type $PatchType\n";
-}
-
-if ($BaseName =~ m/^([\w_.\-]+)$/)
-{
- $BaseName = $1;
-}
-else
-{
- FatalError "Invalid DLL base name $BaseName\n";
-}
-
-my $Run32 = !1;
-my $Run64 = !1;
+my ($Run32, $Run64);
if ($BitIndicators =~ m/^([\d,]+)$/)
{
- my @Bits = split /,/, $1;
- foreach my $BitsValue (@Bits)
+ foreach my $BitsValue (split /,/, $1)
{
- if ($BitsValue == 32)
+ if ($BitsValue eq "32")
{
$Run32 = 1;
}
- elsif ($BitsValue == 64)
+ elsif ($BitsValue eq "64")
{
$Run64 = 1;
}
@@ -241,7 +236,7 @@ if ($BitIndicators =~ m/^([\d,]+)$/)
FatalError "Invalid number of bits $BitsValue\n";
}
}
- if (! $Run32 && ! $Run64)
+ if (!$Run32 && !$Run64)
{
FatalError "Specify at least one of 32 or 64 bits\n";
}
@@ -251,10 +246,8 @@ else
FatalError "Invalid number of bits $BitIndicators\n";
}
-if (!ApplyPatch($PatchFile))
-{
- exit(1);
-}
+my $Impacts = ApplyPatch($PatchFile);
+exit(1) if (!$Impacts);
CountCPUs();
@@ -262,12 +255,11 @@ if (!BuildNative())
{
exit(1);
}
-
-if ($Run32 && ! BuildTestExecutable($BaseName, $PatchType, 32))
+if ($Run32 && !BuildTestExecutables($Impacts, 32))
{
exit(1);
}
-if ($Run64 && ! BuildTestExecutable($BaseName, $PatchType, 64))
+if ($Run64 && !BuildTestExecutables($Impacts, 64))
{
exit(1);
}
--
2.17.1
June 12, 2018
[PATCH] testbot: Make sure UpdateStatus() iterates over all the Steps and Tasks.
by Francois Gouget
It tends to be called from places where filters have been put on the
Steps and/or Tasks collections which prevents it from getting the full
picture. So work on a clone that has no filter.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/Jobs.pm | 2 +-
testbot/lib/WineTestBot/Steps.pm | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index b3512e1f2..a13b3468e 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -209,7 +209,7 @@ sub UpdateStatus($)
return $Status if ($Status ne "queued" && $Status ne "running");
my %Has;
- my $Steps = $self->Steps;
+ my $Steps = $self->Steps->Clone();
my @SortedSteps = sort { $a->No <=> $b->No } @{$Steps->GetItems()};
foreach my $Step (@SortedSteps)
{
diff --git a/testbot/lib/WineTestBot/Steps.pm b/testbot/lib/WineTestBot/Steps.pm
index aea1aee04..8afe79396 100644
--- a/testbot/lib/WineTestBot/Steps.pm
+++ b/testbot/lib/WineTestBot/Steps.pm
@@ -199,7 +199,7 @@ sub UpdateStatus($$)
return $Status if ($Status ne "queued" && $Status ne "running");
my %Has;
- map { $Has{$_->UpdateStatus($Skip)} = 1 } (@{$self->Tasks->GetItems()});
+ map { $Has{$_->UpdateStatus($Skip)} = 1 } (@{$self->Tasks->Clone()->GetItems()});
# Inherit the tasks most significant status.
# Note that one or more tasks may have been requeued during the cleanup phase
--
2.17.1
June 12, 2018
[PATCH] testbot: Ignore process deadlines for the disabled VMs.
by Francois Gouget
Disabled VMs should probably not have deadlines but it makes sense to
ignore them anyway.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/Engine/Scheduler.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/Engine/Scheduler.pm b/testbot/lib/WineTestBot/Engine/Scheduler.pm
index 85bc0f397..159b10cf8 100644
--- a/testbot/lib/WineTestBot/Engine/Scheduler.pm
+++ b/testbot/lib/WineTestBot/Engine/Scheduler.pm
@@ -1010,7 +1010,9 @@ sub ScheduleJobs()
# Reschedule at the latest when the next task times out
my $FirstDeadline;
- foreach my $VM (@{$Sched->{VMs}->GetItems()})
+ my $VMs = $Sched->{VMs}->Clone();
+ $VMs->FilterEnabledRole();
+ foreach my $VM (@{$VMs->GetItems()})
{
if (defined $VM->ChildDeadline and
(!defined $FirstDeadline or $VM->ChildDeadline < $FirstDeadline))
--
2.17.1
June 12, 2018
[PATCH] testbot: Update Job::Restart() for the new Job file storage.
by Francois Gouget
With the new file storage scheme the Step directories only contain
generated files and thus they can all be deleted.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
Restarting an old job that still uses the old scheme will delete the
input file, thus breaking that job. However the restart button is
currently only available on three jobs, two where only the administrator
can trigger it (39025 and 39003), and one job which is already broken
(39001, I attribute this one to a temporary insanity episode of the
TestBot, it's a multiple modules test patch).
testbot/lib/WineTestBot/Jobs.pm | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index 3fd78aaa2..b3512e1f2 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -352,7 +352,6 @@ sub Restart($)
return "This job is already " . $self->Status;
}
- my $FirstStep = 1;
my $Steps = $self->Steps;
my @SortedSteps = sort { $a->No <=> $b->No } @{$Steps->GetItems()};
foreach my $Step (@SortedSteps)
@@ -360,21 +359,13 @@ sub Restart($)
my $Tasks = $Step->Tasks;
foreach my $Task (@{$Tasks->GetItems()})
{
- if ($FirstStep)
- {
- # The first step contains the patch or test executable
- # so only delete its task folders
- $Task->RmTree();
- }
$Task->Status("queued");
$Task->Started(undef);
$Task->Ended(undef);
$Task->TestFailures(undef);
}
- # Subsequent steps only contain files generated by the previous steps
- $Step->RmTree() if (!$FirstStep);
- $FirstStep = undef;
$Step->Status("queued");
+ $Step->RmTree();
}
$self->Status("queued");
$self->Submitted(time);
--
2.17.1
June 12, 2018
[PATCH] testbot: A minor indentation fix in PatchUtils.pm.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/WineTestBot/PatchUtils.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index 02c89e285..833394abe 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -211,8 +211,8 @@ sub GetPatchImpact($;$$)
last;
}
if (exists $TestInfo->{Files}->{"$Base.spec"} and
- ($TestInfo->{Files}->{"$Base.c"} or
- $TestInfo->{Files}->{"$Base.spec"}))
+ ($TestInfo->{Files}->{"$Base.c"} or
+ $TestInfo->{Files}->{"$Base.spec"}))
{
# Any change to a helper dll can potentially impact all tests
$AllUnits = 1;
--
2.17.1
June 12, 2018
[PATCH] testbot: Make sure AddReconfigJob() returns true when successful.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/bin/CheckForWinetestUpdate.pl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testbot/bin/CheckForWinetestUpdate.pl b/testbot/bin/CheckForWinetestUpdate.pl
index 137db572c..80c57b9e1 100755
--- a/testbot/bin/CheckForWinetestUpdate.pl
+++ b/testbot/bin/CheckForWinetestUpdate.pl
@@ -291,6 +291,8 @@ sub AddReconfigJob()
Error "Failed to save the Reconfig job (staging): $ErrMessage\n";
return 0;
}
+
+ return 1;
}
--
2.17.1
June 12, 2018
Re: [PATCH 04/17] vcomp/tests: Use the available ARRAY_SIZE() macro
by André Hentschel
Am 30.05.2018 um 21:15 schrieb Michael Stefaniuc:
> Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
> ---
> dlls/vcomp/tests/vcomp.c | 56 ++++++++++++++++++++++++------------------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
I accidentally wrote the exact same patch, so here is my signoff, not sure if we should wait for that from Sebastian?
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
June 12, 2018
Re: [PATCH] winhttp/tests: Use the available ARRAY_SIZE() macro
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
June 12, 2018
Re: [PATCH 1/7] wsdapi: Add support for listening for UDP multicast broadcasts.
by Huw Davies
On Mon, Jun 11, 2018 at 11:06:14PM +0100, Owen Rudge wrote:
> v2: Returns HRESULT from functions where applicable, adds Probe message body
> parsing to avoid leaving todo_wine statements in place.
>
> Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
>
> ---
> dlls/wsdapi/network.c | 281
> +++++++++++++++++++++++++++++++++++++++++-
> dlls/wsdapi/wsdapi_internal.h | 4 +
> 2 files changed, 284 insertions(+), 1 deletion(-)
>
>
> void terminate_networking(IWSDiscoveryPublisherImpl *impl)
> {
> BOOL needsCleanup = impl->publisherStarted;
>
> impl->publisherStarted = FALSE;
> + WaitForMultipleObjects(impl->num_thread_handles, impl->thread_handles, TRUE, INFINITE);
The thread handles need closing.
>
> if (needsCleanup)
> WSACleanup();
> @@ -254,6 +524,15 @@ BOOL init_networking(IWSDiscoveryPublisherImpl *impl)
>
> impl->publisherStarted = TRUE;
>
> - /* TODO: Start listening */
> + if ((impl->addressFamily & WSDAPI_ADDRESSFAMILY_IPV4) && (!start_listening_on_all_addresses(impl, AF_INET)))
> + goto cleanup;
> +
> + if ((impl->addressFamily & WSDAPI_ADDRESSFAMILY_IPV6) && (!start_listening_on_all_addresses(impl, AF_INET6)))
> + goto cleanup;
> +
> return TRUE;
> +
> +cleanup:
> + terminate_networking(impl);
> + return FALSE;
> }
> diff --git a/dlls/wsdapi/wsdapi_internal.h b/dlls/wsdapi/wsdapi_internal.h
> index 45d54c2ef1..f88822d5ef 100644
> --- a/dlls/wsdapi/wsdapi_internal.h
> +++ b/dlls/wsdapi/wsdapi_internal.h
> @@ -40,6 +40,8 @@ struct notificationSink
> IWSDiscoveryPublisherNotify *notificationSink;
> };
>
> +#define MAX_WSD_THREADS 20
> +
> typedef struct IWSDiscoveryPublisherImpl {
> IWSDiscoveryPublisher IWSDiscoveryPublisher_iface;
> LONG ref;
> @@ -47,6 +49,8 @@ typedef struct IWSDiscoveryPublisherImpl {
> DWORD addressFamily;
> struct list notificationSinks;
> BOOL publisherStarted;
> + HANDLE thread_handles[MAX_WSD_THREADS];
> + int num_thread_handles;
> } IWSDiscoveryPublisherImpl;
>
> /* network.c */
>
>
June 12, 2018
Re: [PATCH 3/3] msvcrt: Implement quick_exit and _crt_at_quick_exit
by Fabian Maurer
> Why don't you just call onexit functions instead of reimplementing it?
> Note that you don't need to call MSVCRT__initialize_onexit_table when
> quick_exit table is declared static.
What do you mean? AFAIK the onquickexit functions are different
functions than the one registered onexit, no? So I need to have a second
function that uses a different table. Or put the shared functionality into a
shared function.
Regards,
Fabian Maurer
June 12, 2018
Re: [PATCH 2/3] msvcrt: Add quick_exit
by Fabian Maurer
> quick_exit function should not call exit. I'm attaching a test that
> shows that atexit callbacks should not be called.
I know, and MSVCRT__exit only calls ExitProcess, not calling any
callbacks.
Regards,
Fabian Maurer
June 12, 2018
[PATCH 8/8] comctl32/taskdialog: Delete unused template related code.
by Zhiyi Zhang
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 101 +------------------------------------
1 file changed, 1 insertion(+), 100 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index fef269fc0b..7a09b8a6d2 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -34,16 +34,10 @@
#include "comctl32.h"
#include "wine/debug.h"
-#include "wine/list.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(taskdialog);
-#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align))
-#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align))
-#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align)
-#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align)
-
static const UINT DIALOG_MIN_WIDTH = 240;
static const UINT DIALOG_SPACING = 5;
static const UINT DIALOG_BUTTON_WIDTH = 50;
@@ -52,21 +46,6 @@ static const UINT DIALOG_TIMER_MS = 200;
static const UINT ID_TIMER = 1;
-struct taskdialog_control
-{
- struct list entry;
- DLGITEMTEMPLATE *template;
- unsigned int template_size;
-};
-
-struct taskdialog_template_desc
-{
- const TASKDIALOGCONFIG *taskconfig;
- struct list controls;
- WORD control_count;
- struct taskdialog_button_desc *default_button;
-};
-
struct taskdialog_info
{
HWND hwnd;
@@ -108,59 +87,6 @@ static void template_write_data(char **ptr, const void *src, unsigned int size)
*ptr += size;
}
-static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
- HINSTANCE hInstance, const WCHAR *text, DWORD style)
-{
- struct taskdialog_control *control = Alloc(sizeof(*control));
- unsigned int size, class_size, text_size;
- DLGITEMTEMPLATE *template;
- static const WCHAR nulW;
- const WCHAR *textW;
- char *ptr;
-
- class_size = (strlenW(class) + 1) * sizeof(WCHAR);
-
- if (IS_INTRESOURCE(text))
- text_size = LoadStringW(hInstance, (UINT_PTR)text, (WCHAR *)&textW, 0) * sizeof(WCHAR);
- else
- {
- textW = text;
- text_size = strlenW(textW) * sizeof(WCHAR);
- }
-
- size = sizeof(DLGITEMTEMPLATE);
- size += class_size;
- size += text_size + sizeof(WCHAR);
- size += sizeof(WORD); /* creation data */
-
- control->template = template = Alloc(size);
- control->template_size = size;
-
- template->style = WS_VISIBLE | style;
- template->dwExtendedStyle = 0;
- template->id = id;
- ptr = (char *)(template + 1);
- template_write_data(&ptr, class, class_size);
- template_write_data(&ptr, textW, text_size);
- template_write_data(&ptr, &nulW, sizeof(nulW));
-
- list_add_tail(&desc->controls, &control->entry);
- desc->control_count++;
- return ALIGNED_LENGTH(size, 3);
-}
-
-static void taskdialog_clear_controls(struct list *controls)
-{
- struct taskdialog_control *control, *control2;
-
- LIST_FOR_EACH_ENTRY_SAFE(control, control2, controls, struct taskdialog_control, entry)
- {
- list_remove(&control->entry);
- Free(control->template);
- Free(control);
- }
-}
-
static unsigned int taskdialog_get_reference_rect(const TASKDIALOGCONFIG *taskconfig, RECT *ret)
{
HMONITOR monitor = MonitorFromWindow(taskconfig->hwndParent ? taskconfig->hwndParent : GetActiveWindow(),
@@ -194,9 +120,7 @@ static WCHAR *taskdialog_get_exe_name(WCHAR *name, DWORD length)
static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
{
- struct taskdialog_control *control, *control2;
unsigned int size, title_size;
- struct taskdialog_template_desc desc;
static const WORD fontsize = 0x7fff;
static const WCHAR emptyW[] = { 0 };
const WCHAR *titleW = NULL;
@@ -222,23 +146,13 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
size += title_size;
size += 2; /* font size */
- list_init(&desc.controls);
- desc.taskconfig = taskconfig;
- desc.control_count = 0;
- desc.default_button = NULL;
-
template = Alloc(size);
- if (!template)
- {
- taskdialog_clear_controls(&desc.controls);
- return NULL;
- }
+ if (!template) return NULL;
template->style = DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_SYSMENU;
if (taskconfig->dwFlags & TDF_CAN_BE_MINIMIZED) template->style |= WS_MINIMIZEBOX;
if (!(taskconfig->dwFlags & TDF_NO_SET_FOREGROUND)) template->style |= DS_SETFOREGROUND;
if (taskconfig->dwFlags & TDF_RTL_LAYOUT) template->dwExtendedStyle = WS_EX_LAYOUTRTL | WS_EX_RIGHT | WS_EX_RTLREADING;
- template->cdit = desc.control_count;
ptr = (char *)(template + 1);
ptr += 2; /* menu */
@@ -246,19 +160,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
template_write_data(&ptr, titleW, title_size);
template_write_data(&ptr, &fontsize, sizeof(fontsize));
- /* write control entries */
- LIST_FOR_EACH_ENTRY_SAFE(control, control2, &desc.controls, struct taskdialog_control, entry)
- {
- ALIGN_POINTER(ptr, 3);
-
- template_write_data(&ptr, control->template, control->template_size);
-
- /* list item won't be needed later */
- list_remove(&control->entry);
- Free(control->template);
- Free(control);
- }
-
return template;
}
--
2.17.1
June 12, 2018
[PATCH 7/8] comctl32/taskdialog: Create buttons without templates.
by Zhiyi Zhang
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 192 ++++++++++++++-----------------------
1 file changed, 73 insertions(+), 119 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index d71189d4de..fef269fc0b 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -59,13 +59,6 @@ struct taskdialog_control
unsigned int template_size;
};
-struct taskdialog_button_desc
-{
- int id;
- const WCHAR *text;
- HINSTANCE hinst;
-};
-
struct taskdialog_template_desc
{
const TASKDIALOGCONFIG *taskconfig;
@@ -84,6 +77,9 @@ struct taskdialog_info
/* Control handles */
HWND main_instruction;
HWND content;
+ HWND *buttons;
+ INT button_count;
+ HWND default_button;
/* Dialog metrics */
struct
{
@@ -96,8 +92,6 @@ struct taskdialog_info
struct button_layout_info
{
- INT id;
- HWND hwnd;
LONG width;
LONG line;
};
@@ -155,85 +149,6 @@ static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc
return ALIGNED_LENGTH(size, 3);
}
-static void taskdialog_init_button(struct taskdialog_button_desc *button, struct taskdialog_template_desc *desc,
- int id, const WCHAR *text, BOOL custom_button)
-{
- button->id = id;
- button->text = text;
- button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
-
- if (id == desc->taskconfig->nDefaultButton)
- desc->default_button = button;
-}
-
-static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc, struct taskdialog_button_desc *buttons,
- unsigned int *button_count)
-{
- DWORD flags = desc->taskconfig->dwCommonButtons;
-
-#define TASKDIALOG_INIT_COMMON_BUTTON(id) \
- do { \
- taskdialog_init_button(&buttons[(*button_count)++], desc, ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), FALSE); \
- } while(0)
-
- if (flags & TDCBF_OK_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(OK);
- if (flags & TDCBF_YES_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(YES);
- if (flags & TDCBF_NO_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(NO);
- if (flags & TDCBF_RETRY_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(RETRY);
- if (flags & TDCBF_CANCEL_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(CANCEL);
- if (flags & TDCBF_CLOSE_BUTTON)
- TASKDIALOG_INIT_COMMON_BUTTON(CLOSE);
-
-#undef TASKDIALOG_INIT_COMMON_BUTTON
-}
-
-static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc)
-{
- unsigned int count = 0, buttons_size, i, size = 0;
- const TASKDIALOGCONFIG *taskconfig = desc->taskconfig;
- struct taskdialog_button_desc *buttons;
-
- /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
- buttons_size = 6;
- if (taskconfig->cButtons && taskconfig->pButtons)
- buttons_size += taskconfig->cButtons;
-
- if (!(buttons = Alloc(buttons_size * sizeof(*buttons))))
- return 0;
-
- /* Custom buttons */
- if (taskconfig->cButtons && taskconfig->pButtons)
- for (i = 0; i < taskconfig->cButtons; i++)
- taskdialog_init_button(&buttons[count++], desc, taskconfig->pButtons[i].nButtonID,
- taskconfig->pButtons[i].pszButtonText, TRUE);
-
- /* Common buttons */
- taskdialog_init_common_buttons(desc, buttons, &count);
-
- /* There must be at least one button */
- if (count == 0)
- taskdialog_init_button(&buttons[count++], desc, IDOK, MAKEINTRESOURCEW(IDS_BUTTON_OK), FALSE);
-
- if (!desc->default_button)
- desc->default_button = &buttons[0];
-
- /* create all buttons */
- for (i = 0; i < count; i++)
- {
- DWORD style = &buttons[i] == desc->default_button ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
- size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, style);
- }
-
- Free(buttons);
-
- return size;
-}
-
static void taskdialog_clear_controls(struct list *controls)
{
struct taskdialog_control *control, *control2;
@@ -312,8 +227,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
desc.control_count = 0;
desc.default_button = NULL;
- size += taskdialog_add_buttons(&desc);
-
template = Alloc(size);
if (!template)
{
@@ -450,6 +363,58 @@ static void taskdialog_add_content(struct taskdialog_info *dialog_info)
dialog_info->content = taskdialog_create_label(dialog_info, dialog_info->taskconfig->pszContent, dialog_info->font);
}
+static void taskdialog_add_button(struct taskdialog_info *dialog_info, HWND *button, INT id, const WCHAR *text,
+ BOOL custom_button)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ WCHAR *textW;
+
+ textW = taskdialog_gettext(dialog_info, custom_button, text);
+ *button = CreateWindowW(WC_BUTTONW, textW, WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, dialog_info->hwnd,
+ (HMENU)id, 0, NULL);
+ Free(textW);
+ SendMessageW(*button, WM_SETFONT, (WPARAM)dialog_info->font, 0);
+
+ if (id == taskconfig->nDefaultButton && !dialog_info->default_button) dialog_info->default_button = *button;
+}
+
+static void taskdialog_add_buttons(struct taskdialog_info *dialog_info)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ DWORD flags = taskconfig->dwCommonButtons;
+ INT count, max_count;
+
+ /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
+ max_count = 6;
+ if (taskconfig->cButtons && taskconfig->pButtons) max_count += taskconfig->cButtons;
+
+ dialog_info->buttons = Alloc(max_count * sizeof(*dialog_info->buttons));
+ if (!dialog_info->buttons) return;
+
+ for (count = 0; count < taskconfig->cButtons; count++)
+ taskdialog_add_button(dialog_info, &dialog_info->buttons[count], taskconfig->pButtons[count].nButtonID,
+ taskconfig->pButtons[count].pszButtonText, TRUE);
+
+#define TASKDIALOG_INIT_COMMON_BUTTON(id) \
+ do \
+ { \
+ taskdialog_add_button(dialog_info, &dialog_info->buttons[count++], ID##id, MAKEINTRESOURCEW(IDS_BUTTON_##id), \
+ FALSE); \
+ } while (0)
+
+ if (flags & TDCBF_OK_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(OK);
+ if (flags & TDCBF_YES_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(YES);
+ if (flags & TDCBF_NO_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(NO);
+ if (flags & TDCBF_RETRY_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(RETRY);
+ if (flags & TDCBF_CANCEL_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(CANCEL);
+ if (flags & TDCBF_CLOSE_BUTTON) TASKDIALOG_INIT_COMMON_BUTTON(CLOSE);
+
+ if (!count) TASKDIALOG_INIT_COMMON_BUTTON(OK);
+#undef TASKDIALOG_INIT_COMMON_BUTTON
+
+ dialog_info->button_count = count;
+}
+
static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hwnd, INT start_x, LONG dialog_width,
LONG *dialog_height)
{
@@ -469,12 +434,10 @@ static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hw
static void taskdialog_layout(struct taskdialog_info *dialog_info)
{
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
- DWORD flags = taskconfig->dwCommonButtons;
static BOOL first_time = TRUE;
RECT ref_rect;
LONG screen_width, dialog_width, dialog_height = 0;
LONG h_spacing, v_spacing;
- INT button_max_count, button_count = 0;
struct button_layout_info *button_layout_infos;
LONG button_min_width, button_height;
LONG *line_widths, line_count, align;
@@ -497,39 +460,21 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
taskdialog_label_layout(dialog_info, dialog_info->content, 0, dialog_width, &dialog_height);
/* Common and custom buttons */
- /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
- button_max_count = 6;
- /* Custom buttons */
- if (taskconfig->cButtons && taskconfig->pButtons) button_max_count += taskconfig->cButtons;
-
- button_layout_infos = Alloc(button_max_count * sizeof(*button_layout_infos));
- line_widths = Alloc(button_max_count * sizeof(*line_widths));
-
- if (taskconfig->cButtons && taskconfig->pButtons)
- for (button_count = 0; button_count < taskconfig->cButtons; button_count++)
- button_layout_infos[button_count].id = taskconfig->pButtons[button_count].nButtonID;
-
- /* Ok button may be added if no button is specified in taskconfig */
- if (GetDlgItem(dialog_info->hwnd, IDOK)) button_layout_infos[button_count++].id = IDOK;
- if (flags & TDCBF_YES_BUTTON) button_layout_infos[button_count++].id = IDYES;
- if (flags & TDCBF_NO_BUTTON) button_layout_infos[button_count++].id = IDNO;
- if (flags & TDCBF_RETRY_BUTTON) button_layout_infos[button_count++].id = IDRETRY;
- if (flags & TDCBF_CANCEL_BUTTON) button_layout_infos[button_count++].id = IDCANCEL;
- if (flags & TDCBF_CLOSE_BUTTON) button_layout_infos[button_count++].id = IDCLOSE;
+ button_layout_infos = Alloc(dialog_info->button_count * sizeof(*button_layout_infos));
+ line_widths = Alloc(dialog_info->button_count * sizeof(*line_widths));
button_min_width = DIALOG_BUTTON_WIDTH;
button_height = DIALOG_BUTTON_HEIGHT;
taskdialog_du_to_px(dialog_info, &button_min_width, &button_height);
- for (i = 0; i < button_count; i++)
+ for (i = 0; i < dialog_info->button_count; i++)
{
- button_layout_infos[i].hwnd = GetDlgItem(dialog_info->hwnd, button_layout_infos[i].id);
- taskdialog_get_label_size(dialog_info, button_layout_infos[i].hwnd, dialog_width - h_spacing * 2, &size);
+ taskdialog_get_label_size(dialog_info, dialog_info->buttons[i], dialog_width - h_spacing * 2, &size);
button_layout_infos[i].width = max(size.cx, button_min_width);
}
/* Separate buttons into lines */
x = h_spacing;
- for (i = 0, line_count = 0; i < button_count; i++)
+ for (i = 0, line_count = 0; i < dialog_info->button_count; i++)
{
if (x + button_layout_infos[i].width + h_spacing >= dialog_width)
{
@@ -551,7 +496,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
unsigned int j, last_button = 0;
int diff_changed;
- for (j = 0; j < button_count; j++)
+ for (j = 0; j < dialog_info->button_count; j++)
if (button_layout_infos[j].line == i - 1) last_button = j;
/* Difference in length of both lines if we wrapped the last button from the last line into this one */
@@ -576,7 +521,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
/* Now that we got them all positioned, move all buttons */
x = align;
size.cy = button_height;
- for (i = 0; i < button_count; i++)
+ for (i = 0; i < dialog_info->button_count; i++)
{
/* New line */
if (i > 0 && button_layout_infos[i].line != button_layout_infos[i - 1].line)
@@ -587,7 +532,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
y = dialog_height + v_spacing;
size.cx = button_layout_infos[i].width;
- SetWindowPos(button_layout_infos[i].hwnd, 0, x, y, size.cx, size.cy, SWP_NOZORDER);
+ SetWindowPos(dialog_info->buttons[i], 0, x, y, size.cx, size.cy, SWP_NOZORDER);
x += button_layout_infos[i].width + h_spacing;
}
@@ -618,6 +563,7 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
NONCLIENTMETRICSW ncm;
HDC hdc;
+ INT id;
ncm.cbSize = sizeof(ncm);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
@@ -644,6 +590,13 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
taskdialog_add_main_instruction(dialog_info);
taskdialog_add_content(dialog_info);
+ taskdialog_add_buttons(dialog_info);
+
+ /* Set default button */
+ if (!dialog_info->default_button) dialog_info->default_button = dialog_info->buttons[0];
+ SendMessageW(dialog_info->hwnd, WM_NEXTDLGCTL, (WPARAM)dialog_info->default_button, TRUE);
+ id = GetWindowLongW(dialog_info->default_button, GWLP_ID);
+ SendMessageW(dialog_info->hwnd, DM_SETDEFID, id, 0);
taskdialog_layout(dialog_info);
}
@@ -653,6 +606,7 @@ static void taskdialog_destroy(struct taskdialog_info *dialog_info)
if (dialog_info->taskconfig->dwFlags & TDF_CALLBACK_TIMER) KillTimer(dialog_info->hwnd, ID_TIMER);
if (dialog_info->font) DeleteObject(dialog_info->font);
if (dialog_info->main_instruction_font) DeleteObject(dialog_info->main_instruction_font);
+ if (dialog_info->buttons) Free(dialog_info->buttons);
}
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -678,7 +632,7 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
SetPropW(hwnd, taskdialog_info_propnameW, dialog_info);
taskdialog_notify(dialog_info, TDN_DIALOG_CONSTRUCTED, 0, 0);
taskdialog_notify(dialog_info, TDN_CREATED, 0, 0);
- break;
+ return FALSE;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
--
2.17.1
June 12, 2018
[PATCH 6/8] comctl32/taskdialog: Create content without templates.
by Zhiyi Zhang
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 46a4ce1a1d..d71189d4de 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -50,8 +50,6 @@ static const UINT DIALOG_BUTTON_WIDTH = 50;
static const UINT DIALOG_BUTTON_HEIGHT = 14;
static const UINT DIALOG_TIMER_MS = 200;
-static const UINT ID_CONTENT = 0xf001;
-
static const UINT ID_TIMER = 1;
struct taskdialog_control
@@ -85,6 +83,7 @@ struct taskdialog_info
HFONT main_instruction_font;
/* Control handles */
HWND main_instruction;
+ HWND content;
/* Dialog metrics */
struct
{
@@ -156,22 +155,6 @@ static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc
return ALIGNED_LENGTH(size, 3);
}
-static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc *desc, WORD id, const WCHAR *str)
-{
- unsigned int size;
-
- if (!str)
- return 0;
-
- size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, 0);
- return size;
-}
-
-static unsigned int taskdialog_add_content(struct taskdialog_template_desc *desc)
-{
- return taskdialog_add_static_label(desc, ID_CONTENT, desc->taskconfig->pszContent);
-}
-
static void taskdialog_init_button(struct taskdialog_button_desc *button, struct taskdialog_template_desc *desc,
int id, const WCHAR *text, BOOL custom_button)
{
@@ -329,7 +312,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
desc.control_count = 0;
desc.default_button = NULL;
- size += taskdialog_add_content(&desc);
size += taskdialog_add_buttons(&desc);
template = Alloc(size);
@@ -463,6 +445,11 @@ static void taskdialog_add_main_instruction(struct taskdialog_info *dialog_info)
taskdialog_create_label(dialog_info, taskconfig->pszMainInstruction, dialog_info->main_instruction_font);
}
+static void taskdialog_add_content(struct taskdialog_info *dialog_info)
+{
+ dialog_info->content = taskdialog_create_label(dialog_info, dialog_info->taskconfig->pszContent, dialog_info->font);
+}
+
static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hwnd, INT start_x, LONG dialog_width,
LONG *dialog_height)
{
@@ -484,7 +471,6 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
DWORD flags = taskconfig->dwCommonButtons;
static BOOL first_time = TRUE;
- HWND hwnd;
RECT ref_rect;
LONG screen_width, dialog_width, dialog_height = 0;
LONG h_spacing, v_spacing;
@@ -508,8 +494,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
taskdialog_label_layout(dialog_info, dialog_info->main_instruction, 0, dialog_width, &dialog_height);
/* Content */
- hwnd = GetDlgItem(dialog_info->hwnd, ID_CONTENT);
- taskdialog_label_layout(dialog_info, hwnd, 0, dialog_width, &dialog_height);
+ taskdialog_label_layout(dialog_info, dialog_info->content, 0, dialog_width, &dialog_height);
/* Common and custom buttons */
/* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
@@ -658,6 +643,7 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
}
taskdialog_add_main_instruction(dialog_info);
+ taskdialog_add_content(dialog_info);
taskdialog_layout(dialog_info);
}
--
2.17.1
June 12, 2018
[PATCH 5/8] comctl32/taskdialog: Create main instruction without templates.
by Zhiyi Zhang
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 90 ++++++++++++++++++++++++++------------
1 file changed, 62 insertions(+), 28 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index bd9e68b604..46a4ce1a1d 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -50,7 +50,6 @@ static const UINT DIALOG_BUTTON_WIDTH = 50;
static const UINT DIALOG_BUTTON_HEIGHT = 14;
static const UINT DIALOG_TIMER_MS = 200;
-static const UINT ID_MAIN_INSTRUCTION = 0xf000;
static const UINT ID_CONTENT = 0xf001;
static const UINT ID_TIMER = 1;
@@ -84,6 +83,8 @@ struct taskdialog_info
DWORD last_timer_tick;
HFONT font;
HFONT main_instruction_font;
+ /* Control handles */
+ HWND main_instruction;
/* Dialog metrics */
struct
{
@@ -114,24 +115,6 @@ static void template_write_data(char **ptr, const void *src, unsigned int size)
*ptr += size;
}
-static void taskdialog_set_main_instruction_font(struct taskdialog_info *dialog_info)
-{
- NONCLIENTMETRICSW ncm;
- HWND hwnd;
-
- hwnd = GetDlgItem(dialog_info->hwnd, ID_MAIN_INSTRUCTION);
- if(!hwnd) return;
-
- ncm.cbSize = sizeof(ncm);
- SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
- /* 1.25 times the height */
- ncm.lfMessageFont.lfHeight = ncm.lfMessageFont.lfHeight * 5 / 4;
- ncm.lfMessageFont.lfWeight = FW_BOLD;
- dialog_info->main_instruction_font = CreateFontIndirectW(&ncm.lfMessageFont);
-
- SendMessageW(hwnd, WM_SETFONT, (WPARAM)dialog_info->main_instruction_font, TRUE);
-}
-
static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
HINSTANCE hInstance, const WCHAR *text, DWORD style)
{
@@ -184,11 +167,6 @@ static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc
return size;
}
-static unsigned int taskdialog_add_main_instruction(struct taskdialog_template_desc *desc)
-{
- return taskdialog_add_static_label(desc, ID_MAIN_INSTRUCTION, desc->taskconfig->pszMainInstruction);
-}
-
static unsigned int taskdialog_add_content(struct taskdialog_template_desc *desc)
{
return taskdialog_add_static_label(desc, ID_CONTENT, desc->taskconfig->pszContent);
@@ -351,7 +329,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
desc.control_count = 0;
desc.default_button = NULL;
- size += taskdialog_add_main_instruction(&desc);
size += taskdialog_add_content(&desc);
size += taskdialog_add_buttons(&desc);
@@ -404,6 +381,30 @@ static void taskdialog_on_button_click(struct taskdialog_info *dialog_info, WORD
EndDialog(dialog_info->hwnd, command_id);
}
+static WCHAR *taskdialog_gettext(struct taskdialog_info *dialog_info, BOOL user_resource, const WCHAR *text)
+{
+ const WCHAR *textW = NULL;
+ INT length;
+ WCHAR *ret;
+
+ if (IS_INTRESOURCE(text))
+ {
+ if (!(length = LoadStringW(user_resource ? dialog_info->taskconfig->hInstance : COMCTL32_hModule,
+ (UINT_PTR)text, (WCHAR *)&textW, 0)))
+ return NULL;
+ }
+ else
+ {
+ textW = text;
+ length = strlenW(textW);
+ }
+
+ ret = Alloc((length + 1) * sizeof(WCHAR));
+ if (ret) memcpy(ret, textW, length * sizeof(WCHAR));
+
+ return ret;
+}
+
static void taskdialog_get_label_size(struct taskdialog_info *dialog_info, HWND hwnd, LONG max_width, SIZE *size)
{
DWORD style = DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK;
@@ -429,6 +430,39 @@ static void taskdialog_get_label_size(struct taskdialog_info *dialog_info, HWND
ReleaseDC(hwnd, hdc);
}
+static HWND taskdialog_create_label(struct taskdialog_info *dialog_info, const WCHAR *text, HFONT font)
+{
+ WCHAR *textW;
+ HWND hwnd;
+
+ if (!text) return NULL;
+
+ textW = taskdialog_gettext(dialog_info, TRUE, text);
+ hwnd = CreateWindowW(WC_STATICW, textW, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, dialog_info->hwnd, NULL, 0, NULL);
+ if (textW) Free(textW);
+
+ SendMessageW(hwnd, WM_SETFONT, (WPARAM)font, 0);
+ return hwnd;
+}
+
+static void taskdialog_add_main_instruction(struct taskdialog_info *dialog_info)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ NONCLIENTMETRICSW ncm;
+
+ if (!taskconfig->pszMainInstruction) return;
+
+ ncm.cbSize = sizeof(ncm);
+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
+ /* 1.25 times the height */
+ ncm.lfMessageFont.lfHeight = ncm.lfMessageFont.lfHeight * 5 / 4;
+ ncm.lfMessageFont.lfWeight = FW_BOLD;
+ dialog_info->main_instruction_font = CreateFontIndirectW(&ncm.lfMessageFont);
+
+ dialog_info->main_instruction =
+ taskdialog_create_label(dialog_info, taskconfig->pszMainInstruction, dialog_info->main_instruction_font);
+}
+
static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hwnd, INT start_x, LONG dialog_width,
LONG *dialog_height)
{
@@ -471,8 +505,7 @@ static void taskdialog_layout(struct taskdialog_info *dialog_info)
v_spacing = dialog_info->m.v_spacing;
/* Main instruction */
- hwnd = GetDlgItem(dialog_info->hwnd, ID_MAIN_INSTRUCTION);
- taskdialog_label_layout(dialog_info, hwnd, 0, dialog_width, &dialog_height);
+ taskdialog_label_layout(dialog_info, dialog_info->main_instruction, 0, dialog_width, &dialog_height);
/* Content */
hwnd = GetDlgItem(dialog_info->hwnd, ID_CONTENT);
@@ -624,7 +657,8 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
dialog_info->last_timer_tick = GetTickCount();
}
- taskdialog_set_main_instruction_font(dialog_info);
+ taskdialog_add_main_instruction(dialog_info);
+
taskdialog_layout(dialog_info);
}
--
2.17.1
June 12, 2018
[PATCH 4/8] comctl32/taskdialog: Support dynamic layout.
by Zhiyi Zhang
Support dynamic layout since some controls might change
their own layout after creation.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 418 +++++++++++++++++++++----------------
1 file changed, 237 insertions(+), 181 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 549c7f2bf9..bd9e68b604 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -66,21 +66,14 @@ struct taskdialog_button_desc
{
int id;
const WCHAR *text;
- unsigned int width;
- unsigned int line;
HINSTANCE hinst;
};
struct taskdialog_template_desc
{
const TASKDIALOGCONFIG *taskconfig;
- unsigned int dialog_height;
- unsigned int dialog_width;
struct list controls;
WORD control_count;
- LONG x_baseunit;
- LONG y_baseunit;
- HFONT font;
struct taskdialog_button_desc *default_button;
};
@@ -89,23 +82,30 @@ struct taskdialog_info
HWND hwnd;
const TASKDIALOGCONFIG *taskconfig;
DWORD last_timer_tick;
+ HFONT font;
HFONT main_instruction_font;
+ /* Dialog metrics */
+ struct
+ {
+ LONG x_baseunit;
+ LONG y_baseunit;
+ LONG h_spacing;
+ LONG v_spacing;
+ } m;
};
-static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
+struct button_layout_info
{
- if (width)
- *width = MulDiv(*width, 4, desc->x_baseunit);
- if (height)
- *height = MulDiv(*height, 8, desc->y_baseunit);
-}
+ INT id;
+ HWND hwnd;
+ LONG width;
+ LONG line;
+};
-static void dialogunits_to_pixels(const struct taskdialog_template_desc *desc, LONG *width, LONG *height)
+static void taskdialog_du_to_px(struct taskdialog_info *dialog_info, LONG *width, LONG *height)
{
- if (width)
- *width = MulDiv(*width, desc->x_baseunit, 4);
- if (height)
- *height = MulDiv(*height, desc->y_baseunit, 8);
+ if (width) *width = MulDiv(*width, dialog_info->m.x_baseunit, 4);
+ if (height) *height = MulDiv(*height, dialog_info->m.y_baseunit, 8);
}
static void template_write_data(char **ptr, const void *src, unsigned int size)
@@ -132,49 +132,8 @@ static void taskdialog_set_main_instruction_font(struct taskdialog_info *dialog_
SendMessageW(hwnd, WM_SETFONT, (WPARAM)dialog_info->main_instruction_font, TRUE);
}
-/* used to calculate size for the controls */
-static void taskdialog_get_text_extent(const struct taskdialog_template_desc *desc, const WCHAR *text,
- BOOL user_resource, SIZE *sz)
-{
- RECT rect = { 0, 0, desc->dialog_width - DIALOG_SPACING * 2, 0}; /* padding left and right of the control */
- const WCHAR *textW = NULL;
- static const WCHAR nulW;
- unsigned int length;
- HFONT oldfont;
- HDC hdc;
-
- if (IS_INTRESOURCE(text))
- {
- if (!(length = LoadStringW(user_resource ? desc->taskconfig->hInstance : COMCTL32_hModule,
- (UINT_PTR)text, (WCHAR *)&textW, 0)))
- {
- WARN("Failed to load text\n");
- textW = &nulW;
- length = 0;
- }
- }
- else
- {
- textW = text;
- length = strlenW(textW);
- }
-
- hdc = GetDC(0);
- oldfont = SelectObject(hdc, desc->font);
-
- dialogunits_to_pixels(desc, &rect.right, NULL);
- DrawTextW(hdc, textW, length, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK);
- pixels_to_dialogunits(desc, &rect.right, &rect.bottom);
-
- SelectObject(hdc, oldfont);
- ReleaseDC(0, hdc);
-
- sz->cx = rect.right - rect.left;
- sz->cy = rect.bottom - rect.top;
-}
-
static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class,
- HINSTANCE hInstance, const WCHAR *text, DWORD style, short x, short y, short cx, short cy)
+ HINSTANCE hInstance, const WCHAR *text, DWORD style)
{
struct taskdialog_control *control = Alloc(sizeof(*control));
unsigned int size, class_size, text_size;
@@ -203,10 +162,6 @@ static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc
template->style = WS_VISIBLE | style;
template->dwExtendedStyle = 0;
- template->x = x;
- template->y = y;
- template->cx = cx;
- template->cy = cy;
template->id = id;
ptr = (char *)(template + 1);
template_write_data(&ptr, class, class_size);
@@ -221,17 +176,11 @@ static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc
static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc *desc, WORD id, const WCHAR *str)
{
unsigned int size;
- SIZE sz;
if (!str)
return 0;
- taskdialog_get_text_extent(desc, str, TRUE, &sz);
-
- desc->dialog_height += DIALOG_SPACING;
- size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, 0, DIALOG_SPACING,
- desc->dialog_height, sz.cx, sz.cy);
- desc->dialog_height += sz.cy + DIALOG_SPACING;
+ size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, 0);
return size;
}
@@ -248,14 +197,8 @@ static unsigned int taskdialog_add_content(struct taskdialog_template_desc *desc
static void taskdialog_init_button(struct taskdialog_button_desc *button, struct taskdialog_template_desc *desc,
int id, const WCHAR *text, BOOL custom_button)
{
- SIZE sz;
-
- taskdialog_get_text_extent(desc, text, custom_button, &sz);
-
button->id = id;
button->text = text;
- button->width = max(DIALOG_BUTTON_WIDTH, sz.cx + DIALOG_SPACING * 2);
- button->line = 0;
button->hinst = custom_button ? desc->taskconfig->hInstance : COMCTL32_hModule;
if (id == desc->taskconfig->nDefaultButton)
@@ -290,8 +233,7 @@ static void taskdialog_init_common_buttons(struct taskdialog_template_desc *desc
static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc)
{
- unsigned int count = 0, buttons_size, i, line_count, size = 0;
- unsigned int location_x, *line_widths, alignment = ~0u;
+ unsigned int count = 0, buttons_size, i, size = 0;
const TASKDIALOGCONFIG *taskconfig = desc->taskconfig;
struct taskdialog_button_desc *buttons;
@@ -319,78 +261,13 @@ static unsigned int taskdialog_add_buttons(struct taskdialog_template_desc *desc
if (!desc->default_button)
desc->default_button = &buttons[0];
- /* For easy handling just allocate as many lines as buttons, the worst case. */
- line_widths = Alloc(count * sizeof(*line_widths));
-
- /* Separate buttons into lines */
- location_x = DIALOG_SPACING;
- for (i = 0, line_count = 0; i < count; i++)
- {
- if (location_x + buttons[i].width + DIALOG_SPACING > desc->dialog_width)
- {
- location_x = DIALOG_SPACING;
- line_count++;
- }
-
- buttons[i].line = line_count;
-
- location_x += buttons[i].width + DIALOG_SPACING;
- line_widths[line_count] += buttons[i].width + DIALOG_SPACING;
- }
- line_count++;
-
- /* Try to balance lines so they are about the same size */
- for (i = 1; i < line_count - 1; i++)
- {
- int diff_now = abs(line_widths[i] - line_widths[i - 1]);
- unsigned int j, last_button = 0;
- int diff_changed;
-
- for (j = 0; j < count; j++)
- if (buttons[j].line == i - 1)
- last_button = j;
-
- /* Difference in length of both lines if we wrapped the last button from the last line into this one */
- diff_changed = abs(2 * buttons[last_button].width + line_widths[i] - line_widths[i - 1]);
-
- if (diff_changed < diff_now)
- {
- buttons[last_button].line = i;
- line_widths[i] += buttons[last_button].width;
- line_widths[i - 1] -= buttons[last_button].width;
- }
- }
-
- /* Calculate left alignment so all lines are as far right as possible. */
- for (i = 0; i < line_count; i++)
- {
- int new_alignment = desc->dialog_width - line_widths[i];
- if (new_alignment < alignment)
- alignment = new_alignment;
- }
-
- /* Now that we got them all positioned, create all buttons */
- location_x = alignment;
+ /* create all buttons */
for (i = 0; i < count; i++)
{
DWORD style = &buttons[i] == desc->default_button ? BS_DEFPUSHBUTTON : BS_PUSHBUTTON;
-
- if (i > 0 && buttons[i].line != buttons[i - 1].line) /* New line */
- {
- location_x = alignment;
- desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
- }
-
- size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, style,
- location_x, desc->dialog_height, buttons[i].width, DIALOG_BUTTON_HEIGHT);
-
- location_x += buttons[i].width + DIALOG_SPACING;
+ size += taskdialog_add_control(desc, buttons[i].id, WC_BUTTONW, buttons[i].hinst, buttons[i].text, style);
}
- /* Add height for last row and spacing */
- desc->dialog_height += DIALOG_BUTTON_HEIGHT + DIALOG_SPACING;
-
- Free(line_widths);
Free(buttons);
return size;
@@ -408,25 +285,20 @@ static void taskdialog_clear_controls(struct list *controls)
}
}
-static unsigned int taskdialog_get_reference_rect(const struct taskdialog_template_desc *desc, RECT *ret)
+static unsigned int taskdialog_get_reference_rect(const TASKDIALOGCONFIG *taskconfig, RECT *ret)
{
- HMONITOR monitor = MonitorFromWindow(desc->taskconfig->hwndParent ? desc->taskconfig->hwndParent : GetActiveWindow(),
- MONITOR_DEFAULTTOPRIMARY);
+ HMONITOR monitor = MonitorFromWindow(taskconfig->hwndParent ? taskconfig->hwndParent : GetActiveWindow(),
+ MONITOR_DEFAULTTOPRIMARY);
MONITORINFO info;
info.cbSize = sizeof(info);
GetMonitorInfoW(monitor, &info);
- if (desc->taskconfig->dwFlags & TDF_POSITION_RELATIVE_TO_WINDOW && desc->taskconfig->hwndParent)
- GetWindowRect(desc->taskconfig->hwndParent, ret);
+ if (taskconfig->dwFlags & TDF_POSITION_RELATIVE_TO_WINDOW && taskconfig->hwndParent)
+ GetWindowRect(taskconfig->hwndParent, ret);
else
*ret = info.rcWork;
- pixels_to_dialogunits(desc, &ret->left, &ret->top);
- pixels_to_dialogunits(desc, &ret->right, &ret->bottom);
-
- pixels_to_dialogunits(desc, &info.rcWork.left, &info.rcWork.top);
- pixels_to_dialogunits(desc, &info.rcWork.right, &info.rcWork.bottom);
return info.rcWork.right - info.rcWork.left;
}
@@ -447,17 +319,14 @@ static WCHAR *taskdialog_get_exe_name(WCHAR *name, DWORD length)
static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig)
{
struct taskdialog_control *control, *control2;
- unsigned int size, title_size, screen_width;
+ unsigned int size, title_size;
struct taskdialog_template_desc desc;
static const WORD fontsize = 0x7fff;
static const WCHAR emptyW[] = { 0 };
const WCHAR *titleW = NULL;
DLGTEMPLATE *template;
- NONCLIENTMETRICSW ncm;
WCHAR pathW[MAX_PATH];
- RECT ref_rect;
char *ptr;
- HDC hdc;
/* Window title */
if (!taskconfig->pszWindowTitle)
@@ -480,21 +349,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
list_init(&desc.controls);
desc.taskconfig = taskconfig;
desc.control_count = 0;
-
- ncm.cbSize = sizeof(ncm);
- SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
- desc.font = CreateFontIndirectW(&ncm.lfMessageFont);
-
- hdc = GetDC(0);
- SelectObject(hdc, desc.font);
- desc.x_baseunit = GdiGetCharDimensions(hdc, NULL, &desc.y_baseunit);
- ReleaseDC(0, hdc);
-
- screen_width = taskdialog_get_reference_rect(&desc, &ref_rect);
-
- desc.dialog_height = 0;
- desc.dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH);
- desc.dialog_width = min(desc.dialog_width, screen_width);
desc.default_button = NULL;
size += taskdialog_add_main_instruction(&desc);
@@ -505,7 +359,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
if (!template)
{
taskdialog_clear_controls(&desc.controls);
- DeleteObject(desc.font);
return NULL;
}
@@ -514,10 +367,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
if (!(taskconfig->dwFlags & TDF_NO_SET_FOREGROUND)) template->style |= DS_SETFOREGROUND;
if (taskconfig->dwFlags & TDF_RTL_LAYOUT) template->dwExtendedStyle = WS_EX_LAYOUTRTL | WS_EX_RIGHT | WS_EX_RTLREADING;
template->cdit = desc.control_count;
- template->x = (ref_rect.left + ref_rect.right + desc.dialog_width) / 2;
- template->y = (ref_rect.top + ref_rect.bottom + desc.dialog_height) / 2;
- template->cx = desc.dialog_width;
- template->cy = desc.dialog_height;
ptr = (char *)(template + 1);
ptr += 2; /* menu */
@@ -538,7 +387,6 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
Free(control);
}
- DeleteObject(desc.font);
return template;
}
@@ -556,13 +404,219 @@ static void taskdialog_on_button_click(struct taskdialog_info *dialog_info, WORD
EndDialog(dialog_info->hwnd, command_id);
}
+static void taskdialog_get_label_size(struct taskdialog_info *dialog_info, HWND hwnd, LONG max_width, SIZE *size)
+{
+ DWORD style = DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK;
+ HFONT hfont, old_hfont;
+ HDC hdc;
+ RECT rect = {0};
+ WCHAR text[1024];
+ INT text_length;
+
+ if (dialog_info->taskconfig->dwFlags & TDF_RTL_LAYOUT)
+ style |= DT_RIGHT | DT_RTLREADING;
+ else
+ style |= DT_LEFT;
+
+ hfont = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0);
+ text_length = GetWindowTextW(hwnd, text, ARRAY_SIZE(text));
+ hdc = GetDC(hwnd);
+ old_hfont = SelectObject(hdc, hfont);
+ rect.right = max_width;
+ size->cy = DrawTextW(hdc, text, text_length, &rect, style);
+ size->cx = min(max_width, rect.right - rect.left);
+ if (old_hfont) SelectObject(hdc, old_hfont);
+ ReleaseDC(hwnd, hdc);
+}
+
+static void taskdialog_label_layout(struct taskdialog_info *dialog_info, HWND hwnd, INT start_x, LONG dialog_width,
+ LONG *dialog_height)
+{
+ LONG x, y, max_width;
+ SIZE size;
+
+ if (!hwnd) return;
+
+ x = start_x + dialog_info->m.h_spacing;
+ y = *dialog_height + dialog_info->m.v_spacing;
+ max_width = dialog_width - x - dialog_info->m.h_spacing;
+ taskdialog_get_label_size(dialog_info, hwnd, max_width, &size);
+ SetWindowPos(hwnd, 0, x, y, size.cx, size.cy, SWP_NOZORDER);
+ *dialog_height = y + size.cy;
+}
+
+static void taskdialog_layout(struct taskdialog_info *dialog_info)
+{
+ const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ DWORD flags = taskconfig->dwCommonButtons;
+ static BOOL first_time = TRUE;
+ HWND hwnd;
+ RECT ref_rect;
+ LONG screen_width, dialog_width, dialog_height = 0;
+ LONG h_spacing, v_spacing;
+ INT button_max_count, button_count = 0;
+ struct button_layout_info *button_layout_infos;
+ LONG button_min_width, button_height;
+ LONG *line_widths, line_count, align;
+ LONG x, y;
+ SIZE size;
+ INT i;
+
+ screen_width = taskdialog_get_reference_rect(dialog_info->taskconfig, &ref_rect);
+ dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH);
+ taskdialog_du_to_px(dialog_info, &dialog_width, 0);
+ dialog_width = min(dialog_width, screen_width);
+
+ h_spacing = dialog_info->m.h_spacing;
+ v_spacing = dialog_info->m.v_spacing;
+
+ /* Main instruction */
+ hwnd = GetDlgItem(dialog_info->hwnd, ID_MAIN_INSTRUCTION);
+ taskdialog_label_layout(dialog_info, hwnd, 0, dialog_width, &dialog_height);
+
+ /* Content */
+ hwnd = GetDlgItem(dialog_info->hwnd, ID_CONTENT);
+ taskdialog_label_layout(dialog_info, hwnd, 0, dialog_width, &dialog_height);
+
+ /* Common and custom buttons */
+ /* Allocate enough memory for the custom and the default buttons. Maximum 6 default buttons possible. */
+ button_max_count = 6;
+ /* Custom buttons */
+ if (taskconfig->cButtons && taskconfig->pButtons) button_max_count += taskconfig->cButtons;
+
+ button_layout_infos = Alloc(button_max_count * sizeof(*button_layout_infos));
+ line_widths = Alloc(button_max_count * sizeof(*line_widths));
+
+ if (taskconfig->cButtons && taskconfig->pButtons)
+ for (button_count = 0; button_count < taskconfig->cButtons; button_count++)
+ button_layout_infos[button_count].id = taskconfig->pButtons[button_count].nButtonID;
+
+ /* Ok button may be added if no button is specified in taskconfig */
+ if (GetDlgItem(dialog_info->hwnd, IDOK)) button_layout_infos[button_count++].id = IDOK;
+ if (flags & TDCBF_YES_BUTTON) button_layout_infos[button_count++].id = IDYES;
+ if (flags & TDCBF_NO_BUTTON) button_layout_infos[button_count++].id = IDNO;
+ if (flags & TDCBF_RETRY_BUTTON) button_layout_infos[button_count++].id = IDRETRY;
+ if (flags & TDCBF_CANCEL_BUTTON) button_layout_infos[button_count++].id = IDCANCEL;
+ if (flags & TDCBF_CLOSE_BUTTON) button_layout_infos[button_count++].id = IDCLOSE;
+
+ button_min_width = DIALOG_BUTTON_WIDTH;
+ button_height = DIALOG_BUTTON_HEIGHT;
+ taskdialog_du_to_px(dialog_info, &button_min_width, &button_height);
+ for (i = 0; i < button_count; i++)
+ {
+ button_layout_infos[i].hwnd = GetDlgItem(dialog_info->hwnd, button_layout_infos[i].id);
+ taskdialog_get_label_size(dialog_info, button_layout_infos[i].hwnd, dialog_width - h_spacing * 2, &size);
+ button_layout_infos[i].width = max(size.cx, button_min_width);
+ }
+
+ /* Separate buttons into lines */
+ x = h_spacing;
+ for (i = 0, line_count = 0; i < button_count; i++)
+ {
+ if (x + button_layout_infos[i].width + h_spacing >= dialog_width)
+ {
+ x = h_spacing;
+ line_count++;
+ }
+
+ button_layout_infos[i].line = line_count;
+
+ x += button_layout_infos[i].width + h_spacing;
+ line_widths[line_count] += button_layout_infos[i].width + h_spacing;
+ }
+ line_count++;
+
+ /* Try to balance lines so they are about the same size */
+ for (i = 1; i < line_count - 1; i++)
+ {
+ int diff_now = abs(line_widths[i] - line_widths[i - 1]);
+ unsigned int j, last_button = 0;
+ int diff_changed;
+
+ for (j = 0; j < button_count; j++)
+ if (button_layout_infos[j].line == i - 1) last_button = j;
+
+ /* Difference in length of both lines if we wrapped the last button from the last line into this one */
+ diff_changed = abs(2 * button_layout_infos[last_button].width + line_widths[i] - line_widths[i - 1]);
+
+ if (diff_changed < diff_now)
+ {
+ button_layout_infos[last_button].line = i;
+ line_widths[i] += button_layout_infos[last_button].width;
+ line_widths[i - 1] -= button_layout_infos[last_button].width;
+ }
+ }
+
+ /* Calculate left alignment so all lines are as far right as possible. */
+ align = dialog_width - h_spacing;
+ for (i = 0; i < line_count; i++)
+ {
+ int new_alignment = dialog_width - line_widths[i];
+ if (new_alignment < align) align = new_alignment;
+ }
+
+ /* Now that we got them all positioned, move all buttons */
+ x = align;
+ size.cy = button_height;
+ for (i = 0; i < button_count; i++)
+ {
+ /* New line */
+ if (i > 0 && button_layout_infos[i].line != button_layout_infos[i - 1].line)
+ {
+ x = align;
+ dialog_height += size.cy + v_spacing;
+ }
+
+ y = dialog_height + v_spacing;
+ size.cx = button_layout_infos[i].width;
+ SetWindowPos(button_layout_infos[i].hwnd, 0, x, y, size.cx, size.cy, SWP_NOZORDER);
+ x += button_layout_infos[i].width + h_spacing;
+ }
+
+ /* Add height for last row button and spacing */
+ dialog_height += size.cy + v_spacing;
+
+ Free(button_layout_infos);
+ Free(line_widths);
+
+ /* Add height for spacing, title height and frame height */
+ dialog_height += v_spacing;
+ dialog_height += GetSystemMetrics(SM_CYCAPTION);
+ dialog_height += GetSystemMetrics(SM_CXDLGFRAME);
+
+ if (first_time)
+ {
+ x = (ref_rect.left + ref_rect.right + dialog_width) / 2;
+ y = (ref_rect.top + ref_rect.bottom + dialog_height) / 2;
+ SetWindowPos(dialog_info->hwnd, 0, x, y, dialog_width, dialog_height, SWP_NOZORDER);
+ first_time = FALSE;
+ }
+ else
+ SetWindowPos(dialog_info->hwnd, 0, 0, 0, dialog_width, dialog_height, SWP_NOMOVE | SWP_NOZORDER);
+}
+
static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
{
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ NONCLIENTMETRICSW ncm;
+ HDC hdc;
+
+ ncm.cbSize = sizeof(ncm);
+ SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0);
memset(dialog_info, 0, sizeof(*dialog_info));
dialog_info->taskconfig = taskconfig;
dialog_info->hwnd = hwnd;
+ dialog_info->font = CreateFontIndirectW(&ncm.lfMessageFont);
+
+ hdc = GetDC(dialog_info->hwnd);
+ SelectObject(hdc, dialog_info->font);
+ dialog_info->m.x_baseunit = GdiGetCharDimensions(hdc, NULL, &dialog_info->m.y_baseunit);
+ ReleaseDC(dialog_info->hwnd, hdc);
+
+ dialog_info->m.h_spacing = DIALOG_SPACING;
+ dialog_info->m.v_spacing = DIALOG_SPACING;
+ taskdialog_du_to_px(dialog_info, &dialog_info->m.h_spacing, &dialog_info->m.v_spacing);
if (taskconfig->dwFlags & TDF_CALLBACK_TIMER)
{
@@ -571,11 +625,13 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
}
taskdialog_set_main_instruction_font(dialog_info);
+ taskdialog_layout(dialog_info);
}
static void taskdialog_destroy(struct taskdialog_info *dialog_info)
{
if (dialog_info->taskconfig->dwFlags & TDF_CALLBACK_TIMER) KillTimer(dialog_info->hwnd, ID_TIMER);
+ if (dialog_info->font) DeleteObject(dialog_info->font);
if (dialog_info->main_instruction_font) DeleteObject(dialog_info->main_instruction_font);
}
--
2.17.1
June 12, 2018
[PATCH 3/8] comctl32/taskdialog: Add taskdialog_destroy().
by Zhiyi Zhang
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 7424467af1..549c7f2bf9 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -573,6 +573,12 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
taskdialog_set_main_instruction_font(dialog_info);
}
+static void taskdialog_destroy(struct taskdialog_info *dialog_info)
+{
+ if (dialog_info->taskconfig->dwFlags & TDF_CALLBACK_TIMER) KillTimer(dialog_info->hwnd, ID_TIMER);
+ if (dialog_info->main_instruction_font) DeleteObject(dialog_info->main_instruction_font);
+}
+
static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static const WCHAR taskdialog_info_propnameW[] = {'T','a','s','k','D','i','a','l','o','g','I','n','f','o',0};
@@ -618,10 +624,7 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case WM_DESTROY:
taskdialog_notify(dialog_info, TDN_DESTROYED, 0, 0);
RemovePropW(hwnd, taskdialog_info_propnameW);
- if (dialog_info->taskconfig->dwFlags & TDF_CALLBACK_TIMER)
- KillTimer(hwnd, ID_TIMER);
- if (dialog_info->main_instruction_font)
- DeleteObject(dialog_info->main_instruction_font);
+ taskdialog_destroy(dialog_info);
break;
default:
return FALSE;
--
2.17.1
June 12, 2018
[PATCH 2/8] comctl32/taskdialog: Remove unused parameter.
by Zhiyi Zhang
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 56133ffb89..7424467af1 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -430,7 +430,7 @@ static unsigned int taskdialog_get_reference_rect(const struct taskdialog_templa
return info.rcWork.right - info.rcWork.left;
}
-static WCHAR *taskdialog_get_exe_name(const TASKDIALOGCONFIG *taskconfig, WCHAR *name, DWORD length)
+static WCHAR *taskdialog_get_exe_name(WCHAR *name, DWORD length)
{
DWORD len = GetModuleFileNameW(NULL, name, length);
if (len && len < length)
@@ -461,11 +461,11 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
/* Window title */
if (!taskconfig->pszWindowTitle)
- titleW = taskdialog_get_exe_name(taskconfig, pathW, ARRAY_SIZE(pathW));
+ titleW = taskdialog_get_exe_name(pathW, ARRAY_SIZE(pathW));
else if (IS_INTRESOURCE(taskconfig->pszWindowTitle))
{
if (!LoadStringW(taskconfig->hInstance, LOWORD(taskconfig->pszWindowTitle), (WCHAR *)&titleW, 0))
- titleW = taskdialog_get_exe_name(taskconfig, pathW, ARRAY_SIZE(pathW));
+ titleW = taskdialog_get_exe_name(pathW, ARRAY_SIZE(pathW));
}
else
titleW = taskconfig->pszWindowTitle;
--
2.17.1
June 12, 2018
[PATCH 1/8] comctl32/taskdialog: Zero out taskdialog_info at initialization.
by Zhiyi Zhang
Zero init taskdialog_info to avoid garbage values.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com>
---
dlls/comctl32/taskdialog.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 346a079ab6..56133ffb89 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -560,6 +560,8 @@ static void taskdialog_init(struct taskdialog_info *dialog_info, HWND hwnd)
{
const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
+ memset(dialog_info, 0, sizeof(*dialog_info));
+ dialog_info->taskconfig = taskconfig;
dialog_info->hwnd = hwnd;
if (taskconfig->dwFlags & TDF_CALLBACK_TIMER)
--
2.17.1
June 12, 2018
[PATCH v2 2/2] msvcrt: Don't reimplement call_unwind_func().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/msvcrt/except_i386.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 3f22f3e..5812d10 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -59,7 +59,7 @@ typedef struct __catchblock_info
UINT flags; /* flags (see below) */
const type_info *type_info; /* C++ type caught by this block */
int offset; /* stack offset to copy exception object to */
- void (*handler)(void);/* catch block handler code */
+ void * (*handler)(void);/* catch block handler code */
} catchblock_info;
#define TYPE_FLAG_CONST 1
#define TYPE_FLAG_VOLATILE 2
@@ -78,8 +78,8 @@ typedef struct __tryblock_info
/* info about the unwind handler for a given trylevel */
typedef struct __unwind_info
{
- int prev; /* prev trylevel unwind handler, to run after this one */
- void (*handler)(void);/* unwind handler */
+ int prev; /* prev trylevel unwind handler, to run after this one */
+ void * (*handler)(void);/* unwind handler */
} unwind_info;
/* descriptor of all try blocks of a given function */
@@ -137,22 +137,6 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame
const cxx_function_descr *descr,
EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel ) DECLSPEC_HIDDEN;
-/* call a function with a given ebp */
-static inline void *call_ebp_func( void *func, void *ebp )
-{
- void *ret;
- int dummy;
- __asm__ __volatile__ ("pushl %%ebx\n\t"
- "pushl %%ebp\n\t"
- "movl %4,%%ebp\n\t"
- "call *%%eax\n\t"
- "popl %%ebp\n\t"
- "popl %%ebx"
- : "=a" (ret), "=S" (dummy), "=D" (dummy)
- : "0" (func), "1" (ebp) : "ecx", "edx", "memory" );
- return ret;
-}
-
/* call a copy constructor */
extern void call_copy_ctor( void *func, void *this, void *src, int has_vbase );
@@ -326,7 +310,7 @@ static void copy_exception( void *object, cxx_exception_frame *frame,
/* unwind the local function up to a given trylevel */
static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_descr *descr, int last_level)
{
- void (*handler)(void);
+ void * (*handler)(void);
int trylevel = frame->trylevel;
while (trylevel != last_level)
@@ -341,7 +325,7 @@ static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_des
{
TRACE( "calling unwind handler %p trylevel %d last %d ebp %p\n",
handler, trylevel, last_level, &frame->ebp );
- call_ebp_func( handler, &frame->ebp );
+ call_handler( handler, &frame->ebp );
}
trylevel = descr->unwind_table[trylevel].prev;
}
@@ -478,7 +462,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
nested_frame.trylevel = nested_trylevel + 1;
__wine_push_frame( &nested_frame.frame );
- addr = call_ebp_func( catchblock->handler, &frame->ebp );
+ addr = call_handler( catchblock->handler, &frame->ebp );
__wine_pop_frame( &nested_frame.frame );
((DWORD*)frame)[-1] = save_esp;
--
2.7.4
June 11, 2018
[PATCH v2 1/2] msvcrt: Avoid using inline assembly in call_unwind_func().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
v2: rename to call_handler() and use void * as return type.
dlls/msvcrt/except_i386.c | 38 +++++++++++++++++---------------------
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 29540cd..3f22f3e 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -107,7 +107,7 @@ typedef struct _SCOPETABLE
{
int previousTryLevel;
int (*lpfnFilter)(PEXCEPTION_POINTERS);
- int (*lpfnHandler)(void);
+ void * (*lpfnHandler)(void);
} SCOPETABLE, *PSCOPETABLE;
typedef struct _MSVCRT_EXCEPTION_FRAME
@@ -198,24 +198,20 @@ __ASM_GLOBAL_FUNC( call_filter,
"popl %ebp\n\t"
"ret" );
-static inline int call_unwind_func( int (*func)(void), void *ebp )
-{
- int ret;
- __asm__ __volatile__ ("pushl %%ebp\n\t"
- "pushl %%ebx\n\t"
- "pushl %%esi\n\t"
- "pushl %%edi\n\t"
- "movl %2,%%ebp\n\t"
- "call *%0\n\t"
- "popl %%edi\n\t"
- "popl %%esi\n\t"
- "popl %%ebx\n\t"
- "popl %%ebp"
- : "=a" (ret)
- : "0" (func), "r" (ebp)
- : "ecx", "edx", "memory" );
- return ret;
-}
+extern void *call_handler( void * (*func)(void), void *ebp );
+
+__ASM_GLOBAL_FUNC( call_handler,
+ "pushl %ebp\n\t"
+ "pushl %ebx\n\t"
+ "pushl %esi\n\t"
+ "pushl %edi\n\t"
+ "movl 24(%esp), %ebp\n\t"
+ "call *20(%esp)\n\t"
+ "popl %edi\n\t"
+ "popl %esi\n\t"
+ "popl %ebx\n\t"
+ "popl %ebp\n\t"
+ "ret" );
static inline void dump_type( const cxx_type_info *type )
{
@@ -806,7 +802,7 @@ static void msvcrt_local_unwind2(MSVCRT_EXCEPTION_FRAME* frame, int trylevel, vo
{
TRACE( "__try block cleanup level %d handler %p ebp %p\n",
level, frame->scopetable[level].lpfnHandler, ebp );
- call_unwind_func( frame->scopetable[level].lpfnHandler, ebp );
+ call_handler( frame->scopetable[level].lpfnHandler, ebp );
}
}
__wine_pop_frame(®);
@@ -833,7 +829,7 @@ static void msvcrt_local_unwind4( ULONG *cookie, MSVCRT_EXCEPTION_FRAME* frame,
{
TRACE( "__try block cleanup level %d handler %p ebp %p\n",
level, scopetable->entries[level].lpfnHandler, ebp );
- call_unwind_func( scopetable->entries[level].lpfnHandler, ebp );
+ call_handler( scopetable->entries[level].lpfnHandler, ebp );
}
}
__wine_pop_frame(®);
--
2.7.4
June 11, 2018
[PATCH 7/7] wsdapi: Build types list when parsing Probe message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 91
++++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/tests/discovery.c | 2 +-
dlls/wsdapi/wsdapi_internal.h | 1 +
dlls/wsdapi/xml.c | 16 ++++++++
4 files changed, 108 insertions(+), 2 deletions(-)
June 11, 2018
[PATCH 6/7] wsdapi: Implement probe message parsing.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 40
+++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/tests/discovery.c | 4 ++--
2 files changed, 41 insertions(+), 3 deletions(-)
June 11, 2018
[PATCH 5/7] wsdapi: Return "any" headers in read_message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 40
++++++++++++++++++++++++++++++++++++++++
dlls/wsdapi/tests/discovery.c | 2 +-
2 files changed, 41 insertions(+), 1 deletion(-)
June 11, 2018
[PATCH 4/7] wsdapi: Add initial support for reading messages; identify Probe message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/soap.c | 388
+++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/tests/discovery.c | 6 +-
2 files changed, 389 insertions(+), 5 deletions(-)
June 11, 2018
[PATCH 3/7] wsdapi: Add stub for Probe message parsing, prepare notification sink message.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/network.c | 60
++++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/soap.c | 6 +++++
dlls/wsdapi/wsdapi_internal.h | 5 ++++
3 files changed, 70 insertions(+), 1 deletion(-)
June 11, 2018
[PATCH 2/7] wsdapi: Add critical section around notification sinks.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/discovery.c | 9 +++++++++
dlls/wsdapi/wsdapi_internal.h | 1 +
2 files changed, 10 insertions(+)
June 11, 2018
[PATCH 1/7] wsdapi: Add support for listening for UDP multicast broadcasts.
by Owen Rudge
v2: Returns HRESULT from functions where applicable, adds Probe message
body parsing to avoid leaving todo_wine statements in place.
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/network.c | 281
+++++++++++++++++++++++++++++++++++++++++-
dlls/wsdapi/wsdapi_internal.h | 4 +
2 files changed, 284 insertions(+), 1 deletion(-)
June 11, 2018
[PATCH] msxml3/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/msxml3/tests/domdoc.c | 24 ++++++++++++------------
dlls/msxml3/tests/httpreq.c | 4 ++--
dlls/msxml3/tests/saxreader.c | 32 ++++++++++++++++----------------
dlls/msxml3/tests/schema.c | 2 +-
4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 23c17ea978..d5f30fec62 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -102,7 +102,7 @@ static void get_class_support_data(struct msxmlsupported_data_t *table)
HRESULT hr;
int i;
- for (i = 0; i < sizeof(table->ifaces)/sizeof(table->ifaces[0]) && table->ifaces[i] != NULL; i++)
+ for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] != NULL; i++)
{
hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER, table->ifaces[i], (void**)&unk);
if (hr == S_OK) IUnknown_Release(unk);
@@ -124,7 +124,7 @@ static BOOL is_clsid_supported(const GUID *clsid, REFIID riid)
{
int i;
- for (i = 0; i < sizeof(table->ifaces)/sizeof(table->ifaces[0]) && table->ifaces[i] != NULL; i++)
+ for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] != NULL; i++)
if (table->ifaces[i] == riid) return table->supported[i];
}
@@ -1238,7 +1238,7 @@ static int alloced_bstrs_count;
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
@@ -10834,13 +10834,13 @@ static void test_mxnamespacemanager_override(void)
&IID_IMXNamespaceManager, (void**)&nsmgr);
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, E_FAIL);
@@ -10859,7 +10859,7 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getURI(nsmgr, _bstr_(""), NULL, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -10868,19 +10868,19 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns0"), _bstr_("ns0 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 0, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("xml")), "got prefix %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("ns0")), "got prefix %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 2, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -10890,7 +10890,7 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, _bstr_("ns1"), _bstr_("ns1 uri"));
EXPECT_HR(hr, S_OK);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 1, buffW, &len);
EXPECT_HR(hr, S_OK);
@@ -10911,13 +10911,13 @@ static void test_mxnamespacemanager_override(void)
hr = IMXNamespaceManager_declarePrefix(nsmgr, NULL, _bstr_("ns0 uri override"));
EXPECT_HR(hr, S_FALSE);
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getURI(nsmgr, _bstr_(""), NULL, buffW, &len);
EXPECT_HR(hr, S_OK);
ok(!lstrcmpW(buffW, _bstr_("ns0 uri override")), "got uri %s\n", wine_dbgstr_w(buffW));
- len = sizeof(buffW)/sizeof(WCHAR);
+ len = ARRAY_SIZE(buffW);
buffW[0] = 0;
hr = IMXNamespaceManager_getDeclaredPrefix(nsmgr, 3, buffW, &len);
EXPECT_HR(hr, S_OK);
diff --git a/dlls/msxml3/tests/httpreq.c b/dlls/msxml3/tests/httpreq.c
index f20f18fb63..ae0a95a2f1 100644
--- a/dlls/msxml3/tests/httpreq.c
+++ b/dlls/msxml3/tests/httpreq.c
@@ -97,7 +97,7 @@ static int g_unexpectedcall, g_expectedcall;
static int strcmp_wa(const WCHAR *strw, const char *stra)
{
WCHAR buf[512];
- MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf));
return lstrcmpW(strw, buf);
}
@@ -117,7 +117,7 @@ static BSTR _bstr_(const char *str)
if(!str)
return NULL;
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index 3ed332edb6..eeef5b64c1 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -90,7 +90,7 @@ static int alloced_bstrs_count;
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
@@ -144,7 +144,7 @@ static void test_saxstr(const char *file, unsigned line, BSTR str, const char *e
/* exit earlier on length mismatch */
if (lenexp != len) return;
- MultiByteToWideChar(CP_ACP, 0, expected, -1, buf, sizeof(buf)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, expected, -1, buf, ARRAY_SIZE(buf));
cmp = memcmp(str, buf, lenexp*sizeof(WCHAR));
if (cmp && todo)
@@ -2952,7 +2952,7 @@ static void test_mxwriter_handlers(void)
EXPECT_REF(writer, 1);
- for (i = 0; i < sizeof(riids)/sizeof(REFIID); i++)
+ for (i = 0; i < ARRAY_SIZE(riids); i++)
{
IUnknown *handler;
IMXWriter *writer2;
@@ -3976,7 +3976,7 @@ static void test_mxwriter_characters(void)
hr = ISAXContentHandler_characters(content, chardataW, 0);
EXPECT_HR(hr, S_OK);
- hr = ISAXContentHandler_characters(content, chardataW, sizeof(chardataW)/sizeof(WCHAR) - 1);
+ hr = ISAXContentHandler_characters(content, chardataW, ARRAY_SIZE(chardataW) - 1);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4166,7 +4166,7 @@ static void test_mxwriter_stream(void)
IStream *stream;
LARGE_INTEGER pos;
ULARGE_INTEGER pos2;
- DWORD test_count = sizeof(mxwriter_stream_tests)/sizeof(mxwriter_stream_tests[0]);
+ DWORD test_count = ARRAY_SIZE(mxwriter_stream_tests);
for(current_stream_test_index = 0; current_stream_test_index < test_count; ++current_stream_test_index) {
const mxwriter_stream_test *test = mxwriter_stream_tests+current_stream_test_index;
@@ -4640,7 +4640,7 @@ static void test_mxwriter_comment(void)
ok(!lstrcmpW(_bstr_("<!---->\r\n"), V_BSTR(&dest)), "got wrong content %s\n", wine_dbgstr_w(V_BSTR(&dest)));
VariantClear(&dest);
- hr = ISAXLexicalHandler_comment(lexical, commentW, sizeof(commentW)/sizeof(WCHAR)-1);
+ hr = ISAXLexicalHandler_comment(lexical, commentW, ARRAY_SIZE(commentW) - 1);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4865,16 +4865,16 @@ static void test_mxwriter_dtd(void)
hr = IVBSAXLexicalHandler_startDTD(vblexical, NULL, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, sizeof(pubW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, NULL, 0, sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, sizeof(pubW)/sizeof(WCHAR), sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, NULL, 0, pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR), NULL, 0, NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), NULL, 0, NULL, 0);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4885,11 +4885,11 @@ static void test_mxwriter_dtd(void)
VariantClear(&dest);
/* system id is required if public is present */
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR), pubW, sizeof(pubW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW), pubW, ARRAY_SIZE(pubW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXLexicalHandler_startDTD(lexical, nameW, sizeof(nameW)/sizeof(WCHAR),
- pubW, sizeof(pubW)/sizeof(WCHAR), sysW, sizeof(sysW)/sizeof(WCHAR));
+ hr = ISAXLexicalHandler_startDTD(lexical, nameW, ARRAY_SIZE(nameW),
+ pubW, ARRAY_SIZE(pubW), sysW, ARRAY_SIZE(sysW));
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4926,10 +4926,10 @@ static void test_mxwriter_dtd(void)
hr = IVBSAXDeclHandler_elementDecl(vbdecl, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), NULL, 0);
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), NULL, 0);
EXPECT_HR(hr, E_INVALIDARG);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), contentW, sizeof(contentW)/sizeof(WCHAR));
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, ARRAY_SIZE(contentW));
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
@@ -4944,7 +4944,7 @@ static void test_mxwriter_dtd(void)
hr = IMXWriter_put_output(writer, dest);
EXPECT_HR(hr, S_OK);
- hr = ISAXDeclHandler_elementDecl(decl, nameW, sizeof(nameW)/sizeof(WCHAR), contentW, 0);
+ hr = ISAXDeclHandler_elementDecl(decl, nameW, ARRAY_SIZE(nameW), contentW, 0);
EXPECT_HR(hr, S_OK);
V_VT(&dest) = VT_EMPTY;
diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c
index 48d1c5bce4..9e5116f38f 100644
--- a/dlls/msxml3/tests/schema.c
+++ b/dlls/msxml3/tests/schema.c
@@ -452,7 +452,7 @@ static BSTR alloc_str_from_narrow(const char *str)
static BSTR _bstr_(const char *str)
{
- assert(alloced_bstrs_count < sizeof(alloced_bstrs)/sizeof(alloced_bstrs[0]));
+ assert(alloced_bstrs_count < ARRAY_SIZE(alloced_bstrs));
alloced_bstrs[alloced_bstrs_count] = alloc_str_from_narrow(str);
return alloced_bstrs[alloced_bstrs_count++];
}
--
2.14.4
June 11, 2018
[PATCH] winhttp/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/winhttp/tests/notification.c | 20 ++++++++++----------
dlls/winhttp/tests/winhttp.c | 24 ++++++++++++------------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index 2a647e3633..086f2e7935 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -187,7 +187,7 @@ static void test_connection_cache( void )
struct info info, *context = &info;
info.test = cache_test;
- info.count = sizeof(cache_test) / sizeof(cache_test[0]);
+ info.count = ARRAY_SIZE( cache_test );
info.index = 0;
info.wait = CreateEventW( NULL, FALSE, FALSE, NULL );
@@ -427,7 +427,7 @@ static void test_redirect( void )
struct info info, *context = &info;
info.test = redirect_test;
- info.count = sizeof(redirect_test) / sizeof(redirect_test[0]);
+ info.count = ARRAY_SIZE( redirect_test );
info.index = 0;
info.wait = CreateEventW( NULL, FALSE, FALSE, NULL );
@@ -508,7 +508,7 @@ static void test_async( void )
char buffer[1024];
info.test = async_test;
- info.count = sizeof(async_test) / sizeof(async_test[0]);
+ info.count = ARRAY_SIZE( async_test );
info.index = 0;
info.wait = CreateEventW( NULL, FALSE, FALSE, NULL );
@@ -779,12 +779,12 @@ static void open_async_request(int port, struct test_request *req, struct info *
if (reuse_connection)
{
info->test = reuse_socket_request_test;
- info->count = sizeof(reuse_socket_request_test) / sizeof(reuse_socket_request_test[0]);
+ info->count = ARRAY_SIZE( reuse_socket_request_test );
}
else
{
info->test = open_socket_request_test;
- info->count = sizeof(open_socket_request_test) / sizeof(open_socket_request_test[0]);
+ info->count = ARRAY_SIZE( open_socket_request_test );
}
req->session = WinHttpOpen( user_agent, 0, NULL, NULL, WINHTTP_FLAG_ASYNC );
@@ -830,7 +830,7 @@ static void server_send_reply(struct test_request *req, struct info *info, const
WaitForSingleObject( info->wait, INFINITE );
info->test = server_reply_test;
- info->count = sizeof(server_reply_test) / sizeof(server_reply_test[0]);
+ info->count = ARRAY_SIZE( server_reply_test );
info->index = 0;
setup_test( info, winhttp_send_request, __LINE__ );
ret = WinHttpReceiveResponse( req->request, NULL );
@@ -879,12 +879,12 @@ static void close_request(struct test_request *req, struct info *info, BOOL allo
if (allow_closing_connection)
{
info->test = close_allow_connection_close_request_test;
- info->count = sizeof(close_allow_connection_close_request_test)/sizeof(*close_allow_connection_close_request_test);
+ info->count = ARRAY_SIZE( close_allow_connection_close_request_test );
}
else
{
info->test = close_request_test;
- info->count = sizeof(close_request_test)/sizeof(*close_request_test);
+ info->count = ARRAY_SIZE( close_request_test );
}
info->index = 0;
setup_test( info, winhttp_close_handle, __LINE__ );
@@ -926,12 +926,12 @@ static void _read_request_data(struct test_request *req, struct info *info, cons
if (closing_connection)
{
info->test = read_allow_close_test;
- info->count = sizeof(read_allow_close_test)/sizeof(*read_allow_close_test);
+ info->count = ARRAY_SIZE( read_allow_close_test );
}
else
{
info->test = read_test;
- info->count = sizeof(read_test)/sizeof(*read_test);
+ info->count = ARRAY_SIZE( read_test );
}
info->index = 0;
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 4b4a84c5fc..46504e1b0c 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -2907,7 +2907,7 @@ static void test_not_modified(int port)
memcpy(today, ifmodifiedW, sizeof(ifmodifiedW));
GetSystemTime(&st);
- WinHttpTimeFromSystemTime(&st, &today[sizeof(ifmodifiedW)/sizeof(WCHAR)]);
+ WinHttpTimeFromSystemTime(&st, &today[ARRAY_SIZE(ifmodifiedW)]);
session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY,
WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
@@ -3277,13 +3277,13 @@ static void test_credentials(void)
req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
ok(req != NULL, "failed to open a request %u\n", GetLastError());
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_USERNAME, &buffer, &size);
ok(ret, "failed to query proxy username %u\n", GetLastError());
ok(!buffer[0], "unexpected result %s\n", wine_dbgstr_w(buffer));
ok(!size, "expected 0, got %u\n", size);
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_PASSWORD, &buffer, &size);
ok(ret, "failed to query proxy password %u\n", GetLastError());
ok(!buffer[0], "unexpected result %s\n", wine_dbgstr_w(buffer));
@@ -3292,19 +3292,19 @@ static void test_credentials(void)
ret = WinHttpSetOption(req, WINHTTP_OPTION_PROXY_USERNAME, proxy_userW, lstrlenW(proxy_userW));
ok(ret, "failed to set username %u\n", GetLastError());
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_USERNAME, &buffer, &size);
ok(ret, "failed to query proxy username %u\n", GetLastError());
ok(!winetest_strcmpW(buffer, proxy_userW), "unexpected result %s\n", wine_dbgstr_w(buffer));
ok(size == lstrlenW(proxy_userW) * sizeof(WCHAR), "unexpected result %u\n", size);
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_USERNAME, &buffer, &size);
ok(ret, "failed to query username %u\n", GetLastError());
ok(!buffer[0], "unexpected result %s\n", wine_dbgstr_w(buffer));
ok(!size, "expected 0, got %u\n", size);
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PASSWORD, &buffer, &size);
ok(ret, "failed to query password %u\n", GetLastError());
ok(!buffer[0], "unexpected result %s\n", wine_dbgstr_w(buffer));
@@ -3313,7 +3313,7 @@ static void test_credentials(void)
ret = WinHttpSetOption(req, WINHTTP_OPTION_PROXY_PASSWORD, proxy_passW, lstrlenW(proxy_passW));
ok(ret, "failed to set proxy password %u\n", GetLastError());
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PROXY_PASSWORD, &buffer, &size);
ok(ret, "failed to query proxy password %u\n", GetLastError());
ok(!winetest_strcmpW(buffer, proxy_passW), "unexpected result %s\n", wine_dbgstr_w(buffer));
@@ -3322,7 +3322,7 @@ static void test_credentials(void)
ret = WinHttpSetOption(req, WINHTTP_OPTION_USERNAME, userW, lstrlenW(userW));
ok(ret, "failed to set username %u\n", GetLastError());
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_USERNAME, &buffer, &size);
ok(ret, "failed to query username %u\n", GetLastError());
ok(!winetest_strcmpW(buffer, userW), "unexpected result %s\n", wine_dbgstr_w(buffer));
@@ -3331,7 +3331,7 @@ static void test_credentials(void)
ret = WinHttpSetOption(req, WINHTTP_OPTION_PASSWORD, passW, lstrlenW(passW));
ok(ret, "failed to set password %u\n", GetLastError());
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PASSWORD, &buffer, &size);
ok(ret, "failed to query password %u\n", GetLastError());
ok(!winetest_strcmpW(buffer, passW), "unexpected result %s\n", wine_dbgstr_w(buffer));
@@ -3357,7 +3357,7 @@ static void test_credentials(void)
ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, userW, passW, NULL);
ok(ret, "failed to set credentials %u\n", GetLastError());
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_USERNAME, &buffer, &size);
ok(ret, "failed to query username %u\n", GetLastError());
todo_wine {
@@ -3365,7 +3365,7 @@ static void test_credentials(void)
ok(!size, "expected 0, got %u\n", size);
}
- size = sizeof(buffer)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buffer);
ret = WinHttpQueryOption(req, WINHTTP_OPTION_PASSWORD, &buffer, &size);
ok(ret, "failed to query password %u\n", GetLastError());
todo_wine {
@@ -3920,7 +3920,7 @@ static void test_IWinHttpRequest(int port)
ok( hr == S_OK, "got %08x\n", hr );
sprintf( buf, "http://localhost:%d/auth", port );
- MultiByteToWideChar( CP_ACP, 0, buf, -1, bufW, sizeof(bufW)/sizeof(bufW[0]) );
+ MultiByteToWideChar( CP_ACP, 0, buf, -1, bufW, ARRAY_SIZE( bufW ));
url = SysAllocString( bufW );
method = SysAllocString( method3W );
V_VT( &async ) = VT_BOOL;
--
2.14.4
June 11, 2018
Re: [PATCH 1/3] msvcrt: Add _crt_at_quick_exit stub
by Piotr Caban
On 06/11/18 23:02, Fabian Maurer wrote:
> Hi Piotr,
>
> > The func argument should probably use CDECL calling convention (not that
>
> > it really matters in case of no-arguments function).
>
> I did it like MSVCRT__crt_atexit did it, first pass the func like this
> and then cast to MSVCRT__onexit_t. Should I make it MSVCRT__onexit_t
> right away?
I think it's better to keep function header the same as in native. Could
you please also change MSVCRT__crt_atexit header while you're at it?
Thanks,
Piotr
June 11, 2018
Re: [PATCH 3/3] msvcrt: Implement quick_exit and _crt_at_quick_exit
by Piotr Caban
Hi,
On 06/05/18 22:42, Fabian Maurer wrote:
> Code taken from onexit logic and adapted-
Why don't you just call onexit functions instead of reimplementing it?
Note that you don't need to call MSVCRT__initialize_onexit_table when
quick_exit table is declared static.
Thanks,
Piotr
June 11, 2018
Re: [PATCH 2/3] msvcrt: Add quick_exit
by Piotr Caban
Hi,
On 06/05/18 22:42, Fabian Maurer wrote:
> +/*********************************************************************
> + * quick_exit (MSVCRT.@)
> + */
> +void CDECL MSVCRT_quick_exit(int exitcode)
> +{
> + FIXME("partial stub: (%d)\n", exitcode);
> + MSVCRT__exit(exitcode);
> +}
quick_exit function should not call exit. I'm attaching a test that
shows that atexit callbacks should not be called.
Thanks,
Piotr
June 11, 2018
Re: [PATCH 1/3] msvcrt: Add _crt_at_quick_exit stub
by Fabian Maurer
Hi Piotr,
> The func argument should probably use CDECL calling convention (not that
> it really matters in case of no-arguments function).
I did it like MSVCRT__crt_atexit did it, first pass the func like this and then cast to
MSVCRT__onexit_t. Should I make it MSVCRT__onexit_t right away?
> Also it's probably better to return -1 (error) in stub.
Sure can do, although it doesn't matter too much since I later replace it anyways.
Regards,
Fabian Maurer
June 11, 2018
Re: [PATCH 4/5] msvcrt: Avoid using inline assembly in call_unwind_func().
by Zebediah Figura
On 06/11/2018 11:48 AM, Piotr Caban wrote:
> Hi Zeb,
>
> On 06/05/18 00:23, Zebediah Figura wrote:
>> +extern int call_unwind_func( int (*func)(void), void *ebp );
>> +
>> +__ASM_GLOBAL_FUNC( call_unwind_func,
>> + "pushl %ebp\n\t"
>> + "pushl %ebx\n\t"
>> + "pushl %esi\n\t"
>> + "pushl %edi\n\t"
>> + "movl 24(%esp), %ebp\n\t"
>> + "call *20(%esp)\n\t"
>> + "popl %edi\n\t"
>> + "popl %esi\n\t"
>> + "popl %ebx\n\t"
>> + "popl %ebp\n\t"
>> + "ret" );
>
> How about renaming the function to call_handler and returning void* from
> it? It looks strange that in all places where return value is used we
> need to cast it to pointer.
>
> Thanks,
> Piotr
Thanks; I'll send an updated patch.
June 11, 2018
Re: [PATCH 1/3] msvcrt: Add _crt_at_quick_exit stub
by Piotr Caban
Hi Fabian,
On 06/05/18 22:42, Fabian Maurer wrote:
> +/*********************************************************************
> + * _crt_at_quick_exit (UCRTBASE.@)
> + */
> +int CDECL MSVCRT__crt_at_quick_exit(void (*func)(void))
> +{
> + FIXME("stub: (%p)\n", func);
> + return 0;
> +}
The func argument should probably use CDECL calling convention (not that
it really matters in case of no-arguments function). Also it's probably
better to return -1 (error) in stub.
Thanks,
Piotr
June 11, 2018
Re: [PATCH] vcomp/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
I already sent this patch in as 146709.
It is pending Sebastian's signed off.
bye
michael
On 06/11/2018 09:33 PM, André Hentschel wrote:
> Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
> ---
> dlls/vcomp/tests/vcomp.c | 56 ++++++++++++++++++++++++------------------------
> 1 file changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
> index 154744b..ea62909 100644
> --- a/dlls/vcomp/tests/vcomp.c
> +++ b/dlls/vcomp/tests/vcomp.c
> @@ -766,7 +766,7 @@ static void CDECL for_static_simple_cb(void)
> int thread_num = pomp_get_thread_num();
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> unsigned int my_begin, my_end, begin, end;
>
> @@ -966,7 +966,7 @@ static void CDECL for_static_cb(void)
> int thread_num = pomp_get_thread_num();
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> int my_begin, my_end, my_next, my_lastchunk;
> int begin, end, next, lastchunk;
> @@ -1614,25 +1614,25 @@ static void test_atomic_integer8(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests1); i++)
> {
> char val = tests1[i].v1;
> tests1[i].func(&val, tests1[i].v2);
> ok(val == tests1[i].expected, "test %d: expected val == %d, got %d\n", i, tests1[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests2); i++)
> {
> char val = tests2[i].v1;
> tests2[i].func(&val, tests2[i].v2);
> ok(val == tests2[i].expected, "test %d: expected val == %d, got %d\n", i, tests2[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests3)/sizeof(tests3[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests3); i++)
> {
> unsigned char val = tests3[i].v1;
> tests3[i].func(&val, tests3[i].v2);
> ok(val == tests3[i].expected, "test %d: expected val == %u, got %u\n", i, tests3[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests4)/sizeof(tests4[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests4); i++)
> {
> unsigned char val = tests4[i].v1;
> tests4[i].func(&val, tests4[i].v2);
> @@ -1707,25 +1707,25 @@ static void test_atomic_integer16(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests1); i++)
> {
> short val = tests1[i].v1;
> tests1[i].func(&val, tests1[i].v2);
> ok(val == tests1[i].expected, "test %d: expected val == %d, got %d\n", i, tests1[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests2); i++)
> {
> short val = tests2[i].v1;
> tests2[i].func(&val, tests2[i].v2);
> ok(val == tests2[i].expected, "test %d: expected val == %d, got %d\n", i, tests2[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests3)/sizeof(tests3[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests3); i++)
> {
> unsigned short val = tests3[i].v1;
> tests3[i].func(&val, tests3[i].v2);
> ok(val == tests3[i].expected, "test %d: expected val == %u, got %u\n", i, tests3[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests4)/sizeof(tests4[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests4); i++)
> {
> unsigned short val = tests4[i].v1;
> tests4[i].func(&val, tests4[i].v2);
> @@ -1777,13 +1777,13 @@ static void test_atomic_integer32(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests1); i++)
> {
> int val = tests1[i].v1;
> tests1[i].func(&val, tests1[i].v2);
> ok(val == tests1[i].expected, "test %d: expected val == %d, got %d\n", i, tests1[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests2); i++)
> {
> unsigned int val = tests2[i].v1;
> tests2[i].func(&val, tests2[i].v2);
> @@ -1871,26 +1871,26 @@ static void test_atomic_integer64(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests1); i++)
> {
> LONG64 val = tests1[i].v1;
> tests1[i].func(&val, tests1[i].v2);
> ok(val == tests1[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
> }
> - for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests2); i++)
> {
> LONG64 val = tests2[i].v1;
> tests2[i].func(&val, tests2[i].v2);
> todo_wine_if(tests2[i].todo)
> ok(val == tests2[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
> }
> - for (i = 0; i < sizeof(tests3)/sizeof(tests3[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests3); i++)
> {
> ULONG64 val = tests3[i].v1;
> tests3[i].func(&val, tests3[i].v2);
> ok(val == tests3[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
> }
> - for (i = 0; i < sizeof(tests4)/sizeof(tests4[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests4); i++)
> {
> ULONG64 val = tests4[i].v1;
> tests4[i].func(&val, tests4[i].v2);
> @@ -1915,7 +1915,7 @@ static void test_atomic_float(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> float val = tests[i].v1;
> tests[i].func(&val, tests[i].v2);
> @@ -1940,7 +1940,7 @@ static void test_atomic_double(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> double val = tests[i].v1;
> tests[i].func(&val, tests[i].v2);
> @@ -1978,13 +1978,13 @@ static void test_reduction_integer8(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> char val = tests[i].v1;
> p_vcomp_reduction_i1(tests[i].flags, &val, tests[i].v2);
> ok(val == tests[i].expected, "test %d: expected val == %d, got %d\n", i, tests[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> unsigned char val = tests[i].v1;
> p_vcomp_reduction_u1(tests[i].flags, &val, tests[i].v2);
> @@ -2022,13 +2022,13 @@ static void test_reduction_integer16(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> short val = tests[i].v1;
> p_vcomp_reduction_i2(tests[i].flags, &val, tests[i].v2);
> ok(val == tests[i].expected, "test %d: expected val == %d, got %d\n", i, tests[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> unsigned short val = tests[i].v1;
> p_vcomp_reduction_u2(tests[i].flags, &val, tests[i].v2);
> @@ -2105,13 +2105,13 @@ static void test_reduction_integer32(void)
>
> pomp_set_num_threads(max_threads);
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> int val = tests[i].v1;
> p_vcomp_reduction_i4(tests[i].flags, &val, tests[i].v2);
> ok(val == tests[i].expected, "test %d: expected val == %d, got %d\n", i, tests[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> unsigned int val = tests[i].v1;
> p_vcomp_reduction_u4(tests[i].flags, &val, tests[i].v2);
> @@ -2148,13 +2148,13 @@ static void test_reduction_integer64(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> LONG64 val = tests[i].v1;
> p_vcomp_reduction_i8(tests[i].flags, &val, tests[i].v2);
> ok(val == tests[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
> }
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> ULONG64 val = tests[i].v1;
> p_vcomp_reduction_u8(tests[i].flags, &val, tests[i].v2);
> @@ -2206,14 +2206,14 @@ static void test_reduction_float_double(void)
> };
> int i;
>
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> float val = tests[i].v1;
> p_vcomp_reduction_r4(tests[i].flags, &val, tests[i].v2);
> ok(tests[i].expected - 0.001 < val && val < tests[i].expected + 0.001,
> "test %d: expected val == %f, got %f\n", i, tests[i].expected, val);
> }
> - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
> + for (i = 0; i < ARRAY_SIZE(tests); i++)
> {
> double val = tests[i].v1;
> p_vcomp_reduction_r8(tests[i].flags, &val, tests[i].v2);
>
June 11, 2018
Re: [PATCH] ws2_32/tests: Use the available ARRAY_SIZE() macro
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39073
Your paranoid android.
=== w7u (32 bit sock) ===
sock.c:10956: Test failed: got 0
sock.c:10957: Test failed: got 00000000
sock.c:10958: Test failed: got 0000
sock.c:10959: Test failed: got 00000000
sock.c:10960: Test failed: got 00000000
sock.c:10970: Test failed: got 0464,000002f4,00000002
=== w1064 (64 bit sock) ===
sock.c:8629: Test failed: bytesReturned isn't supposed to be 1
sock.c:8653: Test failed: GetOverlappedResult failed, error 0
June 11, 2018
[PATCH] ws2_32/tests: Use the available ARRAY_SIZE() macro
by André Hentschel
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
---
dlls/ws2_32/tests/protocol.c | 4 +--
dlls/ws2_32/tests/sock.c | 58 +++++++++++++++++++++-----------------------
2 files changed, 30 insertions(+), 32 deletions(-)
diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c
index 9c6d80d..99bd137 100644
--- a/dlls/ws2_32/tests/protocol.c
+++ b/dlls/ws2_32/tests/protocol.c
@@ -113,7 +113,7 @@ static void test_WSAEnumProtocolsA(void)
ok( ret >= 2, "Expected at least 2 items, received %d\n", ret);
for (i = found = 0; i < ret; i++)
- for (j = 0; j < sizeof(ptest) / sizeof(ptest[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(ptest); j++)
if (buffer[i].iProtocol == ptest[j])
{
found |= 1 << j;
@@ -180,7 +180,7 @@ static void test_WSAEnumProtocolsW(void)
ok( ret >= 2, "Expected at least 2 items, received %d\n", ret);
for (i = found = 0; i < ret; i++)
- for (j = 0; j < sizeof(ptest) / sizeof(ptest[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(ptest); j++)
if (buffer[i].iProtocol == ptest[j])
{
found |= 1 << j;
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 6dd1491..b32d1c0 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1191,7 +1191,7 @@ static void test_WithWSAStartup(void)
ok(ptr != NULL, "gethostbyname() failed unexpectedly: %d\n", WSAGetLastError());
/* Alloc some sockets to check if they are destroyed on WSACleanup */
- for (socks = 0; socks < sizeof(pairs) / sizeof(pairs[0]); socks++)
+ for (socks = 0; socks < ARRAY_SIZE(pairs); socks++)
{
WSAPROTOCOL_INFOA info;
if (tcp_socketpair(&pairs[socks].src, &pairs[socks].dst)) break;
@@ -1471,7 +1471,7 @@ static void test_set_getsockopt(void)
todo_wine ok( value == 4096, "expected 4096, got %u\n", value );
/* SO_LINGER */
- for( i = 0; i < sizeof(linger_testvals)/sizeof(LINGER);i++) {
+ for( i = 0; i < ARRAY_SIZE(linger_testvals);i++) {
size = sizeof(lingval);
lingval = linger_testvals[i];
err = setsockopt(s, SOL_SOCKET, SO_LINGER, (char *) &lingval, size);
@@ -1630,7 +1630,7 @@ todo_wine
closesocket(s);
/* test SO_PROTOCOL_INFO structure returned for different protocols */
- for (i = 0; i < sizeof(prottest) / sizeof(prottest[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(prottest); i++)
{
int k;
@@ -2083,7 +2083,7 @@ static void test_ip_pktinfo(void)
/* Note: hdr.Control.len is set below */
hdr.dwFlags = 0;
- for (i=0;i<sizeof(addresses)/sizeof(UINT32);i++)
+ for (i=0;i<ARRAY_SIZE(addresses);i++)
{
s1addr.sin_addr.s_addr = addresses[i];
@@ -2689,7 +2689,7 @@ static void test_WSASocket(void)
/* when no socket type is specified the first entry from WSAEnumProtocols
* that matches the protocol is returned */
- for (i = 0; i < sizeof(autoprotocols) / sizeof(autoprotocols[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(autoprotocols); i++)
{
sock = WSASocketA(0, 0, autoprotocols[i], NULL, 0, 0);
ok(sock != INVALID_SOCKET, "Failed to create socket for protocol %d, received %d\n",
@@ -3010,7 +3010,7 @@ static void test_WSAEnumNetworkEvents(void)
/* This test follows the steps from bugs 10204 and 24946 */
for (l = 0; l < 2; l++)
{
- for (i = 0; i < sizeof(sock_type) / sizeof(sock_type[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(sock_type); i++)
{
if (i == 2)
ok(!tcp_socketpair(&s, &s2), "Test[%d]: creating socket pair failed\n", i);
@@ -3280,7 +3280,7 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address, expect1 ), "Expected different address string\n" );
- ok( len == sizeof( expect1 )/sizeof( WCHAR ), "Got size %d\n", len);
+ ok( len == ARRAY_SIZE(expect1), "Got size %d\n", len);
len = sizeof(address);
@@ -3314,7 +3314,7 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address, expect4 ), "Expected different address string\n" );
- ok( len == sizeof( expect4 )/sizeof( WCHAR ), "Got %d\n", len);
+ ok( len == ARRAY_SIZE(expect4), "Got %d\n", len);
/*check to see it IPv6 is available */
v6 = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP);
@@ -3325,7 +3325,7 @@ static void test_WSAAddressToStringW(void)
}
/* Test a short IPv6 address */
- len = sizeof(address6)/sizeof(WCHAR);
+ len = ARRAY_SIZE(address6);
sockaddr6.sin6_family = AF_INET6;
sockaddr6.sin6_port = 0x0000;
@@ -3335,10 +3335,10 @@ static void test_WSAAddressToStringW(void)
ret = WSAAddressToStringW( (SOCKADDR*)&sockaddr6, sizeof(sockaddr6), NULL, address6, &len );
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address6, expect6_1 ), "Wrong string returned\n" );
- ok( len == sizeof(expect6_1)/sizeof(WCHAR), "Got %d\n", len);
+ ok( len == ARRAY_SIZE(expect6_1), "Got %d\n", len);
/* Test a longer IPv6 address */
- len = sizeof(address6)/sizeof(WCHAR);
+ len = ARRAY_SIZE(address6);
sockaddr6.sin6_family = AF_INET6;
sockaddr6.sin6_port = 0x0000;
@@ -3349,10 +3349,10 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address6, expect6_2 ), "Wrong string returned\n" );
- ok( len == sizeof(expect6_2)/sizeof(WCHAR), "Got %d\n", len);
+ ok( len == ARRAY_SIZE(expect6_2), "Got %d\n", len);
/* Test IPv6 address and port number */
- len = sizeof(address6)/sizeof(WCHAR);
+ len = ARRAY_SIZE(address6);
sockaddr6.sin6_family = AF_INET6;
sockaddr6.sin6_port = 0xfa81;
@@ -3363,10 +3363,10 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address6, expect6_3 ),
"Expected: %s, got: %s\n", wine_dbgstr_w(expect6_3), wine_dbgstr_w(address6) );
- ok( len == sizeof(expect6_3)/sizeof(WCHAR), "Got %d\n", len );
+ ok( len == ARRAY_SIZE(expect6_3), "Got %d\n", len );
/* Test IPv6 address, port number and scope_id */
- len = sizeof(address6)/sizeof(WCHAR);
+ len = ARRAY_SIZE(address6);
sockaddr6.sin6_family = AF_INET6;
sockaddr6.sin6_port = 0xfa81;
@@ -3377,10 +3377,10 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address6, expect6_3_2 ),
"Expected: %s, got: %s\n", wine_dbgstr_w(expect6_3_2), wine_dbgstr_w(address6) );
- ok( len == sizeof(expect6_3_2)/sizeof(WCHAR), "Got %d\n", len );
+ ok( len == ARRAY_SIZE(expect6_3_2), "Got %d\n", len );
/* Test IPv6 address and scope_id */
- len = sizeof(address6)/sizeof(WCHAR);
+ len = ARRAY_SIZE(address6);
sockaddr6.sin6_family = AF_INET6;
sockaddr6.sin6_port = 0x0000;
@@ -3391,7 +3391,7 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address6, expect6_3_3 ),
"Expected: %s, got: %s\n", wine_dbgstr_w(expect6_3_3), wine_dbgstr_w(address6) );
- ok( len == sizeof(expect6_3_3)/sizeof(WCHAR), "Got %d\n", len );
+ ok( len == ARRAY_SIZE(expect6_3_3), "Got %d\n", len );
end:
if (v6 != INVALID_SOCKET)
@@ -5112,7 +5112,7 @@ static void test_inet_pton(void)
return;
}
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
WSASetLastError(0xdeadbeef);
ret = pInetPtonA(tests[i].family, tests[i].printable, buffer);
@@ -5137,11 +5137,10 @@ static void test_inet_pton(void)
i, tests[i].collapsed, ptr);
}
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
if (tests[i].printable)
- MultiByteToWideChar(CP_ACP, 0, tests[i].printable, -1, printableW,
- sizeof(printableW) / sizeof(printableW[0]));
+ MultiByteToWideChar(CP_ACP, 0, tests[i].printable, -1, printableW, ARRAY_SIZE(printableW));
WSASetLastError(0xdeadbeef);
ret = pInetPtonW(tests[i].family, tests[i].printable ? printableW : NULL, buffer);
ok(ret == tests[i].ret, "Test [%d]: Expected %d, got %d\n", i, tests[i].ret, ret);
@@ -5157,13 +5156,12 @@ static void test_inet_pton(void)
/* Test the result from Pton with Ntop */
printableW[0] = 0xdead;
- ptrW = pInetNtopW(tests[i].family, buffer, printableW, sizeof(printableW) / sizeof(printableW[0]));
+ ptrW = pInetNtopW(tests[i].family, buffer, printableW, ARRAY_SIZE(printableW));
ok (ptrW != NULL, "Test [%d]: Failed with NULL\n", i);
ok (ptrW == printableW, "Test [%d]: Pointers differ (%p != %p)\n", i, ptrW, printableW);
if (!ptrW) continue;
- MultiByteToWideChar(CP_ACP, 0, tests[i].collapsed, -1, collapsedW,
- sizeof(collapsedW) / sizeof(collapsedW[0]));
+ MultiByteToWideChar(CP_ACP, 0, tests[i].collapsed, -1, collapsedW, ARRAY_SIZE(collapsedW));
ok (lstrcmpW(ptrW, collapsedW) == 0, "Test [%d]: Expected '%s', got '%s'\n",
i, tests[i].collapsed, wine_dbgstr_w(ptrW));
}
@@ -5189,7 +5187,7 @@ static void test_ioctlsocket(void)
return;
}
- for(i = 0; i < sizeof(cmds)/sizeof(cmds[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(cmds); i++)
{
/* broken apps like defcon pass the argp value directly instead of a pointer to it */
ret = ioctlsocket(sock, cmds[i], (u_long *)1);
@@ -7345,7 +7343,7 @@ static void test_GetAddrInfoW(void)
int i, ret;
ADDRINFOW *result, *result2, *p, hint;
WCHAR name[256];
- DWORD size = sizeof(name)/sizeof(WCHAR);
+ DWORD size = ARRAY_SIZE(name);
/* te su to.winehq.org written in katakana */
static const WCHAR idn_domain[] =
{0x30C6,0x30B9,0x30C8,'.','w','i','n','e','h','q','.','o','r','g',0};
@@ -7483,7 +7481,7 @@ static void test_GetAddrInfoW(void)
ok(WSAGetLastError() == WSAHOST_NOT_FOUND, "expected 11001, got %d\n", WSAGetLastError());
ok(result == NULL, "got %p\n", result);
- for (i = 0;i < (sizeof(hinttests) / sizeof(hinttests[0]));i++)
+ for (i = 0;i < (ARRAY_SIZE(hinttests));i++)
{
hint.ai_family = hinttests[i].family;
hint.ai_socktype = hinttests[i].socktype;
@@ -7939,7 +7937,7 @@ static void test_getaddrinfo(void)
hint.ai_flags = 0;
- for (i = 0;i < (sizeof(hinttests) / sizeof(hinttests[0]));i++)
+ for (i = 0;i < (ARRAY_SIZE(hinttests));i++)
{
hint.ai_family = hinttests[i].family;
hint.ai_socktype = hinttests[i].socktype;
@@ -11504,7 +11502,7 @@ START_TEST( sock )
test_ip_pktinfo();
test_extendedSocketOptions();
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
trace ( " **** STARTING TEST %d ****\n", i );
do_test ( &tests[i] );
--
2.7.4
June 11, 2018
[PATCH] vcomp/tests: Use the available ARRAY_SIZE() macro
by André Hentschel
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
---
dlls/vcomp/tests/vcomp.c | 56 ++++++++++++++++++++++++------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index 154744b..ea62909 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -766,7 +766,7 @@ static void CDECL for_static_simple_cb(void)
int thread_num = pomp_get_thread_num();
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
unsigned int my_begin, my_end, begin, end;
@@ -966,7 +966,7 @@ static void CDECL for_static_cb(void)
int thread_num = pomp_get_thread_num();
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
int my_begin, my_end, my_next, my_lastchunk;
int begin, end, next, lastchunk;
@@ -1614,25 +1614,25 @@ static void test_atomic_integer8(void)
};
int i;
- for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests1); i++)
{
char val = tests1[i].v1;
tests1[i].func(&val, tests1[i].v2);
ok(val == tests1[i].expected, "test %d: expected val == %d, got %d\n", i, tests1[i].expected, val);
}
- for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests2); i++)
{
char val = tests2[i].v1;
tests2[i].func(&val, tests2[i].v2);
ok(val == tests2[i].expected, "test %d: expected val == %d, got %d\n", i, tests2[i].expected, val);
}
- for (i = 0; i < sizeof(tests3)/sizeof(tests3[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests3); i++)
{
unsigned char val = tests3[i].v1;
tests3[i].func(&val, tests3[i].v2);
ok(val == tests3[i].expected, "test %d: expected val == %u, got %u\n", i, tests3[i].expected, val);
}
- for (i = 0; i < sizeof(tests4)/sizeof(tests4[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests4); i++)
{
unsigned char val = tests4[i].v1;
tests4[i].func(&val, tests4[i].v2);
@@ -1707,25 +1707,25 @@ static void test_atomic_integer16(void)
};
int i;
- for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests1); i++)
{
short val = tests1[i].v1;
tests1[i].func(&val, tests1[i].v2);
ok(val == tests1[i].expected, "test %d: expected val == %d, got %d\n", i, tests1[i].expected, val);
}
- for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests2); i++)
{
short val = tests2[i].v1;
tests2[i].func(&val, tests2[i].v2);
ok(val == tests2[i].expected, "test %d: expected val == %d, got %d\n", i, tests2[i].expected, val);
}
- for (i = 0; i < sizeof(tests3)/sizeof(tests3[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests3); i++)
{
unsigned short val = tests3[i].v1;
tests3[i].func(&val, tests3[i].v2);
ok(val == tests3[i].expected, "test %d: expected val == %u, got %u\n", i, tests3[i].expected, val);
}
- for (i = 0; i < sizeof(tests4)/sizeof(tests4[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests4); i++)
{
unsigned short val = tests4[i].v1;
tests4[i].func(&val, tests4[i].v2);
@@ -1777,13 +1777,13 @@ static void test_atomic_integer32(void)
};
int i;
- for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests1); i++)
{
int val = tests1[i].v1;
tests1[i].func(&val, tests1[i].v2);
ok(val == tests1[i].expected, "test %d: expected val == %d, got %d\n", i, tests1[i].expected, val);
}
- for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests2); i++)
{
unsigned int val = tests2[i].v1;
tests2[i].func(&val, tests2[i].v2);
@@ -1871,26 +1871,26 @@ static void test_atomic_integer64(void)
};
int i;
- for (i = 0; i < sizeof(tests1)/sizeof(tests1[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests1); i++)
{
LONG64 val = tests1[i].v1;
tests1[i].func(&val, tests1[i].v2);
ok(val == tests1[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
}
- for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests2); i++)
{
LONG64 val = tests2[i].v1;
tests2[i].func(&val, tests2[i].v2);
todo_wine_if(tests2[i].todo)
ok(val == tests2[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
}
- for (i = 0; i < sizeof(tests3)/sizeof(tests3[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests3); i++)
{
ULONG64 val = tests3[i].v1;
tests3[i].func(&val, tests3[i].v2);
ok(val == tests3[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
}
- for (i = 0; i < sizeof(tests4)/sizeof(tests4[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests4); i++)
{
ULONG64 val = tests4[i].v1;
tests4[i].func(&val, tests4[i].v2);
@@ -1915,7 +1915,7 @@ static void test_atomic_float(void)
};
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
float val = tests[i].v1;
tests[i].func(&val, tests[i].v2);
@@ -1940,7 +1940,7 @@ static void test_atomic_double(void)
};
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
double val = tests[i].v1;
tests[i].func(&val, tests[i].v2);
@@ -1978,13 +1978,13 @@ static void test_reduction_integer8(void)
};
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
char val = tests[i].v1;
p_vcomp_reduction_i1(tests[i].flags, &val, tests[i].v2);
ok(val == tests[i].expected, "test %d: expected val == %d, got %d\n", i, tests[i].expected, val);
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
unsigned char val = tests[i].v1;
p_vcomp_reduction_u1(tests[i].flags, &val, tests[i].v2);
@@ -2022,13 +2022,13 @@ static void test_reduction_integer16(void)
};
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
short val = tests[i].v1;
p_vcomp_reduction_i2(tests[i].flags, &val, tests[i].v2);
ok(val == tests[i].expected, "test %d: expected val == %d, got %d\n", i, tests[i].expected, val);
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
unsigned short val = tests[i].v1;
p_vcomp_reduction_u2(tests[i].flags, &val, tests[i].v2);
@@ -2105,13 +2105,13 @@ static void test_reduction_integer32(void)
pomp_set_num_threads(max_threads);
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
int val = tests[i].v1;
p_vcomp_reduction_i4(tests[i].flags, &val, tests[i].v2);
ok(val == tests[i].expected, "test %d: expected val == %d, got %d\n", i, tests[i].expected, val);
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
unsigned int val = tests[i].v1;
p_vcomp_reduction_u4(tests[i].flags, &val, tests[i].v2);
@@ -2148,13 +2148,13 @@ static void test_reduction_integer64(void)
};
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
LONG64 val = tests[i].v1;
p_vcomp_reduction_i8(tests[i].flags, &val, tests[i].v2);
ok(val == tests[i].expected, "test %d: unexpectedly got %s\n", i, wine_dbgstr_longlong(val));
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
ULONG64 val = tests[i].v1;
p_vcomp_reduction_u8(tests[i].flags, &val, tests[i].v2);
@@ -2206,14 +2206,14 @@ static void test_reduction_float_double(void)
};
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
float val = tests[i].v1;
p_vcomp_reduction_r4(tests[i].flags, &val, tests[i].v2);
ok(tests[i].expected - 0.001 < val && val < tests[i].expected + 0.001,
"test %d: expected val == %f, got %f\n", i, tests[i].expected, val);
}
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
double val = tests[i].v1;
p_vcomp_reduction_r8(tests[i].flags, &val, tests[i].v2);
--
2.7.4
June 11, 2018
[PATCH] advpack: Introduce ARRAY_SIZE() macro
by André Hentschel
Signed-off-by: André Hentschel <nerv(a)dawncrow.de>
---
dlls/advpack/advpack.c | 18 ++++++------------
dlls/advpack/advpack_private.h | 2 ++
dlls/advpack/install.c | 26 +++++++++-----------------
dlls/advpack/reg.c | 7 ++++---
4 files changed, 21 insertions(+), 32 deletions(-)
diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c
index d2ce60e..2e8027f 100644
--- a/dlls/advpack/advpack.c
+++ b/dlls/advpack/advpack.c
@@ -530,18 +530,12 @@ HRESULT WINAPI SetPerUserSecValuesA(PERUSERSECTIONA* pPerUser)
if (!pPerUser)
return E_INVALIDARG;
- MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, -1, perUserW.szGUID,
- sizeof(perUserW.szGUID) / sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, pPerUser->szDispName, -1, perUserW.szDispName,
- sizeof(perUserW.szDispName) / sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, pPerUser->szLocale, -1, perUserW.szLocale,
- sizeof(perUserW.szLocale) / sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, pPerUser->szStub, -1, perUserW.szStub,
- sizeof(perUserW.szStub) / sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, pPerUser->szVersion, -1, perUserW.szVersion,
- sizeof(perUserW.szVersion) / sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, pPerUser->szCompID, -1, perUserW.szCompID,
- sizeof(perUserW.szCompID) / sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, -1, perUserW.szGUID, ARRAY_SIZE(perUserW.szGUID));
+ MultiByteToWideChar(CP_ACP, 0, pPerUser->szDispName, -1, perUserW.szDispName, ARRAY_SIZE(perUserW.szDispName));
+ MultiByteToWideChar(CP_ACP, 0, pPerUser->szLocale, -1, perUserW.szLocale, ARRAY_SIZE(perUserW.szLocale));
+ MultiByteToWideChar(CP_ACP, 0, pPerUser->szStub, -1, perUserW.szStub, ARRAY_SIZE(perUserW.szStub));
+ MultiByteToWideChar(CP_ACP, 0, pPerUser->szVersion, -1, perUserW.szVersion, ARRAY_SIZE(perUserW.szVersion));
+ MultiByteToWideChar(CP_ACP, 0, pPerUser->szCompID, -1, perUserW.szCompID, ARRAY_SIZE(perUserW.szCompID));
perUserW.dwIsInstalled = pPerUser->dwIsInstalled;
perUserW.bRollback = pPerUser->bRollback;
diff --git a/dlls/advpack/advpack_private.h b/dlls/advpack/advpack_private.h
index fc3b26f..aae723d 100644
--- a/dlls/advpack/advpack_private.h
+++ b/dlls/advpack/advpack_private.h
@@ -23,6 +23,8 @@
#include "wine/heap.h"
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+
HRESULT do_ocx_reg(HMODULE hocx, BOOL do_reg, const WCHAR *flags, const WCHAR *param) DECLSPEC_HIDDEN;
LPWSTR get_parameter(LPWSTR *params, WCHAR separator, BOOL quoted) DECLSPEC_HIDDEN;
void set_ldids(HINF hInf, LPCWSTR pszInstallSection, LPCWSTR pszWorkingDir) DECLSPEC_HIDDEN;
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index dcd1dd7..c3caf3a 100644
--- a/dlls/advpack/install.c
+++ b/dlls/advpack/install.c
@@ -115,28 +115,22 @@ static HRESULT per_user_install_callback(HINF hinf, PCWSTR field, const void *ar
per_user.bRollback = FALSE;
per_user.dwIsInstalled = 0;
- SetupGetLineTextW(NULL, hinf, field, disp_name, per_user.szDispName,
- sizeof(per_user.szDispName) / sizeof(WCHAR), &size);
+ SetupGetLineTextW(NULL, hinf, field, disp_name, per_user.szDispName, ARRAY_SIZE(per_user.szDispName), &size);
- SetupGetLineTextW(NULL, hinf, field, version, per_user.szVersion,
- sizeof(per_user.szVersion) / sizeof(WCHAR), &size);
+ SetupGetLineTextW(NULL, hinf, field, version, per_user.szVersion, ARRAY_SIZE(per_user.szVersion), &size);
if (SetupFindFirstLineW(hinf, field, is_installed, &context))
{
SetupGetIntField(&context, 1, (PINT)&per_user.dwIsInstalled);
}
- SetupGetLineTextW(NULL, hinf, field, comp_id, per_user.szCompID,
- sizeof(per_user.szCompID) / sizeof(WCHAR), &size);
+ SetupGetLineTextW(NULL, hinf, field, comp_id, per_user.szCompID, ARRAY_SIZE(per_user.szCompID), &size);
- SetupGetLineTextW(NULL, hinf, field, guid, per_user.szGUID,
- sizeof(per_user.szGUID) / sizeof(WCHAR), &size);
+ SetupGetLineTextW(NULL, hinf, field, guid, per_user.szGUID, ARRAY_SIZE(per_user.szGUID), &size);
- SetupGetLineTextW(NULL, hinf, field, locale, per_user.szLocale,
- sizeof(per_user.szLocale) / sizeof(WCHAR), &size);
+ SetupGetLineTextW(NULL, hinf, field, locale, per_user.szLocale, ARRAY_SIZE(per_user.szLocale), &size);
- SetupGetLineTextW(NULL, hinf, field, stub_path, per_user.szStub,
- sizeof(per_user.szStub) / sizeof(WCHAR), &size);
+ SetupGetLineTextW(NULL, hinf, field, stub_path, per_user.szStub, ARRAY_SIZE(per_user.szStub), &size);
return SetPerUserSecValuesW(&per_user);
}
@@ -154,8 +148,7 @@ static HRESULT register_ocxs_callback(HINF hinf, PCWSTR field, const void *arg)
WCHAR buffer[MAX_INF_STRING_LENGTH];
/* get OCX filename */
- if (!SetupGetStringFieldW(&context, 1, buffer,
- sizeof(buffer) / sizeof(WCHAR), NULL))
+ if (!SetupGetStringFieldW(&context, 1, buffer, ARRAY_SIZE(buffer), NULL))
continue;
hm = LoadLibraryExW(buffer, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
@@ -273,7 +266,7 @@ static HRESULT iterate_section_fields(HINF hinf, PCWSTR section, PCWSTR key,
{
WCHAR static_buffer[200];
WCHAR *buffer = static_buffer;
- DWORD size = sizeof(static_buffer) / sizeof(WCHAR);
+ DWORD size = ARRAY_SIZE(static_buffer);
INFCONTEXT context;
HRESULT hr = E_FAIL;
@@ -645,8 +638,7 @@ HRESULT WINAPI ExecuteCabA(HWND hwnd, CABINFOA* pCab, LPVOID pReserved)
RtlCreateUnicodeStringFromAsciiz(&inf, pCab->pszInf);
RtlCreateUnicodeStringFromAsciiz(§ion, pCab->pszSection);
- MultiByteToWideChar(CP_ACP, 0, pCab->szSrcPath, -1, cabinfo.szSrcPath,
- sizeof(cabinfo.szSrcPath) / sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pCab->szSrcPath, -1, cabinfo.szSrcPath, ARRAY_SIZE(cabinfo.szSrcPath));
cabinfo.pszInf = inf.Buffer;
cabinfo.pszSection = section.Buffer;
diff --git a/dlls/advpack/reg.c b/dlls/advpack/reg.c
index 9a43015..2a38f01 100644
--- a/dlls/advpack/reg.c
+++ b/dlls/advpack/reg.c
@@ -28,6 +28,7 @@
#include "advpub.h"
#include "wine/unicode.h"
#include "wine/debug.h"
+#include "advpack_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(advpack);
@@ -44,7 +45,7 @@ static BOOL get_temp_ini_path(LPWSTR name)
WCHAR tmp_dir[MAX_PATH];
WCHAR prefix[] = {'a','v','p',0};
- if(!GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir))
+ if(!GetTempPathW(ARRAY_SIZE(tmp_dir), tmp_dir))
return FALSE;
if(!GetTempFileNameW(tmp_dir, prefix, 0, name))
@@ -177,14 +178,14 @@ static HRESULT write_predefined_strings(HMODULE hm, LPCWSTR ini_path)
WCHAR sys_root[MAX_PATH];
*mod_path = '\"';
- if (!GetModuleFileNameW(hm, mod_path + 1, sizeof(mod_path) / sizeof(WCHAR) - 2))
+ if (!GetModuleFileNameW(hm, mod_path + 1, ARRAY_SIZE(mod_path) - 2))
return E_FAIL;
lstrcatW(mod_path, quote);
WritePrivateProfileStringW(Strings, MOD_PATH, mod_path, ini_path);
*sys_root = '\0';
- GetEnvironmentVariableW(SystemRoot, sys_root, sizeof(sys_root) / sizeof(WCHAR));
+ GetEnvironmentVariableW(SystemRoot, sys_root, ARRAY_SIZE(sys_root));
if(!strncmpiW(sys_root, mod_path + 1, strlenW(sys_root)))
{
--
2.7.4
June 11, 2018
Re: [PATCH] windowscodecs/tests: Use the available ARRAY_SIZE() macro
by Vincent Povirk
Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com>
June 11, 2018
Re: [PATCH 4/5] msvcrt: Avoid using inline assembly in call_unwind_func().
by Piotr Caban
Hi Zeb,
On 06/05/18 00:23, Zebediah Figura wrote:
> +extern int call_unwind_func( int (*func)(void), void *ebp );
> +
> +__ASM_GLOBAL_FUNC( call_unwind_func,
> + "pushl %ebp\n\t"
> + "pushl %ebx\n\t"
> + "pushl %esi\n\t"
> + "pushl %edi\n\t"
> + "movl 24(%esp), %ebp\n\t"
> + "call *20(%esp)\n\t"
> + "popl %edi\n\t"
> + "popl %esi\n\t"
> + "popl %ebx\n\t"
> + "popl %ebp\n\t"
> + "ret" );
How about renaming the function to call_handler and returning void* from
it? It looks strange that in all places where return value is used we
need to cast it to pointer.
Thanks,
Piotr
June 11, 2018
[PATCH] testbot: Make it possible to get an unfiltered clone of a collection.
by Francois Gouget
Once a filter has been applied to a collection it cannot be removed.
This is particularly a problem on Detailref collections (such as
$Job->Steps) as the code that has set the filter may be anywhere.
So Clone() makes it possible to get an unfiltered copy of the
collection without modifying the original collection's filter, and
thus without impacting the code using it.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/ObjectModel/Collection.pm | 34 ++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/Collection.pm b/testbot/lib/ObjectModel/Collection.pm
index 712172bca..c110c98b5 100644
--- a/testbot/lib/ObjectModel/Collection.pm
+++ b/testbot/lib/ObjectModel/Collection.pm
@@ -40,7 +40,7 @@ criteria.
use Exporter 'import';
our @EXPORT_OK = qw(new ComputeMasterKey);
-use Scalar::Util qw(weaken);
+use Scalar::Util qw(blessed weaken);
use ObjectModel::BackEnd;
use ObjectModel::Item;
@@ -114,6 +114,38 @@ sub _initialize($;$)
$self->{AllScopeItems}->{ref($self)} ||= {};
}
+=pod
+=over 12
+
+=item C<Clone()>
+
+Clones the collection, omitting the filters that were applied to it.
+
+=back
+=cut
+
+sub Clone($)
+{
+ my ($self) = @_;
+
+ my $Copy = {TableName => $self->{TableName},
+ CollectionName => $self->{CollectionName},
+ ItemName => $self->{ItemName},
+ PropertyDescriptors => $self->{PropertyDescriptors},
+ MasterColNames => $self->{MasterColNames},
+ MasterColValues => $self->{MasterColValues},
+ MasterKey => $self->{MasterKey},
+ Filters => {},
+ AllScopeItems => $self->{AllScopeItems},
+ Items => undef};
+ # See Collection::new()
+ weaken($Copy->{AllScopeItems});
+
+ $Copy = bless $Copy, blessed($self);
+ $Copy->_initialize(@_);
+ return $Copy;
+}
+
sub GetPropertyDescriptors($)
{
my ($self) = @_;
--
2.17.1
June 11, 2018
Re: [PATCH 3/5] msvcrt: Avoid using inline assembly in call_filter().
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH 2/5] msvcrt: Avoid using inline assembly in call_finally_block().
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH 1/5] msvcrt: Avoid using inline assembly in continue_after_catch().
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
[PATCH] mshtml/tests: Silence noisy traces.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/mshtml/tests/htmldoc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
June 11, 2018
Re: [PATCH v2 7/7] wined3d: Disallow disabling GLSL on core profile contexts.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH 6/7] d3d12/tests: Fix resource state transitions in test_swapchain_draw().
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH 5/7] d3d12/tests: Add option to run tests with validation layers.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH 4/7] d3d12/tests: Print adapter info.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH 2/7] wined3d: Remove hardware level detection hacks.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH 3/7] d3d12/tests: Add option to use selected adapter.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH 1/7] wined3d: Execute all CS commands before changing swapchain window.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH] wininet: Prevent a double-free.
by Jacek Caban
Hi,
This is more complicated than it needs to be. I sent another version:
https://source.winehq.org/patches/data/147213
Thanks,
Jacek
June 11, 2018
[PATCH] wininet: Simplify header string handling in HTTP_HttpSendRequestW.
by Jacek Caban
Spotted by Mark Jansen, avoids potential double-free.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/wininet/http.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
June 11, 2018
Re: [PATCH vkd3d] build: Remove portable/ directory.
by Henri Verbeet
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
June 11, 2018
Re: [PATCH] mshtml/tests: Use the available ARRAY_SIZE() macro
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
June 11, 2018
Re: [PATCH] ieframe/tests: Use the available ARRAY_SIZE() macro
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
June 11, 2018
[PATCH] jscript: Use jsdisp_define_data_property in Object.getOwnPropertyDescriptor.
by Jacek Caban
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
---
dlls/jscript/jscript.h | 6 ++++--
dlls/jscript/object.c | 20 ++++++++++----------
2 files changed, 14 insertions(+), 12 deletions(-)
June 11, 2018
Re: [PATCH] msvcr90/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcr120/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcr110/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcp90/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcp60/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcp140/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcp120/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
Re: [PATCH] msvcirt/tests: Use the available ARRAY_SIZE() macro
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
June 11, 2018
[PATCH v2 7/7] wined3d: Disallow disabling GLSL on core profile contexts.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
For bug 45315.
Version 2: Change wording.
---
dlls/wined3d/directx.c | 9 ++++++++-
dlls/wined3d/wined3d_main.c | 4 ++--
dlls/wined3d/wined3d_private.h | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9bc9c31e0a43..baab2e9c1a31 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2608,7 +2608,14 @@ static const struct fragment_pipeline *select_fragment_implementation(const stru
static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info)
{
- BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
+ BOOL glsl = wined3d_settings.use_glsl && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
+ if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] && !wined3d_settings.use_glsl)
+ {
+ ERR_(winediag)("Ignoring the UseGLSL registry key. "
+ "GLSL is the only shader backend available on core profile contexts. "
+ "You need to explicitly set GL version to use legacy contexts.\n");
+ glsl = TRUE;
+ }
if (glsl && gl_info->supported[ARB_VERTEX_SHADER] && gl_info->supported[ARB_FRAGMENT_SHADER])
return &glsl_shader_backend;
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index e322b4de0744..f8a84a17adb4 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -225,8 +225,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
if (!strcmp(buffer,"disabled"))
{
ERR_(winediag)("The GLSL shader backend has been disabled. You get to keep all the pieces if it breaks.\n");
- TRACE("Use of GL Shading Language disabled\n");
- wined3d_settings.glslRequested = FALSE;
+ TRACE("Use of GL Shading Language disabled.\n");
+ wined3d_settings.use_glsl = FALSE;
}
}
if (!get_config_key(hkey, appkey, "OffscreenRenderingMode", buffer, size)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 33bc463b94c3..d190f7ccfd68 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -385,7 +385,7 @@ struct wined3d_settings
unsigned int cs_multithreaded;
BOOL explicit_gl_version;
DWORD max_gl_version;
- BOOL glslRequested;
+ BOOL use_glsl;
int offscreen_rendering_mode;
unsigned short pci_vendor_id;
unsigned short pci_device_id;
--
2.16.4
June 11, 2018
[PATCH vkd3d] build: Remove portable/ directory.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
configure.ac | 1 -
portable/.gitignore | 0
2 files changed, 1 deletion(-)
delete mode 100644 portable/.gitignore
diff --git a/configure.ac b/configure.ac
index de4ece8ce569..daae6464fae9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,6 @@ AC_INIT([vkd3d],[1.0])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_LIBOBJ_DIR([portable])
AC_CONFIG_HEADERS(include/config.h)
AC_ARG_VAR([WIDL], [widl IDL compiler])
diff --git a/portable/.gitignore b/portable/.gitignore
deleted file mode 100644
index e69de29bb2d1..000000000000
--
2.16.4
June 11, 2018
Re: [PATCH 7/7] wined3d: Disallow disabling GLSL on core profile contexts.
by Henri Verbeet
On 11 June 2018 at 12:05, Józef Kucia <joseph.kucia(a)gmail.com> wrote:
> static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info)
> {
> - BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
> + BOOL glsl = wined3d_settings.use_glsl && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
> + if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] && !wined3d_settings.use_glsl)
> + {
> + ERR_(winediag)("Ignoring the UseGLSL registry key. "
> + "GLSL is the only supported shader backend on core profile contexts. "
> + "You need to explicitly set GL version to use legacy contexts.\n");
I think it's fair enough to warn people that disabling GLSL requires a
compatibility context, but note that disabling GLSL isn't exactly
supported there either.
June 11, 2018
[PATCH 2/2] winevulkan: Remove unsused variable from make_vulkan script.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Fixes a333c2ef07d3 ("winevulkan: Add copyright headers to files
generated from vk.xml.")
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/winevulkan/make_vulkan | 1 -
1 file changed, 1 deletion(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 47a216e46c7f..c32d9edc4e34 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -1891,7 +1891,6 @@ class VkGenerator(object):
self.host_structs.append(conv.struct)
def _generate_copyright(self, f, spec_file=False):
- c = "# " if spec_file else " * "
f.write("# " if spec_file else "/* ")
f.write("Automatically generated from Vulkan vk.xml; DO NOT EDIT!\n")
lines = ["", "This file is generated from Vulkan vk.xml file covered",
--
2.16.4
June 11, 2018
[PATCH 1/2] winevulkan: Correctly recognize commands belonging to multiple extensions.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/vulkan-1/vulkan-1.spec | 4 ++++
dlls/winevulkan/make_vulkan | 17 +++++++----------
dlls/winevulkan/winevulkan.spec | 4 ++++
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/dlls/vulkan-1/vulkan-1.spec b/dlls/vulkan-1/vulkan-1.spec
index 0a4e85e96859..860b4c84c7b1 100644
--- a/dlls/vulkan-1/vulkan-1.spec
+++ b/dlls/vulkan-1/vulkan-1.spec
@@ -34,6 +34,7 @@
# but only in their entirety and only with respect to the Combined Software.
#
+@ stub vkAcquireNextImage2KHR
@ stdcall vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr) winevulkan.wine_vkAcquireNextImageKHR
@ stdcall vkAllocateCommandBuffers(ptr ptr ptr) winevulkan.wine_vkAllocateCommandBuffers
@ stdcall vkAllocateDescriptorSets(ptr ptr ptr) winevulkan.wine_vkAllocateDescriptorSets
@@ -158,6 +159,8 @@
@ stub vkGetBufferMemoryRequirements2
@ stub vkGetDescriptorSetLayoutSupport
@ stub vkGetDeviceGroupPeerMemoryFeatures
+@ stub vkGetDeviceGroupPresentCapabilitiesKHR
+@ stub vkGetDeviceGroupSurfacePresentModesKHR
@ stdcall vkGetDeviceMemoryCommitment(ptr int64 ptr) winevulkan.wine_vkGetDeviceMemoryCommitment
@ stdcall vkGetDeviceProcAddr(ptr str) winevulkan.wine_vkGetDeviceProcAddr
@ stdcall vkGetDeviceQueue(ptr long long ptr) winevulkan.wine_vkGetDeviceQueue
@@ -186,6 +189,7 @@
@ stub vkGetPhysicalDeviceImageFormatProperties2
@ stdcall vkGetPhysicalDeviceMemoryProperties(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceMemoryProperties
@ stub vkGetPhysicalDeviceMemoryProperties2
+@ stub vkGetPhysicalDevicePresentRectanglesKHR
@ stdcall vkGetPhysicalDeviceProperties(ptr ptr) winevulkan.wine_vkGetPhysicalDeviceProperties
@ stub vkGetPhysicalDeviceProperties2
@ stdcall vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr) winevulkan.wine_vkGetPhysicalDeviceQueueFamilyProperties
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index ea64c052fa5f..47a216e46c7f 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -113,7 +113,7 @@ BLACKLISTED_EXTENSIONS = [
"VK_KHR_external_semaphore_capabilities",
"VK_KHR_shared_presentable_image", # Needs WSI work.
"VK_KHR_win32_keyed_mutex",
- "VK_NV_external_memory_win32"
+ "VK_NV_external_memory_win32",
]
# The Vulkan loader provides entry-points for core functionality and important
@@ -123,7 +123,7 @@ CORE_EXTENSIONS = [
"VK_KHR_display_swapchain",
"VK_KHR_surface",
"VK_KHR_swapchain",
- "VK_KHR_win32_surface"
+ "VK_KHR_win32_surface",
]
# Functions part of our winevulkan graphics driver interface.
@@ -377,8 +377,8 @@ class VkEnumValue(object):
class VkFunction(object):
- def __init__(self, _type=None, name=None, params=[], extension=None, alias=False):
- self.extension = extension
+ def __init__(self, _type=None, name=None, params=[], extensions=[], alias=False):
+ self.extensions = []
self.name = name
self.type = _type
self.params = params
@@ -448,13 +448,10 @@ class VkFunction(object):
Core API as well as several KHR WSI extensions.
"""
- if self.extension is None:
- return True
-
- if self.extension in CORE_EXTENSIONS:
+ if not self.extensions:
return True
- return False
+ return any(ext in self.extensions for ext in CORE_EXTENSIONS)
def is_device_func(self):
# If none of the other, it must be a device function
@@ -2452,7 +2449,7 @@ class VkRegistry(object):
commands = ext.findall("require/command")
for command in commands:
cmd_name = command.attrib["name"]
- self.funcs[cmd_name].extension = ext_name
+ self.funcs[cmd_name].extensions.append(ext_name)
# Some extensions are not ready or have numbers reserved as a place holder.
if ext.attrib["supported"] == "disabled":
diff --git a/dlls/winevulkan/winevulkan.spec b/dlls/winevulkan/winevulkan.spec
index b923c6422518..f825079ba6f6 100644
--- a/dlls/winevulkan/winevulkan.spec
+++ b/dlls/winevulkan/winevulkan.spec
@@ -36,6 +36,7 @@
@ stdcall vk_icdGetInstanceProcAddr(ptr str) wine_vk_icdGetInstanceProcAddr
@ stdcall vk_icdNegotiateLoaderICDInterfaceVersion(ptr) wine_vk_icdNegotiateLoaderICDInterfaceVersion
+@ stub vkAcquireNextImage2KHR
@ stdcall wine_vkAcquireNextImageKHR(ptr int64 int64 int64 int64 ptr)
@ stdcall wine_vkAllocateCommandBuffers(ptr ptr ptr)
@ stdcall wine_vkAllocateDescriptorSets(ptr ptr ptr)
@@ -159,6 +160,8 @@
@ stub vkGetBufferMemoryRequirements2
@ stub vkGetDescriptorSetLayoutSupport
@ stub vkGetDeviceGroupPeerMemoryFeatures
+@ stub vkGetDeviceGroupPresentCapabilitiesKHR
+@ stub vkGetDeviceGroupSurfacePresentModesKHR
@ stdcall wine_vkGetDeviceMemoryCommitment(ptr int64 ptr)
@ stdcall wine_vkGetDeviceProcAddr(ptr str)
@ stdcall wine_vkGetDeviceQueue(ptr long long ptr)
@@ -187,6 +190,7 @@
@ stub vkGetPhysicalDeviceImageFormatProperties2
@ stdcall wine_vkGetPhysicalDeviceMemoryProperties(ptr ptr)
@ stub vkGetPhysicalDeviceMemoryProperties2
+@ stub vkGetPhysicalDevicePresentRectanglesKHR
@ stdcall wine_vkGetPhysicalDeviceProperties(ptr ptr)
@ stub vkGetPhysicalDeviceProperties2
@ stdcall wine_vkGetPhysicalDeviceQueueFamilyProperties(ptr ptr ptr)
--
2.16.4
June 11, 2018
[PATCH] testbot: Add the customary 1; at the end of PatchUtils.pm.
by Francois Gouget
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
Forgetting it does occasionally result in errors.
testbot/lib/WineTestBot/PatchUtils.pm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/testbot/lib/WineTestBot/PatchUtils.pm b/testbot/lib/WineTestBot/PatchUtils.pm
index b05fe0aa4..02c89e285 100644
--- a/testbot/lib/WineTestBot/PatchUtils.pm
+++ b/testbot/lib/WineTestBot/PatchUtils.pm
@@ -250,3 +250,5 @@ sub GetPatchImpact($;$$)
return $Impacts;
}
+
+1;
--
2.17.1
June 11, 2018
[PATCH 7/7] wined3d: Disallow disabling GLSL on core profile contexts.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
For bug 45315.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/wined3d/directx.c | 9 ++++++++-
dlls/wined3d/wined3d_main.c | 4 ++--
dlls/wined3d/wined3d_private.h | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 9bc9c31e0a43..9642d7d03813 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2608,7 +2608,14 @@ static const struct fragment_pipeline *select_fragment_implementation(const stru
static const struct wined3d_shader_backend_ops *select_shader_backend(const struct wined3d_gl_info *gl_info)
{
- BOOL glsl = wined3d_settings.glslRequested && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
+ BOOL glsl = wined3d_settings.use_glsl && gl_info->glsl_version >= MAKEDWORD_VERSION(1, 20);
+ if (!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT] && !wined3d_settings.use_glsl)
+ {
+ ERR_(winediag)("Ignoring the UseGLSL registry key. "
+ "GLSL is the only supported shader backend on core profile contexts. "
+ "You need to explicitly set GL version to use legacy contexts.\n");
+ glsl = TRUE;
+ }
if (glsl && gl_info->supported[ARB_VERTEX_SHADER] && gl_info->supported[ARB_FRAGMENT_SHADER])
return &glsl_shader_backend;
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index e322b4de0744..f8a84a17adb4 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -225,8 +225,8 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL)
if (!strcmp(buffer,"disabled"))
{
ERR_(winediag)("The GLSL shader backend has been disabled. You get to keep all the pieces if it breaks.\n");
- TRACE("Use of GL Shading Language disabled\n");
- wined3d_settings.glslRequested = FALSE;
+ TRACE("Use of GL Shading Language disabled.\n");
+ wined3d_settings.use_glsl = FALSE;
}
}
if (!get_config_key(hkey, appkey, "OffscreenRenderingMode", buffer, size)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 33bc463b94c3..d190f7ccfd68 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -385,7 +385,7 @@ struct wined3d_settings
unsigned int cs_multithreaded;
BOOL explicit_gl_version;
DWORD max_gl_version;
- BOOL glslRequested;
+ BOOL use_glsl;
int offscreen_rendering_mode;
unsigned short pci_vendor_id;
unsigned short pci_device_id;
--
2.16.4
June 11, 2018
[PATCH 6/7] d3d12/tests: Fix resource state transitions in test_swapchain_draw().
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d12/tests/d3d12.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dlls/d3d12/tests/d3d12.c b/dlls/d3d12/tests/d3d12.c
index a6d7219b9bbd..99641be0f683 100644
--- a/dlls/d3d12/tests/d3d12.c
+++ b/dlls/d3d12/tests/d3d12.c
@@ -788,6 +788,9 @@ static void test_swapchain_draw(void)
ok(hr == S_OK, "Failed to get swapchain buffer %u, hr %#x.\n", index, hr);
ID3D12Device_CreateRenderTargetView(context.device, backbuffer, NULL, context.rtv);
+ transition_sub_resource_state(command_list, backbuffer, 0,
+ D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
+
ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, FALSE, NULL);
--
2.16.4
June 11, 2018
[PATCH 5/7] d3d12/tests: Add option to run tests with validation layers.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d12/tests/d3d12.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d12/tests/d3d12.c b/dlls/d3d12/tests/d3d12.c
index 51967a0c327f..a6d7219b9bbd 100644
--- a/dlls/d3d12/tests/d3d12.c
+++ b/dlls/d3d12/tests/d3d12.c
@@ -813,18 +813,28 @@ static void test_swapchain_draw(void)
START_TEST(d3d12)
{
+ BOOL enable_debug_layer = FALSE;
unsigned int argc, i;
+ ID3D12Debug *debug;
char **argv;
argc = winetest_get_mainargs(&argv);
for (i = 2; i < argc; ++i)
{
- if (!strcmp(argv[i], "--warp"))
+ if (!strcmp(argv[i], "--validate"))
+ enable_debug_layer = TRUE;
+ else if (!strcmp(argv[i], "--warp"))
use_warp_adapter = TRUE;
else if (!strcmp(argv[i], "--adapter") && i + 1 < argc)
use_adapter_idx = atoi(argv[++i]);
}
+ if (enable_debug_layer && SUCCEEDED(D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug)))
+ {
+ ID3D12Debug_EnableDebugLayer(debug);
+ ID3D12Debug_Release(debug);
+ }
+
print_adapter_info();
test_interfaces();
--
2.16.4
June 11, 2018
[PATCH 4/7] d3d12/tests: Print adapter info.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d12/tests/d3d12.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/dlls/d3d12/tests/d3d12.c b/dlls/d3d12/tests/d3d12.c
index 37f5c5147814..51967a0c327f 100644
--- a/dlls/d3d12/tests/d3d12.c
+++ b/dlls/d3d12/tests/d3d12.c
@@ -116,6 +116,37 @@ static ID3D12Device *create_device(void)
return device;
}
+static void print_adapter_info(void)
+{
+ DXGI_ADAPTER_DESC adapter_desc;
+ IDXGIFactory4 *factory;
+ IDXGIAdapter *adapter;
+ ID3D12Device *device;
+ HRESULT hr;
+ LUID luid;
+
+ if (!(device = create_device()))
+ return;
+ luid = ID3D12Device_GetAdapterLuid(device);
+ ID3D12Device_Release(device);
+
+ hr = CreateDXGIFactory2(0, &IID_IDXGIFactory4, (void **)&factory);
+ ok(hr == S_OK, "Failed to create factory, hr %#x.\n", hr);
+ hr = IDXGIFactory4_EnumAdapterByLuid(factory, luid, &IID_IDXGIAdapter, (void **)&adapter);
+ todo_wine ok(hr == S_OK, "Failed to enum adapter by LUID, hr %#x.\n", hr);
+ IDXGIFactory4_Release(factory);
+
+ if (FAILED(hr))
+ return;
+
+ hr = IDXGIAdapter_GetDesc(adapter, &adapter_desc);
+ ok(hr == S_OK, "Failed to get adapter desc, hr %#x.\n", hr);
+ IDXGIAdapter_Release(adapter);
+
+ trace("Adapter: %s, %04x:%04x.\n", wine_dbgstr_w(adapter_desc.Description),
+ adapter_desc.VendorId, adapter_desc.DeviceId);
+}
+
#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported)
{
@@ -794,6 +825,8 @@ START_TEST(d3d12)
use_adapter_idx = atoi(argv[++i]);
}
+ print_adapter_info();
+
test_interfaces();
test_draw();
test_swapchain_draw();
--
2.16.4
June 11, 2018
[PATCH 3/7] d3d12/tests: Add option to use selected adapter.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/d3d12/tests/d3d12.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d12/tests/d3d12.c b/dlls/d3d12/tests/d3d12.c
index c8f17f314ce1..37f5c5147814 100644
--- a/dlls/d3d12/tests/d3d12.c
+++ b/dlls/d3d12/tests/d3d12.c
@@ -70,11 +70,47 @@ static void set_viewport(D3D12_VIEWPORT *vp, float x, float y,
vp->MaxDepth = max_depth;
}
+static BOOL use_warp_adapter;
+static unsigned int use_adapter_idx;
+
+static IDXGIAdapter *create_adapter(void)
+{
+ IDXGIFactory4 *factory;
+ IDXGIAdapter *adapter;
+ HRESULT hr;
+
+ if (!use_warp_adapter && !use_adapter_idx)
+ return NULL;
+
+ hr = CreateDXGIFactory2(0, &IID_IDXGIFactory4, (void **)&factory);
+ ok(hr == S_OK, "Failed to create factory, hr %#x.\n", hr);
+
+ adapter = NULL;
+ if (use_warp_adapter)
+ {
+ hr = IDXGIFactory4_EnumWarpAdapter(factory, &IID_IDXGIAdapter, (void **)&adapter);
+ }
+ else
+ {
+ hr = IDXGIFactory4_EnumAdapters(factory, use_adapter_idx, &adapter);
+ }
+ IDXGIFactory4_Release(factory);
+ if (FAILED(hr))
+ trace("Failed to get adapter, hr %#x.\n", hr);
+ return adapter;
+}
+
static ID3D12Device *create_device(void)
{
+ IDXGIAdapter *adapter;
ID3D12Device *device;
+ HRESULT hr;
- if (FAILED(D3D12CreateDevice(NULL, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device)))
+ adapter = create_adapter();
+ hr = D3D12CreateDevice((IUnknown *)adapter, D3D_FEATURE_LEVEL_11_0, &IID_ID3D12Device, (void **)&device);
+ if (adapter)
+ IDXGIAdapter_Release(adapter);
+ if (FAILED(hr))
return NULL;
return device;
@@ -746,6 +782,18 @@ static void test_swapchain_draw(void)
START_TEST(d3d12)
{
+ unsigned int argc, i;
+ char **argv;
+
+ argc = winetest_get_mainargs(&argv);
+ for (i = 2; i < argc; ++i)
+ {
+ if (!strcmp(argv[i], "--warp"))
+ use_warp_adapter = TRUE;
+ else if (!strcmp(argv[i], "--adapter") && i + 1 < argc)
+ use_adapter_idx = atoi(argv[++i]);
+ }
+
test_interfaces();
test_draw();
test_swapchain_draw();
--
2.16.4
June 11, 2018
[PATCH 2/7] wined3d: Remove hardware level detection hacks.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Core contexts are enabled by default since
0db4d1c251d293333e2721a78d6156008a90ff6f.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/wined3d/directx.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index afb97184e396..9bc9c31e0a43 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1857,22 +1857,15 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s
return HW_VENDOR_NVIDIA;
}
-static enum wined3d_d3d_level d3d_level_from_caps(const struct shader_caps *shader_caps, const struct fragment_caps *fragment_caps, DWORD glsl_version)
+static enum wined3d_d3d_level d3d_level_from_caps(const struct shader_caps *shader_caps,
+ const struct fragment_caps *fragment_caps)
{
if (shader_caps->vs_version >= 5)
return WINED3D_D3D_LEVEL_11;
if (shader_caps->vs_version == 4)
return WINED3D_D3D_LEVEL_10;
if (shader_caps->vs_version == 3)
- {
- /* wined3d with default settings at the moment doesn't expose SM4+ on
- * Mesa drivers. */
- if (glsl_version >= MAKEDWORD_VERSION(4, 30))
- return WINED3D_D3D_LEVEL_11;
- if (glsl_version >= MAKEDWORD_VERSION(1, 30))
- return WINED3D_D3D_LEVEL_10;
return WINED3D_D3D_LEVEL_9_SM3;
- }
if (shader_caps->vs_version == 2)
return WINED3D_D3D_LEVEL_9_SM2;
if (shader_caps->vs_version == 1)
@@ -2562,9 +2555,9 @@ static enum wined3d_pci_device wined3d_guess_card(const struct shader_caps *shad
* memory behind our backs if really needed. Note that the amount of video
* memory can be overruled using a registry setting. */
- unsigned int i;
- enum wined3d_d3d_level d3d_level = d3d_level_from_caps(shader_caps, fragment_caps, glsl_version);
+ enum wined3d_d3d_level d3d_level = d3d_level_from_caps(shader_caps, fragment_caps);
enum wined3d_pci_device device;
+ unsigned int i;
for (i = 0; i < ARRAY_SIZE(card_vendor_table); ++i)
{
--
2.16.4
June 11, 2018
[PATCH 1/7] wined3d: Execute all CS commands before changing swapchain window.
by Józef Kucia
From: Józef Kucia <jkucia(a)codeweavers.com>
Fixes a race condition.
For bug 44557.
Signed-off-by: Józef Kucia <jkucia(a)codeweavers.com>
---
dlls/wined3d/swapchain.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 7a3f1ff95e90..9df40abc70ce 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -135,6 +135,8 @@ void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapch
void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
{
+ struct wined3d_device *device = swapchain->device;
+
if (!window)
window = swapchain->device_window;
if (window == swapchain->win_handle)
@@ -142,6 +144,9 @@ void CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWN
TRACE("Setting swapchain %p window from %p to %p.\n",
swapchain, swapchain->win_handle, window);
+
+ device->cs->ops->finish(device->cs, WINED3D_CS_QUEUE_DEFAULT);
+
swapchain->win_handle = window;
}
--
2.16.4
June 11, 2018
[PATCH 5/5] mstask/tests: Add more tests for IEnumWorkItems interface.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/tests/task_scheduler.c | 75 +++++++++++++++++++++++++++++++++++---
1 file changed, 70 insertions(+), 5 deletions(-)
diff --git a/dlls/mstask/tests/task_scheduler.c b/dlls/mstask/tests/task_scheduler.c
index d4766382ec..f61022575d 100644
--- a/dlls/mstask/tests/task_scheduler.c
+++ b/dlls/mstask/tests/task_scheduler.c
@@ -212,23 +212,88 @@ done:
static void test_Enum(void)
{
+ static const WCHAR Task1[] = { 'w','i','n','e','t','a','s','k','1',0 };
ITaskScheduler *scheduler;
+ ITask *task;
IEnumWorkItems *tasks;
+ WCHAR **names;
+ ULONG fetched;
HRESULT hr;
hr = CoCreateInstance(&CLSID_CTaskScheduler, NULL, CLSCTX_INPROC_SERVER,
&IID_ITaskScheduler, (void **)&scheduler);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ /* cleanup after previous runs */
+ ITaskScheduler_Delete(scheduler, Task1);
+
+ hr = ITaskScheduler_NewWorkItem(scheduler, Task1, &CLSID_CTask, &IID_ITask, (IUnknown **)&task);
+ ok(hr == S_OK, "got %#x\n", hr);
+ hr = ITaskScheduler_AddWorkItem(scheduler, Task1, (IScheduledWorkItem *)task);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ ITask_Release(task);
-if (0) { /* crashes on win2k */
hr = ITaskScheduler_Enum(scheduler, NULL);
- ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
-}
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
hr = ITaskScheduler_Enum(scheduler, &tasks);
- ok(hr == S_OK, "got 0x%08x\n", hr);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ names = (void *)0xdeadbeef;
+ fetched = 0xdeadbeef;
+ hr = IEnumWorkItems_Next(tasks, 0, &names, &fetched);
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
+ ok(names == (void *)0xdeadbeef, "got %p\n", names);
+ ok(fetched == 0xdeadbeef, "got %#x\n", fetched);
+
+ hr = IEnumWorkItems_Next(tasks, 1, NULL, NULL);
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
+
+ names = NULL;
+ hr = IEnumWorkItems_Next(tasks, 1, &names, NULL);
+ ok(hr == S_OK, "got %#x\n", hr);
+ ok(names != NULL, "got NULL\n");
+ ok(names[0] != NULL, "got NULL\n");
+ CoTaskMemFree(names[0]);
+ CoTaskMemFree(names);
+
+ names = (void *)0xdeadbeef;
+ hr = IEnumWorkItems_Next(tasks, 2, &names, NULL);
+ ok(hr == E_INVALIDARG, "got %#x\n", hr);
+ ok(names == (void *)0xdeadbeef, "got %p\n", names);
+
+ hr = IEnumWorkItems_Reset(tasks);
+ ok(hr == S_OK, "got %#x\n", hr);
+
+ names = NULL;
+ fetched = 0xdeadbeef;
+ hr = IEnumWorkItems_Next(tasks, 1, &names, &fetched);
+ ok(hr == S_OK, "got %#x\n", hr);
+ ok(names != NULL, "got NULL\n");
+ ok(names[0] != NULL, "got NULL\n");
+ ok(fetched == 1, "got %u\n", fetched);
+ CoTaskMemFree(names[0]);
+ CoTaskMemFree(names);
+
+ while (IEnumWorkItems_Skip(tasks, 1) == S_OK)
+ /* do nothing*/;
+
+ hr = IEnumWorkItems_Skip(tasks, 1);
+ ok(hr == S_FALSE, "got %#x\n", hr);
+
+ names = (void *)0xdeadbeef;
+ fetched = 0xdeadbeef;
+ hr = IEnumWorkItems_Next(tasks, 1, &names, &fetched);
+ ok(hr == S_FALSE, "got %#x\n", hr);
+ ok(names == NULL, "got %p\n", names);
+ ok(fetched == 0, "got %u\n", fetched);
+
IEnumWorkItems_Release(tasks);
+ hr = ITaskScheduler_Delete(scheduler, Task1);
+ ok(hr == S_OK, "got %#x\n", hr);
+
ITaskScheduler_Release(scheduler);
}
--
2.16.3
June 11, 2018
[PATCH 4/5] mstask: Implement IEnumWorkItems::Skip().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task_scheduler.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index fcade04db0..7998b3a50e 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -209,9 +209,17 @@ static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPW
static HRESULT WINAPI EnumWorkItems_Skip(IEnumWorkItems *iface, ULONG count)
{
- EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface);
- FIXME("(%p)->(%u): stub\n", This, count);
- return E_NOTIMPL;
+ LPWSTR *names;
+ ULONG fetched;
+ HRESULT hr;
+
+ TRACE("(%p)->(%u)\n", iface, count);
+
+ hr = EnumWorkItems_Next(iface, count, &names, &fetched);
+ if (SUCCEEDED(hr))
+ free_list(names, fetched);
+
+ return hr;
}
static HRESULT WINAPI EnumWorkItems_Reset(IEnumWorkItems *iface)
--
2.16.3
June 11, 2018
[PATCH 3/5] mstask: Implement IEnumWorkItems::Reset().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task_scheduler.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index f867537fa1..fcade04db0 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -217,8 +217,16 @@ static HRESULT WINAPI EnumWorkItems_Skip(IEnumWorkItems *iface, ULONG count)
static HRESULT WINAPI EnumWorkItems_Reset(IEnumWorkItems *iface)
{
EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface);
- FIXME("(%p): stub\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)\n", This);
+
+ if (This->handle != INVALID_HANDLE_VALUE)
+ {
+ FindClose(This->handle);
+ This->handle = INVALID_HANDLE_VALUE;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI EnumWorkItems_Clone(IEnumWorkItems *iface, IEnumWorkItems **cloned)
--
2.16.3
June 11, 2018
[PATCH 2/5] mstask: Implement IEnumWorkItems::Next(). (v2)
by Dmitry Timoshkov
v2: double the allocated size.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task_scheduler.c | 101 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 99 insertions(+), 2 deletions(-)
diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index 416a3218d0..f867537fa1 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -43,6 +43,7 @@ typedef struct
{
IEnumWorkItems IEnumWorkItems_iface;
LONG ref;
+ HANDLE handle;
} EnumWorkItemsImpl;
static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface)
@@ -97,6 +98,8 @@ static ULONG WINAPI EnumWorkItems_Release(IEnumWorkItems *iface)
if (ref == 0)
{
+ if (This->handle != INVALID_HANDLE_VALUE)
+ FindClose(This->handle);
heap_free(This);
InterlockedDecrement(&dll_ref);
}
@@ -104,11 +107,104 @@ static ULONG WINAPI EnumWorkItems_Release(IEnumWorkItems *iface)
return ref;
}
+static void free_list(LPWSTR *list, LONG count)
+{
+ LONG i;
+
+ for (i = 0; i < count; i++)
+ CoTaskMemFree(list[i]);
+
+ CoTaskMemFree(list);
+}
+
+static inline BOOL is_file(const WIN32_FIND_DATAW *data)
+{
+ return !(data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+}
+
static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPWSTR **names, ULONG *fetched)
{
+ static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\','*',0 };
EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface);
- FIXME("(%p)->(%u %p %p): stub\n", This, count, names, fetched);
- return E_NOTIMPL;
+ WCHAR path[MAX_PATH];
+ WIN32_FIND_DATAW data;
+ ULONG enumerated, allocated, dummy;
+ LPWSTR *list;
+ HRESULT hr = S_FALSE;
+
+ TRACE("(%p)->(%u %p %p)\n", This, count, names, fetched);
+
+ if (!count || !names || (!fetched && count > 1)) return E_INVALIDARG;
+
+ if (!fetched) fetched = &dummy;
+
+ *names = NULL;
+ *fetched = 0;
+ enumerated = 0;
+ list = NULL;
+
+ allocated = 64;
+ list = CoTaskMemAlloc(allocated * sizeof(list[0]));
+ if (!list) return E_OUTOFMEMORY;
+
+ if (This->handle == INVALID_HANDLE_VALUE)
+ {
+ GetWindowsDirectoryW(path, MAX_PATH);
+ lstrcatW(path, tasksW);
+ This->handle = FindFirstFileW(path, &data);
+ if (This->handle == INVALID_HANDLE_VALUE)
+ return S_FALSE;
+ }
+ else
+ {
+ if (!FindNextFileW(This->handle, &data))
+ return S_FALSE;
+ }
+
+ do
+ {
+ if (is_file(&data))
+ {
+ if (enumerated >= allocated)
+ {
+ LPWSTR *new_list;
+ allocated *= 2;
+ new_list = CoTaskMemRealloc(list, allocated * sizeof(list[0]));
+ if (!new_list)
+ {
+ hr = E_OUTOFMEMORY;
+ break;
+ }
+ list = new_list;
+ }
+
+ list[enumerated] = CoTaskMemAlloc((lstrlenW(data.cFileName) + 1) * sizeof(WCHAR));
+ if (!list[enumerated])
+ {
+ hr = E_OUTOFMEMORY;
+ break;
+ }
+
+ lstrcpyW(list[enumerated], data.cFileName);
+ enumerated++;
+
+ if (enumerated >= count)
+ {
+ hr = S_OK;
+ break;
+ }
+ }
+ } while (FindNextFileW(This->handle, &data));
+
+ if (FAILED(hr))
+ free_list(list, enumerated);
+ else
+ {
+ *fetched = enumerated;
+ *names = list;
+ }
+
+ return hr;
}
static HRESULT WINAPI EnumWorkItems_Skip(IEnumWorkItems *iface, ULONG count)
@@ -154,6 +250,7 @@ static HRESULT create_task_enum(IEnumWorkItems **ret)
tasks->IEnumWorkItems_iface.lpVtbl = &EnumWorkItemsVtbl;
tasks->ref = 1;
+ tasks->handle = INVALID_HANDLE_VALUE;
*ret = &tasks->IEnumWorkItems_iface;
InterlockedIncrement(&dll_ref);
--
2.16.3
June 11, 2018
[PATCH 1/5] mstask: Implement ITask::GetExitCode().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 266029a58e..7499826937 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -685,8 +685,14 @@ static HRESULT WINAPI MSTASK_ITask_GetExitCode(ITask *iface, DWORD *exit_code)
TRACE("(%p, %p)\n", iface, exit_code);
+ if (This->status == SCHED_S_TASK_NOT_SCHEDULED)
+ {
+ *exit_code = 0;
+ return SCHED_S_TASK_HAS_NOT_RUN;
+ }
+
*exit_code = This->exit_code;
- return SCHED_S_TASK_HAS_NOT_RUN; /* FIXME */
+ return S_OK;
}
static HRESULT WINAPI MSTASK_ITask_SetComment(ITask *iface, LPCWSTR comment)
--
2.16.3
June 11, 2018
Re: [PATCH 2/2] user32: Fix returned class name for other processes windows.
by Alexandre Julliard
Nikolay Sivov <nsivov(a)codeweavers.com> writes:
> @@ -2049,6 +2049,23 @@ DECL_HANDLER(set_window_owner)
> }
>
>
> +/* get class name for a window handle */
> +DECL_HANDLER(get_class_name)
> +{
> + struct window *win = get_window( req->handle );
> + WCHAR name[256];
> + atom_t atom;
> + int len;
> +
> + if (!win) return;
> +
> + atom = win->class ? get_base_class_atom( win->class ) : DESKTOP_ATOM;
> + len = get_atom_string(atom, name, 256);
> +
> + set_reply_data( name, min( len, get_reply_max_size() ));
> +}
This should go into class.c., though I'd suggest returning the atom in
the existing set_class_info request instead.
--
Alexandre Julliard
julliard(a)winehq.org
June 11, 2018
Re: [PATCH v2] shellpath.c: Fix creation of HOME directory symbolic links
by Huw Davies
On Sat, Jun 09, 2018 at 12:45:23AM +0100, Bob Wya wrote:
>
>
> On 8 June 2018 at 12:52, Huw Davies <huw(a)codeweavers.com> wrote:
> On Fri, Jun 08, 2018 at 10:58:23AM +0100, Rob Walker wrote:
> > Fixes: https://bugs.winehq.org/show_bug.cgi?id=41668
> >
> > The Shell Folders, that Wine symlinks to the user's HOME directory,
> are
> > only re-created on each Wine boot if they: do not pre-exist or are
> broken
> > symbolic links.
> >
> > Handling the DESKTOP Shell Folder is a special case as this is
> created twice
> > (during a standard boot), early in the Wine boot process. This is
> handled by
> > 2 separate processes, loading shell32.dll, in sequence. This makes
> it hard to determine
> > if the DESKTOP folder was created before the Wine boot (either from
> a previous Wine boot
> > or by the end user).
> >
> > The final (implemented) solution determines the exact start time of
> the Wine boot process
> > (using the current system time and tick-count). If the DESKTOP
> directory was last written
> > after this Wine boot time, we can assume that "we" (Wine)
> automatically created the
> > directory. Only in this instance do we attempt to set a symlink to
> the DESKTOP directory
> > (subdirectory of HOME).
>
> There's still too much going on here.
>
> Do you really need to refactor the code to make your change?
> If not, then just send in the change to the current code.
> If you need to refactor, then do the refactoring first
> (I could imagine taking 3-4 patches to do the refactoring[1])
> then make the change as a final patch in the series.
>
> The file-time / boot-time thing seems hacky, I'm not exactly
> sure what you're trying do to, but this doesn't sound right.
> Hopefully that will become clearer as you tidy things up.
>
> Huw.
>
> [1] For example move the creation of My Pictures/My Videos/etc
> first, then move My Documents and finally Desktop. These
> final two are special cases in the current code, we'd need
> to see that in any new code.
>
> Sorry I forgot to update the commit message! I'd updated the code (in the v2
> patch), for handling the
> special case of the User profile Desktop directory, without testing file times
> / boot times (the latter
> didn't work as GetTickTime64 was returning the host system uptime anyway).
>
> -------------------------------------------------------------------------------
> -------------------------------------------------
>
> I have a number of concerns with the existing implementation of
> _SHCreateSymbolicLinks():
>
> 1) The function is far too long, in it's present form - it's currently 165
> lines long!
>
> 2) The comments should be far more terse and precise.
>
> 3) Using infinite while (1) loops to de-mark code blocks only serves to obscure
> the functionality of the code.
I'd agree, the current function isn't ideal. But, unfortunately, you
can't just rip it out and start again. Things need to be done incrementally.
> 4)
>
> 4487- /* '$HOME' doesn't exist. Create 'My Pictures', 'My Videos' and
> 'My Music' subdirs
> 4488- * in '%USERPROFILE%\\My Documents' or fail silently if they
> already exist. */
> 4489- pszHome = NULL;
> 4490- strcpy(szPersonalTarget, pszPersonal);
> 4491- for (i = 0; i < ARRAY_SIZE(aidsMyStuff); i++) {
> 4492- strcpy(szMyStuffTarget, szPersonalTarget);
> 4493- if (_SHAppendToUnixPath(szMyStuffTarget, MAKEINTRESOURCEW
> (aidsMyStuff[i])))
> 4494- mkdir(szMyStuffTarget, 0777);
> 4495- }
>
> Windows Vista (and newer) do not nest the User profile directories. Since Wine
> is targeting Windows 7 by default - this
> legacy behaviour should be removed. (As an end user, who used to use Windows
> XP, this was simply an annoying default
> layout anyway.)
>
> 5)
>
> 4447- /* '$HOME/My Documents' exists. Create 'My Pictures',
> 4448- * 'My Videos' and 'My Music' subfolders or fail silently
> if
> 4449- * they already exist.
> 4450- */
> 4451- for (i = 0; i < ARRAY_SIZE(aidsMyStuff); i++)
> 4452- {
> 4453- strcpy(szMyStuffTarget, szPersonalTarget);
> 4454- if (_SHAppendToUnixPath(szMyStuffTarget,
> MAKEINTRESOURCEW(aidsMyStuff[i])))
> 4455- mkdir(szMyStuffTarget, 0777);
> 4456- }
> 4457- break;
>
> Ditto as per (4). This is an obsolete User Profile directory layout (pre-
> Vista).
>
> Also if "${HOME}/My Documents" exists then this block of code will start
> creating subdirectories in this
> folder. I don't think that Wine should be making the rather arbitrary
> assumption that a Wine user wants
> their "${HOME}" directory spammed with new subdirectories.
>
> I often read online, comments from Wine users, complaining about this sort of
> behaviour...
>
> 6)
>
> 4543- /* Last but not least, the Desktop folder */
> 4544- if (pszHome)
> 4545- strcpy(szDesktopTarget, pszHome);
> 4546- else
> 4547- strcpy(szDesktopTarget, pszPersonal);
> 4548- heap_free(pszPersonal);
> 4549-
> 4550- xdg_desktop_dir = xdg_results ? xdg_results[num - 1] : NULL;
> 4551- if (xdg_desktop_dir ||
> 4552- (_SHAppendToUnixPath(szDesktopTarget, DesktopW) &&
> 4553- !stat(szDesktopTarget, &statFolder) && S_ISDIR
> (statFolder.st_mode)))
> 4554- {
> 4555- hr = SHGetFolderPathW(NULL,
> CSIDL_DESKTOPDIRECTORY|CSIDL_FLAG_CREATE, NULL,
> 4556- SHGFP_TYPE_DEFAULT, wszTempPath);
> 4557- if (SUCCEEDED(hr) && (pszDesktop = wine_get_unix_file_name
> (wszTempPath)))
> 4558- {
> 4559- remove(pszDesktop);
> 4560- if (xdg_desktop_dir)
> 4561- symlink(xdg_desktop_dir, pszDesktop);
> 4562- else
> 4563- symlink(szDesktopTarget, pszDesktop);
> 4564- heap_free(pszDesktop);
> 4565- }
> 4566- }
>
> This code uses pszPersonal as a fallback target for when HOME is unset.
> This will be the equivalent of:
>
> "${WINEPREFIX}/dosdevices/c:/users/${USER}/My Documents"
>
> Say the XDG_DESKTOP_DIR check fails. Then Wine tries to find the directory:
>
> "${WINEPREFIX}/dosdevices/c:/users/${USER}/My Documents/Desktop"
>
> as a symlink target. Which never succeeds because Wine never creates this
> directory...
>
> This extra path appears to be redundant (HOME unset / XDG_DESKTOP_DIR unset).
So points 4 - 6 sound like they each deserve a separate patch.
> -------------------------------------------------------------------------------
> -------------------------------------------------
>
> I can of course leave the variable names unchanged and the function name.
> I was "told off" for not using snake case on a previous Wine commit - so I
> assumed
> I had to follow this standard if I wanted to refactor existing code. :-)
In this case you're adding to existing code so it becomes a bit more
flexible. Generally though keeping the patch as small as possible should
be your aim. The reviewer needs to be able to understand what's going on;
including unrelated or needless changes makes that much harder.
> I'd like to tidy this function up and make it more readable (including the
> comments).
> Which I can do in staged patches, as you suggested.
>
> But obviously I'd like to feel that we are both on the "same page" about the
> changes
> I discussed (above). Before I email in a v3 staged patchset.
Go ahead and send in those patches, then people can give you meaningful feedback
about the actual implementation details.
Huw.
June 11, 2018