Wine-Devel
Threads by month
- ----- 2026 -----
- 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
- 6 participants
- 84545 discussions
[PATCH vkd3d v4 6/8] vkd3d-shader/hlsl: Don't check exact number of components for braceless initialization of numeric types.
by Francisco Casas March 9, 2022
by Francisco Casas March 9, 2022
March 9, 2022
The implicit conversion in add_assignment() takes responsability now.
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
v4:
- No changes from v3.
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.y | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 3989c7dd..4ced58c9 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1602,19 +1602,17 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
unsigned int size = initializer_size(&v->initializer);
struct hlsl_ir_load *load;
- if (type->type <= HLSL_CLASS_LAST_NUMERIC
- && type->dimx * type->dimy != size && size != 1)
+ if (type->type <= HLSL_CLASS_LAST_NUMERIC && v->initializer.braces
+ && type->dimx * type->dimy != size)
{
- if (size < type->dimx * type->dimy)
- {
- hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
- "Expected %u components in numeric initializer, but got %u.",
- type->dimx * type->dimy, size);
- free_parse_initializer(&v->initializer);
- vkd3d_free(v);
- continue;
- }
+ hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
+ "Expected %u components in numeric initializer, but got %u.",
+ type->dimx * type->dimy, v->initializer.args_count);
+ free_parse_initializer(&v->initializer);
+ vkd3d_free(v);
+ continue;
}
+
if ((type->type == HLSL_CLASS_STRUCT || type->type == HLSL_CLASS_ARRAY)
&& hlsl_type_component_count(type) != size)
{
--
2.25.1
1
0
[PATCH vkd3d v4 5/8] vkd3d-shader/hlsl: Properly free parse_variable_def memory.
by Francisco Casas March 9, 2022
by Francisco Casas March 9, 2022
March 9, 2022
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
v4:
- No changes from v3.
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.y | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index e7c4c307..3989c7dd 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -668,6 +668,15 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_
return new_type;
}
+static void free_parse_variable_def(struct parse_variable_def *v)
+{
+ free_parse_initializer(&v->initializer);
+ vkd3d_free(v->arrays.sizes);
+ vkd3d_free(v->name);
+ vkd3d_free((void *)v->semantic.name);
+ vkd3d_free(v);
+}
+
static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *type, struct list *fields)
{
struct parse_variable_def *v, *v_next;
@@ -685,13 +694,14 @@ static struct list *gen_struct_fields(struct hlsl_ctx *ctx, struct hlsl_type *ty
if (!(field = hlsl_alloc(ctx, sizeof(*field))))
{
- vkd3d_free(v);
+ free_parse_variable_def(v);
return list;
}
field->type = type;
for (i = 0; i < v->arrays.count; ++i)
field->type = hlsl_new_array_type(ctx, field->type, v->arrays.sizes[i]);
+ vkd3d_free(v->arrays.sizes);
field->loc = v->loc;
field->name = v->name;
field->semantic = v->semantic;
@@ -719,7 +729,10 @@ static bool add_typedef(struct hlsl_ctx *ctx, DWORD modifiers, struct hlsl_type
if (!v->arrays.count)
{
if (!(type = hlsl_type_clone(ctx, orig_type, 0, modifiers)))
+ {
+ free_parse_variable_def(v);
return false;
+ }
}
else
{
@@ -729,8 +742,12 @@ static bool add_typedef(struct hlsl_ctx *ctx, DWORD modifiers, struct hlsl_type
for (i = 0; i < v->arrays.count; ++i)
{
if (!(type = hlsl_new_array_type(ctx, type, v->arrays.sizes[i])))
+ {
+ free_parse_variable_def(v);
return false;
+ }
}
+ vkd3d_free(v->arrays.sizes);
vkd3d_free((void *)type->name);
type->name = v->name;
@@ -747,6 +764,7 @@ static bool add_typedef(struct hlsl_ctx *ctx, DWORD modifiers, struct hlsl_type
if (!ret)
hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_REDEFINED,
"Type '%s' is already defined.", v->name);
+ free_parse_initializer(&v->initializer);
vkd3d_free(v);
}
vkd3d_free(list);
@@ -1470,15 +1488,6 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru
vkd3d_free(initializer->args);
}
-static void free_parse_variable_def(struct parse_variable_def *v)
-{
- free_parse_initializer(&v->initializer);
- vkd3d_free(v->arrays.sizes);
- vkd3d_free(v->name);
- vkd3d_free((void *)v->semantic.name);
- vkd3d_free(v);
-}
-
static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_type,
DWORD modifiers, struct list *var_list)
{
@@ -1510,6 +1519,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
type = basic_type;
for (i = 0; i < v->arrays.count; ++i)
type = hlsl_new_array_type(ctx, type, v->arrays.sizes[i]);
+ vkd3d_free(v->arrays.sizes);
if (type->type != HLSL_CLASS_MATRIX)
check_invalid_matrix_modifiers(ctx, modifiers, v->loc);
@@ -1569,6 +1579,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
hlsl_error(ctx, &v->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_INITIALIZER,
"Const variable \"%s\" is missing an initializer.", var->name);
hlsl_free_var(var);
+ free_parse_initializer(&v->initializer);
vkd3d_free(v);
continue;
}
@@ -1581,6 +1592,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
"Variable \"%s\" was already declared in this scope.", var->name);
hlsl_note(ctx, &old->loc, VKD3D_SHADER_LOG_ERROR, "\"%s\" was previously declared here.", old->name);
hlsl_free_var(var);
+ free_parse_initializer(&v->initializer);
vkd3d_free(v);
continue;
}
--
2.25.1
1
0
[PATCH vkd3d v4 4/8] vkd3d-shader/hlsl: Add 'braces' flag to parse initializers.
by Francisco Casas March 9, 2022
by Francisco Casas March 9, 2022
March 9, 2022
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
v4:
- No changes from v3.
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.y | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 365d433f..e7c4c307 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -48,6 +48,7 @@ struct parse_initializer
struct hlsl_ir_node **args;
unsigned int args_count;
struct list *instrs;
+ bool braces;
};
struct parse_array_sizes
@@ -3218,14 +3219,17 @@ complex_initializer:
}
$$.args[0] = node_from_list($1);
$$.instrs = $1;
+ $$.braces = false;
}
| '{' complex_initializer_list '}'
{
$$ = $2;
+ $$.braces = true;
}
| '{' complex_initializer_list ',' '}'
{
$$ = $2;
+ $$.braces = true;
}
complex_initializer_list:
@@ -3256,6 +3260,7 @@ initializer_expr_list:
YYABORT;
$$.args[0] = node_from_list($1);
$$.instrs = $1;
+ $$.braces = false;
}
| initializer_expr_list ',' initializer_expr
{
@@ -3389,6 +3394,7 @@ func_arguments:
$$.args_count = 0;
if (!($$.instrs = make_empty_list(ctx)))
YYABORT;
+ $$.braces = false;
}
| initializer_expr_list
--
2.25.1
1
0
[PATCH vkd3d v4 3/8] vkd3d-shader/hlsl: Concatenate nested initializers.
by Francisco Casas March 9, 2022
by Francisco Casas March 9, 2022
March 9, 2022
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
v4:
- Avoiding leak in case hlsl_realloc fails, also in "initializer_expr_list:".
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.y | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 8c66a33c..365d433f 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -2411,6 +2411,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
%type <function> func_prototype
%type <initializer> complex_initializer
+%type <initializer> complex_initializer_list
%type <initializer> func_arguments
%type <initializer> initializer_expr_list
@@ -3218,15 +3219,32 @@ complex_initializer:
$$.args[0] = node_from_list($1);
$$.instrs = $1;
}
- | '{' initializer_expr_list '}'
+ | '{' complex_initializer_list '}'
{
$$ = $2;
}
- | '{' initializer_expr_list ',' '}'
+ | '{' complex_initializer_list ',' '}'
{
$$ = $2;
}
+complex_initializer_list:
+ complex_initializer
+ | complex_initializer_list ',' complex_initializer
+ {
+ $$ = $1;
+ if (!($$.args = hlsl_realloc(ctx, $$.args, ($$.args_count + $3.args_count) * sizeof(*$$.args))))
+ {
+ free_parse_initializer(&$$);
+ free_parse_initializer(&$3);
+ YYABORT;
+ }
+ for (unsigned int i = 0; i < $3.args_count; i++)
+ $$.args[$$.args_count++] = $3.args[i];
+ list_move_tail($$.instrs, $3.instrs);
+ free_parse_initializer(&$3);
+ }
+
initializer_expr:
assignment_expr
--
2.25.1
1
0
[PATCH vkd3d v4 1/8] vkd3d-shader/hlsl: Allow offsets for scalar and vector variables.
by Francisco Casas March 9, 2022
by Francisco Casas March 9, 2022
March 9, 2022
From: Giovanni Mascellani <gmascellani(a)codeweavers.com>
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
v4:
- No changes from v3.
Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.h | 3 +--
libs/vkd3d-shader/hlsl_codegen.c | 22 +++++-----------------
libs/vkd3d-shader/hlsl_sm1.c | 4 ++--
libs/vkd3d-shader/hlsl_sm4.c | 14 +++++++++-----
4 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 243ed72b..1fd5dc58 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -793,8 +793,7 @@ unsigned int hlsl_swizzle_from_writemask(unsigned int writemask);
bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset);
unsigned int hlsl_offset_from_deref_safe(struct hlsl_ctx *ctx, const struct hlsl_deref *deref);
-struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref,
- const struct hlsl_type *type);
+struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref);
bool hlsl_fold_constants(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context);
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
index 62dbce5e..6da2b3a9 100644
--- a/libs/vkd3d-shader/hlsl_codegen.c
+++ b/libs/vkd3d-shader/hlsl_codegen.c
@@ -1542,11 +1542,6 @@ static void allocate_objects(struct hlsl_ctx *ctx, enum hlsl_base_type type)
}
}
-static bool type_is_single_reg(const struct hlsl_type *type)
-{
- return type->type == HLSL_CLASS_SCALAR || type->type == HLSL_CLASS_VECTOR;
-}
-
bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset)
{
struct hlsl_ir_node *offset_node = deref->offset.node;
@@ -1589,8 +1584,7 @@ unsigned int hlsl_offset_from_deref_safe(struct hlsl_ctx *ctx, const struct hlsl
return 0;
}
-struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref,
- const struct hlsl_type *type)
+struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
{
const struct hlsl_ir_var *var = deref->var;
struct hlsl_reg ret = var->reg;
@@ -1598,16 +1592,10 @@ struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_dere
ret.id += offset / 4;
- if (type_is_single_reg(var->data_type))
- {
- assert(!offset);
- ret.writemask = var->reg.writemask;
- }
- else
- {
- assert(type_is_single_reg(type));
- ret.writemask = ((1 << type->dimx) - 1) << (offset % 4);
- }
+ ret.writemask = 0xf & (0xf << (offset % 4));
+ if (var->reg.writemask)
+ ret.writemask = hlsl_combine_writemasks(var->reg.writemask, ret.writemask);
+
return ret;
}
diff --git a/libs/vkd3d-shader/hlsl_sm1.c b/libs/vkd3d-shader/hlsl_sm1.c
index 90ec6058..f661dbc2 100644
--- a/libs/vkd3d-shader/hlsl_sm1.c
+++ b/libs/vkd3d-shader/hlsl_sm1.c
@@ -663,7 +663,7 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
static void write_sm1_load(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_node *instr)
{
const struct hlsl_ir_load *load = hlsl_ir_load(instr);
- const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &load->src, instr->data_type);
+ const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &load->src);
struct sm1_instruction sm1_instr =
{
.opcode = D3DSIO_MOV,
@@ -707,7 +707,7 @@ static void write_sm1_store(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
{
const struct hlsl_ir_store *store = hlsl_ir_store(instr);
const struct hlsl_ir_node *rhs = store->rhs.node;
- const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &store->lhs, rhs->data_type);
+ const struct hlsl_reg reg = hlsl_reg_from_deref(ctx, &store->lhs);
struct sm1_instruction sm1_instr =
{
.opcode = D3DSIO_MOV,
diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
index 6996bb2d..802db3c1 100644
--- a/libs/vkd3d-shader/hlsl_sm4.c
+++ b/libs/vkd3d-shader/hlsl_sm4.c
@@ -870,6 +870,8 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
if (hlsl_sm4_register_from_semantic(ctx, &var->semantic, false, ®->type, swizzle_type, &has_idx))
{
+ unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref);
+
if (has_idx)
{
reg->idx[0] = var->semantic.index;
@@ -877,11 +879,11 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
}
reg->dim = VKD3D_SM4_DIMENSION_VEC4;
- *writemask = (1u << data_type->dimx) - 1;
+ *writemask = ((1u << data_type->dimx) - 1) << (offset % 4);
}
else
{
- struct hlsl_reg hlsl_reg = hlsl_reg_from_deref(ctx, deref, data_type);
+ struct hlsl_reg hlsl_reg = hlsl_reg_from_deref(ctx, deref);
assert(hlsl_reg.allocated);
reg->type = VKD3D_SM4_RT_INPUT;
@@ -899,6 +901,8 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
if (hlsl_sm4_register_from_semantic(ctx, &var->semantic, true, ®->type, swizzle_type, &has_idx))
{
+ unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref);
+
if (has_idx)
{
reg->idx[0] = var->semantic.index;
@@ -909,11 +913,11 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
reg->dim = VKD3D_SM4_DIMENSION_SCALAR;
else
reg->dim = VKD3D_SM4_DIMENSION_VEC4;
- *writemask = (1u << data_type->dimx) - 1;
+ *writemask = ((1u << data_type->dimx) - 1) << (offset % 4);
}
else
{
- struct hlsl_reg hlsl_reg = hlsl_reg_from_deref(ctx, deref, data_type);
+ struct hlsl_reg hlsl_reg = hlsl_reg_from_deref(ctx, deref);
assert(hlsl_reg.allocated);
reg->type = VKD3D_SM4_RT_OUTPUT;
@@ -925,7 +929,7 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
}
else
{
- struct hlsl_reg hlsl_reg = hlsl_reg_from_deref(ctx, deref, data_type);
+ struct hlsl_reg hlsl_reg = hlsl_reg_from_deref(ctx, deref);
assert(hlsl_reg.allocated);
reg->type = VKD3D_SM4_RT_TEMP;
--
2.25.1
1
0
March 9, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/wininet/tests/http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index cf3f62f868a..706b8fa623b 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -363,7 +363,7 @@ static void _test_http_version(unsigned line, HINTERNET req)
ok_(__FILE__,line)(v.dwMinorVersion == 1, "dwMinorVersion = %d\n", v.dwMinorVersion);
}
-static int close_handle_cnt;
+static LONG close_handle_cnt;
static VOID WINAPI callback(
HINTERNET hInternet,
2
3
Log: for driver "SHARP DX-2008UC", the wrong value for bmformat causes incorrect color picture data to be printed.
Signed-off-by: zhaoyi <zhaoyi(a)uniontech.com>
Change-Id: I9818dbd86f8a58777e185a76f027fd1c30b7f7ff
---
dlls/mscms/liblcms.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/mscms/liblcms.c b/dlls/mscms/liblcms.c
index 1f43c359c4..522e1dc3d0 100644
--- a/dlls/mscms/liblcms.c
+++ b/dlls/mscms/liblcms.c
@@ -49,12 +49,12 @@ static DWORD from_bmformat( BMFORMAT format )
switch (format)
{
- case BM_RGBTRIPLETS: ret = TYPE_RGB_8; break;
- case BM_BGRTRIPLETS: ret = TYPE_BGR_8; break;
+ case BM_RGBTRIPLETS: ret = TYPE_BGR_8; break;
+ case BM_BGRTRIPLETS: ret = TYPE_RGB_8; break;
case BM_GRAY: ret = TYPE_GRAY_8; break;
- case BM_xRGBQUADS: ret = TYPE_ARGB_8; break;
- case BM_xBGRQUADS: ret = TYPE_ABGR_8; break;
- case BM_KYMCQUADS: ret = TYPE_KYMC_8; break;
+ case BM_xRGBQUADS: ret = TYPE_ABGR_8; break;
+ case BM_xBGRQUADS: ret = TYPE_ARGB_8; break;
+ case BM_KYMCQUADS: ret = TYPE_CMYK_8; break;
default:
if (!quietfixme)
{
--
2.20.1
3
2
Implements IsNoCacheReponse based on IsNoStoreReponse implementation.
Signed-off-by: Pat Leamon <pleamonhp(a)yahoo.com.au>
---
dlls/mshtml/nsio.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c
index fc6602eddf4..33d26670e4c 100644
--- a/dlls/mshtml/nsio.c
+++ b/dlls/mshtml/nsio.c
@@ -1501,10 +1501,15 @@ static nsresult NSAPI nsChannel_IsNoStoreResponse(nsIHttpChannel *iface, cpp_boo
static nsresult NSAPI nsChannel_IsNoCacheResponse(nsIHttpChannel *iface, cpp_bool *_retval)
{
nsChannel *This = impl_from_nsIHttpChannel(iface);
+ http_header_t *header;
- FIXME("(%p)->(%p)\n", This, _retval);
+ static const WCHAR cache_controlW[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l'};
- return NS_ERROR_NOT_IMPLEMENTED;
+ TRACE("(%p)->(%p)\n", This, _retval);
+
+ header = find_http_header(&This->response_headers, cache_controlW, ARRAY_SIZE(cache_controlW));
+ *_retval = header && !wcsicmp(header->data, L"no-cache");
+ return NS_OK;
}
static nsresult NSAPI nsChannel_IsPrivateResponse(nsIHttpChannel *iface, cpp_bool *_retval)
--
2.25.1
1
0
[PATCH] dlls/kernel32/tests/change.c, time.c: enable compilation with long types
by Eric Pouech March 9, 2022
by Eric Pouech March 9, 2022
March 9, 2022
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/kernel32/tests/change.c | 159 +++++++++++++++++++++---------------------
dlls/kernel32/tests/time.c | 139 ++++++++++++++++++-------------------
2 files changed, 150 insertions(+), 148 deletions(-)
diff --git a/dlls/kernel32/tests/change.c b/dlls/kernel32/tests/change.c
index c0fcf00ba68..97578fe68bd 100644
--- a/dlls/kernel32/tests/change.c
+++ b/dlls/kernel32/tests/change.c
@@ -18,6 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
/* TODO: - security attribute changes
* - compound filter and multiple notifications
@@ -51,7 +52,7 @@ static DWORD CALLBACK NotificationThread(LPVOID arg)
}
ret = FindCloseChangeNotification(change);
- ok( ret, "FindCloseChangeNotification error: %d\n",
+ ok( ret, "FindCloseChangeNotification error: %ld\n",
GetLastError());
ExitThread((DWORD)notified);
@@ -63,10 +64,10 @@ static HANDLE StartNotificationThread(LPCSTR path, BOOL subtree, DWORD flags)
DWORD threadId;
change = FindFirstChangeNotificationA(path, subtree, flags);
- ok(change != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %d\n", GetLastError());
+ ok(change != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %ld\n", GetLastError());
thread = CreateThread(NULL, 0, NotificationThread, change, 0, &threadId);
- ok(thread != NULL, "CreateThread error: %d\n", GetLastError());
+ ok(thread != NULL, "CreateThread error: %ld\n", GetLastError());
return thread;
}
@@ -76,7 +77,7 @@ static DWORD FinishNotificationThread(HANDLE thread)
DWORD status, exitcode;
status = WaitForSingleObject(thread, 5000);
- ok(status == WAIT_OBJECT_0, "WaitForSingleObject status %d error %d\n", status, GetLastError());
+ ok(status == WAIT_OBJECT_0, "WaitForSingleObject status %ld error %ld\n", status, GetLastError());
ok(GetExitCodeThread(thread, &exitcode), "Could not retrieve thread exit code\n");
CloseHandle(thread);
@@ -100,46 +101,46 @@ static void test_FindFirstChangeNotification(void)
change = FindFirstChangeNotificationA("not-a-file", FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
ok(change == INVALID_HANDLE_VALUE, "Expected INVALID_HANDLE_VALUE, got %p\n", change);
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
- "FindFirstChangeNotification error: %d\n", GetLastError());
+ "FindFirstChangeNotification error: %ld\n", GetLastError());
change = FindFirstChangeNotificationA(NULL, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
ok(change == INVALID_HANDLE_VALUE || broken(change == NULL) /* < win7 */,
"Expected INVALID_HANDLE_VALUE, got %p\n", change);
ok(GetLastError() == ERROR_PATH_NOT_FOUND,
- "FindFirstChangeNotification error: %u\n", GetLastError());
+ "FindFirstChangeNotification error: %lu\n", GetLastError());
ret = FindNextChangeNotification(NULL);
- ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "FindNextChangeNotification error: %d\n",
+ ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "FindNextChangeNotification error: %ld\n",
GetLastError());
ret = FindCloseChangeNotification(NULL);
- ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "FindCloseChangeNotification error: %d\n",
+ ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "FindCloseChangeNotification error: %ld\n",
GetLastError());
ret = GetTempPathA(MAX_PATH, dirname1);
- ok(ret, "GetTempPathA error: %d\n", GetLastError());
+ ok(ret, "GetTempPathA error: %ld\n", GetLastError());
ret = GetTempFileNameA(dirname1, "ffc", 0, workdir);
- ok(ret, "GetTempFileNameA error: %d\n", GetLastError());
+ ok(ret, "GetTempFileNameA error: %ld\n", GetLastError());
DeleteFileA( workdir );
ret = CreateDirectoryA(workdir, NULL);
- ok(ret, "CreateDirectoryA error: %d\n", GetLastError());
+ ok(ret, "CreateDirectoryA error: %ld\n", GetLastError());
ret = GetTempFileNameA(workdir, prefix, 0, filename1);
- ok(ret, "GetTempFileNameA error: %d\n", GetLastError());
+ ok(ret, "GetTempFileNameA error: %ld\n", GetLastError());
file = CreateFileA(filename1, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
- ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %d\n", GetLastError());
+ ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ret = CloseHandle(file);
- ok( ret, "CloseHandle error: %d\n", GetLastError());
+ ok( ret, "CloseHandle error: %ld\n", GetLastError());
/* Try to register notification for a file */
change = FindFirstChangeNotificationA(filename1, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
ok(change == INVALID_HANDLE_VALUE, "Expected INVALID_HANDLE_VALUE, got %p\n", change);
ok(GetLastError() == ERROR_DIRECTORY,
- "FindFirstChangeNotification error: %d\n", GetLastError());
+ "FindFirstChangeNotification error: %ld\n", GetLastError());
lstrcpyA(dirname1, filename1);
lstrcatA(dirname1, "dir");
@@ -148,18 +149,18 @@ static void test_FindFirstChangeNotification(void)
lstrcatA(dirname2, "new");
ret = CreateDirectoryA(dirname1, NULL);
- ok(ret, "CreateDirectoryA error: %d\n", GetLastError());
+ ok(ret, "CreateDirectoryA error: %ld\n", GetLastError());
/* What if we move the directory we registered notification for? */
thread = StartNotificationThread(dirname1, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME);
ret = MoveFileA(dirname1, dirname2);
- ok(ret, "MoveFileA error: %d\n", GetLastError());
+ ok(ret, "MoveFileA error: %ld\n", GetLastError());
ok(!FinishNotificationThread(thread), "Got notification\n");
/* What if we remove the directory we registered notification for? */
thread = StartNotificationThread(dirname2, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME);
ret = RemoveDirectoryA(dirname2);
- ok(ret, "RemoveDirectoryA error: %d\n", GetLastError());
+ ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError());
ret = FinishNotificationThread(thread);
todo_wine ok(ret, "Missed notification\n");
@@ -168,19 +169,19 @@ static void test_FindFirstChangeNotification(void)
/* Create a directory */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME);
ret = CreateDirectoryA(dirname1, NULL);
- ok(ret, "CreateDirectoryA error: %d\n", GetLastError());
+ ok(ret, "CreateDirectoryA error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Rename a directory */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME);
ret = MoveFileA(dirname1, dirname2);
- ok(ret, "MoveFileA error: %d\n", GetLastError());
+ ok(ret, "MoveFileA error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Delete a directory */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_DIR_NAME);
ret = RemoveDirectoryA(dirname2);
- ok(ret, "RemoveDirectoryA error: %d\n", GetLastError());
+ ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
lstrcpyA(filename2, filename1);
@@ -189,64 +190,64 @@ static void test_FindFirstChangeNotification(void)
/* Rename a file */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
ret = MoveFileA(filename1, filename2);
- ok(ret, "MoveFileA error: %d\n", GetLastError());
+ ok(ret, "MoveFileA error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Delete a file */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
ret = DeleteFileA(filename2);
- ok(ret, "DeleteFileA error: %d\n", GetLastError());
+ ok(ret, "DeleteFileA error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Create a file */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME);
file = CreateFileA(filename2, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
- ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %d\n", GetLastError());
+ ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ret = CloseHandle(file);
- ok( ret, "CloseHandle error: %d\n", GetLastError());
+ ok( ret, "CloseHandle error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
attributes = GetFileAttributesA(filename2);
- ok(attributes != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA error: %d\n", GetLastError());
+ ok(attributes != INVALID_FILE_ATTRIBUTES, "GetFileAttributesA error: %ld\n", GetLastError());
attributes &= FILE_ATTRIBUTE_READONLY;
/* Change file attributes */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_ATTRIBUTES);
ret = SetFileAttributesA(filename2, attributes);
- ok(ret, "SetFileAttributesA error: %d\n", GetLastError());
+ ok(ret, "SetFileAttributesA error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Change last write time by writing to a file */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_LAST_WRITE);
file = CreateFileA(filename2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
- ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %d\n", GetLastError());
+ ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
memset(buffer, 0, sizeof(buffer));
ret = WriteFile(file, buffer, sizeof(buffer), &count, NULL);
- ok(ret && count == sizeof(buffer), "WriteFile error: %d\n", GetLastError());
+ ok(ret && count == sizeof(buffer), "WriteFile error: %ld\n", GetLastError());
ret = CloseHandle(file);
- ok( ret, "CloseHandle error: %d\n", GetLastError());
+ ok( ret, "CloseHandle error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* Change file size by truncating a file */
thread = StartNotificationThread(workdir, FALSE, FILE_NOTIFY_CHANGE_SIZE);
file = CreateFileA(filename2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, 0);
- ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %d\n", GetLastError());
+ ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError());
ret = WriteFile(file, buffer, sizeof(buffer) / 2, &count, NULL);
- ok(ret && count == sizeof(buffer) / 2, "WriteFileA error: %d\n", GetLastError());
+ ok(ret && count == sizeof(buffer) / 2, "WriteFileA error: %ld\n", GetLastError());
ret = CloseHandle(file);
- ok( ret, "CloseHandle error: %d\n", GetLastError());
+ ok( ret, "CloseHandle error: %ld\n", GetLastError());
ok(FinishNotificationThread(thread), "Missed notification\n");
/* clean up */
ret = DeleteFileA(filename2);
- ok(ret, "DeleteFileA error: %d\n", GetLastError());
+ ok(ret, "DeleteFileA error: %ld\n", GetLastError());
ret = RemoveDirectoryA(workdir);
- ok(ret, "RemoveDirectoryA error: %d\n", GetLastError());
+ ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError());
}
/* this test concentrates more on the wait behaviour of the handle */
@@ -287,7 +288,7 @@ static void test_ffcn(void)
file = CreateFileW( filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 );
- ok( file != INVALID_HANDLE_VALUE, "CreateFile error %u\n", GetLastError() );
+ ok( file != INVALID_HANDLE_VALUE, "CreateFile error %lu\n", GetLastError() );
CloseHandle(file);
r = WaitForSingleObject( handle, 0 );
@@ -364,20 +365,20 @@ static void test_ffcnMultipleThreads(void)
char tmp[MAX_PATH], path[MAX_PATH];
r = GetTempPathA(MAX_PATH, tmp);
- ok(r, "GetTempPathA error: %d\n", GetLastError());
+ ok(r, "GetTempPathA error: %ld\n", GetLastError());
r = GetTempFileNameA(tmp, "ffc", 0, path);
- ok(r, "GetTempFileNameA error: %d\n", GetLastError());
+ ok(r, "GetTempFileNameA error: %ld\n", GetLastError());
DeleteFileA( path );
r = CreateDirectoryA(path, NULL);
- ok(r, "CreateDirectoryA error: %d\n", GetLastError());
+ ok(r, "CreateDirectoryA error: %ld\n", GetLastError());
filter = FILE_NOTIFY_CHANGE_FILE_NAME;
filter |= FILE_NOTIFY_CHANGE_DIR_NAME;
handles[0] = FindFirstChangeNotificationA(path, FALSE, filter);
- ok(handles[0] != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %d\n", GetLastError());
+ ok(handles[0] != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %ld\n", GetLastError());
/* Test behavior if a waiting thread holds the last reference to a change
* directory object with an empty wine user APC queue for this thread (bug #7286) */
@@ -385,10 +386,10 @@ static void test_ffcnMultipleThreads(void)
/* Create our notification thread */
handles[1] = CreateThread(NULL, 0, NotificationThread, handles[0], 0,
&threadId);
- ok(handles[1] != NULL, "CreateThread error: %d\n", GetLastError());
+ ok(handles[1] != NULL, "CreateThread error: %ld\n", GetLastError());
status = WaitForMultipleObjects(2, handles, FALSE, 5000);
- ok(status == WAIT_OBJECT_0 || status == WAIT_OBJECT_0+1, "WaitForMultipleObjects status %d error %d\n", status, GetLastError());
+ ok(status == WAIT_OBJECT_0 || status == WAIT_OBJECT_0+1, "WaitForMultipleObjects status %ld error %ld\n", status, GetLastError());
ok(GetExitCodeThread(handles[1], &exitcode), "Could not retrieve thread exit code\n");
/* Clean up */
@@ -614,18 +615,18 @@ static void test_readdirectorychanges(void)
/* we may get a notification for the parent dir too */
if (pfni->Action == FILE_ACTION_MODIFIED && pfni->NextEntryOffset)
{
- ok( pfni->FileNameLength == 3*sizeof(WCHAR), "len wrong %u\n", pfni->FileNameLength );
+ ok( pfni->FileNameLength == 3*sizeof(WCHAR), "len wrong %lu\n", pfni->FileNameLength );
ok( !memcmp(pfni->FileName,&szGa[1],3*sizeof(WCHAR)), "name wrong\n" );
pfni = (PFILE_NOTIFY_INFORMATION)((char *)pfni + pfni->NextEntryOffset);
}
- ok( pfni->NextEntryOffset == 0, "offset wrong %u\n", pfni->NextEntryOffset );
- ok( pfni->Action == FILE_ACTION_REMOVED, "action wrong %u\n", pfni->Action );
- ok( pfni->FileNameLength == 6*sizeof(WCHAR), "len wrong %u\n", pfni->FileNameLength );
+ ok( pfni->NextEntryOffset == 0, "offset wrong %lu\n", pfni->NextEntryOffset );
+ ok( pfni->Action == FILE_ACTION_REMOVED, "action wrong %lu\n", pfni->Action );
+ ok( pfni->FileNameLength == 6*sizeof(WCHAR), "len wrong %lu\n", pfni->FileNameLength );
ok( !memcmp(pfni->FileName,&szGa[1],6*sizeof(WCHAR)), "name wrong\n" );
ok( (NTSTATUS)ov.Internal == STATUS_SUCCESS, "ov.Internal wrong\n");
dwCount = (char *)&pfni->FileName[pfni->FileNameLength/sizeof(WCHAR)] - buffer;
- ok( ov.InternalHigh == dwCount, "ov.InternalHigh wrong %lu/%u\n",ov.InternalHigh, dwCount );
+ ok( ov.InternalHigh == dwCount, "ov.InternalHigh wrong %Iu/%lu\n",ov.InternalHigh, dwCount );
CloseHandle(hdir);
@@ -799,7 +800,7 @@ static void test_readdirectorychanges_filedir(void)
static void CALLBACK readdirectorychanges_cr(DWORD error, DWORD len, LPOVERLAPPED ov)
{
- ok(error == 0, "ReadDirectoryChangesW error %d\n", error);
+ ok(error == 0, "ReadDirectoryChangesW error %ld\n", error);
ok(ov->hEvent == (void*)0xdeadbeef, "hEvent should not have changed\n");
}
@@ -853,9 +854,9 @@ static void test_readdirectorychanges_cr(void)
r = SleepEx(1000, TRUE);
ok(r != 0, "failed to receive file creation event\n");
ok(fni->NextEntryOffset == 0, "there should be no more events in buffer\n");
- ok(fni->Action == FILE_ACTION_ADDED, "Action = %d\n", fni->Action);
+ ok(fni->Action == FILE_ACTION_ADDED, "Action = %ld\n", fni->Action);
ok(fni->FileNameLength == lstrlenW(szFile)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni->FileNameLength);
+ "FileNameLength = %ld\n", fni->FileNameLength);
ok(!memcmp(fni->FileName, szFile, lstrlenW(szFile)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni->FileName, fni->FileNameLength/sizeof(WCHAR)));
@@ -873,9 +874,9 @@ static void test_readdirectorychanges_cr(void)
r = SleepEx(1000, TRUE);
ok(r != 0, "failed to receive file move event\n");
ok(fni->NextEntryOffset == 0, "there should be no more events in buffer\n");
- ok(fni->Action == FILE_ACTION_REMOVED, "Action = %d\n", fni->Action);
+ ok(fni->Action == FILE_ACTION_REMOVED, "Action = %ld\n", fni->Action);
ok(fni->FileNameLength == lstrlenW(szFile)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni->FileNameLength);
+ "FileNameLength = %ld\n", fni->FileNameLength);
ok(!memcmp(fni->FileName, szFile, lstrlenW(szFile)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni->FileName, fni->FileNameLength/sizeof(WCHAR)));
@@ -889,9 +890,9 @@ static void test_readdirectorychanges_cr(void)
r = SleepEx(1000, TRUE);
ok(r != 0, "failed to receive file move event\n");
ok(fni->NextEntryOffset == 0, "there should be no more events in buffer\n");
- ok(fni->Action == FILE_ACTION_ADDED, "Action = %d\n", fni->Action);
+ ok(fni->Action == FILE_ACTION_ADDED, "Action = %ld\n", fni->Action);
ok(fni->FileNameLength == lstrlenW(szFile)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni->FileNameLength);
+ "FileNameLength = %ld\n", fni->FileNameLength);
ok(!memcmp(fni->FileName, szFile, lstrlenW(szFile)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni->FileName, fni->FileNameLength/sizeof(WCHAR)));
@@ -905,9 +906,9 @@ static void test_readdirectorychanges_cr(void)
r = SleepEx(1000, TRUE);
ok(r != 0, "failed to receive file removal event\n");
ok(fni->NextEntryOffset == 0, "there should be no more events in buffer\n");
- ok(fni->Action == FILE_ACTION_REMOVED, "Action = %d\n", fni->Action);
+ ok(fni->Action == FILE_ACTION_REMOVED, "Action = %ld\n", fni->Action);
ok(fni->FileNameLength == lstrlenW(szFile)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni->FileNameLength);
+ "FileNameLength = %ld\n", fni->FileNameLength);
ok(!memcmp(fni->FileName, szFile, lstrlenW(szFile)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni->FileName, fni->FileNameLength/sizeof(WCHAR)));
@@ -929,17 +930,17 @@ static void test_readdirectorychanges_cr(void)
ok(r != 0, "failed to receive directory move event\n");
if (fni->Action == FILE_ACTION_RENAMED_OLD_NAME)
{
- ok(fni->Action == FILE_ACTION_RENAMED_OLD_NAME, "Action = %d\n", fni->Action);
+ ok(fni->Action == FILE_ACTION_RENAMED_OLD_NAME, "Action = %ld\n", fni->Action);
ok(fni->FileNameLength == lstrlenW(szDir)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni->FileNameLength);
+ "FileNameLength = %ld\n", fni->FileNameLength);
ok(!memcmp(fni->FileName, szDir, lstrlenW(szDir)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni->FileName, fni->FileNameLength/sizeof(WCHAR)));
ok(fni->NextEntryOffset != 0, "no next entry in movement event\n");
fni_next = (FILE_NOTIFY_INFORMATION*)((char*)fni+fni->NextEntryOffset);
ok(fni_next->NextEntryOffset == 0, "there should be no more events in buffer\n");
- ok(fni_next->Action == FILE_ACTION_RENAMED_NEW_NAME, "Action = %d\n", fni_next->Action);
+ ok(fni_next->Action == FILE_ACTION_RENAMED_NEW_NAME, "Action = %ld\n", fni_next->Action);
ok(fni_next->FileNameLength == lstrlenW(szFile)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni_next->FileNameLength);
+ "FileNameLength = %ld\n", fni_next->FileNameLength);
ok(!memcmp(fni_next->FileName, szFile, lstrlenW(szFile)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni_next->FileName, fni_next->FileNameLength/sizeof(WCHAR)));
}
@@ -970,9 +971,9 @@ static void test_readdirectorychanges_cr(void)
r = SleepEx(1000, TRUE);
ok(r != 0, "failed to receive directory creation event\n");
- ok(fni->Action == FILE_ACTION_ADDED, "Action = %d\n", fni->Action);
+ ok(fni->Action == FILE_ACTION_ADDED, "Action = %ld\n", fni->Action);
ok(fni->FileNameLength == lstrlenW(szDir)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni->FileNameLength);
+ "FileNameLength = %ld\n", fni->FileNameLength);
ok(!memcmp(fni->FileName, szDir, lstrlenW(szDir)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni->FileName, fni->FileNameLength/sizeof(WCHAR)));
if (fni->NextEntryOffset)
@@ -988,9 +989,9 @@ static void test_readdirectorychanges_cr(void)
fni_next = fni;
}
ok(fni_next->NextEntryOffset == 0, "there should be no more events in buffer\n");
- ok(fni_next->Action == FILE_ACTION_REMOVED, "Action = %d\n", fni_next->Action);
+ ok(fni_next->Action == FILE_ACTION_REMOVED, "Action = %ld\n", fni_next->Action);
ok(fni_next->FileNameLength == lstrlenW(szDir)*sizeof(WCHAR),
- "FileNameLength = %d\n", fni_next->FileNameLength);
+ "FileNameLength = %ld\n", fni_next->FileNameLength);
ok(!memcmp(fni_next->FileName, szDir, lstrlenW(szDir)*sizeof(WCHAR)),
"FileName = %s\n", wine_dbgstr_wn(fni_next->FileName, fni_next->FileNameLength/sizeof(WCHAR)));
@@ -1010,21 +1011,21 @@ static void test_ffcn_directory_overlap(void)
/* Setup directory hierarchy */
ret = GetTempPathA(MAX_PATH, workdir);
ok((ret > 0) && (ret <= MAX_PATH),
- "GetTempPathA error: %d\n", GetLastError());
+ "GetTempPathA error: %ld\n", GetLastError());
ret = GetTempFileNameA(workdir, "fcn", 0, tempfile);
- ok(ret, "GetTempFileNameA error: %d\n", GetLastError());
+ ok(ret, "GetTempFileNameA error: %ld\n", GetLastError());
ret = DeleteFileA(tempfile);
- ok(ret, "DeleteFileA error: %d\n", GetLastError());
+ ok(ret, "DeleteFileA error: %ld\n", GetLastError());
lstrcpyA(parentdir, tempfile);
ret = CreateDirectoryA(parentdir, NULL);
- ok(ret, "CreateDirectoryA error: %d\n", GetLastError());
+ ok(ret, "CreateDirectoryA error: %ld\n", GetLastError());
lstrcpyA(childdir, parentdir);
lstrcatA(childdir, "\\c");
ret = CreateDirectoryA(childdir, NULL);
- ok(ret, "CreateDirectoryA error: %d\n", GetLastError());
+ ok(ret, "CreateDirectoryA error: %ld\n", GetLastError());
/* When recursively watching overlapping directories, changes in child
@@ -1036,7 +1037,7 @@ static void test_ffcn_directory_overlap(void)
/* Create a file in child */
ret = GetTempFileNameA(childdir, "fcn", 0, tempfile);
- ok(ret, "GetTempFileNameA error: %d\n", GetLastError());
+ ok(ret, "GetTempFileNameA error: %ld\n", GetLastError());
/* Both watches should trigger */
ret = FinishNotificationThread(parent_thread);
@@ -1045,7 +1046,7 @@ static void test_ffcn_directory_overlap(void)
ok(ret, "Missed child notification\n");
ret = DeleteFileA(tempfile);
- ok(ret, "DeleteFileA error: %d\n", GetLastError());
+ ok(ret, "DeleteFileA error: %ld\n", GetLastError());
/* Removing a recursive parent watch should not affect child watches. Doing
@@ -1053,22 +1054,22 @@ static void test_ffcn_directory_overlap(void)
parent_watch = FindFirstChangeNotificationA(parentdir, TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME);
ok(parent_watch != INVALID_HANDLE_VALUE,
- "FindFirstChangeNotification error: %d\n", GetLastError());
+ "FindFirstChangeNotification error: %ld\n", GetLastError());
child_watch = FindFirstChangeNotificationA(childdir, TRUE,
FILE_NOTIFY_CHANGE_FILE_NAME);
ok(child_watch != INVALID_HANDLE_VALUE,
- "FindFirstChangeNotification error: %d\n", GetLastError());
+ "FindFirstChangeNotification error: %ld\n", GetLastError());
ret = FindCloseChangeNotification(parent_watch);
- ok(ret, "FindCloseChangeNotification error: %d\n", GetLastError());
+ ok(ret, "FindCloseChangeNotification error: %ld\n", GetLastError());
child_thread = CreateThread(NULL, 0, NotificationThread, child_watch, 0,
&threadId);
- ok(child_thread != NULL, "CreateThread error: %d\n", GetLastError());
+ ok(child_thread != NULL, "CreateThread error: %ld\n", GetLastError());
/* Create a file in child */
ret = GetTempFileNameA(childdir, "fcn", 0, tempfile);
- ok(ret, "GetTempFileNameA error: %d\n", GetLastError());
+ ok(ret, "GetTempFileNameA error: %ld\n", GetLastError());
/* Child watch should trigger */
ret = FinishNotificationThread(child_thread);
@@ -1076,13 +1077,13 @@ static void test_ffcn_directory_overlap(void)
/* clean up */
ret = DeleteFileA(tempfile);
- ok(ret, "DeleteFileA error: %d\n", GetLastError());
+ ok(ret, "DeleteFileA error: %ld\n", GetLastError());
ret = RemoveDirectoryA(childdir);
- ok(ret, "RemoveDirectoryA error: %d\n", GetLastError());
+ ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError());
ret = RemoveDirectoryA(parentdir);
- ok(ret, "RemoveDirectoryA error: %d\n", GetLastError());
+ ok(ret, "RemoveDirectoryA error: %ld\n", GetLastError());
}
START_TEST(change)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 0ae272311bb..147413402e5 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -18,6 +18,7 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#undef WINE_NO_LONG_TYPES /* temporary for migration */
#include "wine/test.h"
#include "winbase.h"
@@ -122,14 +123,14 @@ static void test_conversions(void)
SETUP_ZEROTIME(st)
ok (SystemTimeToFileTime(&st, &ft), "Conversion failed ZERO_TIME\n");
ok( (!((ft.dwHighDateTime != 0) || (ft.dwLowDateTime != 0))),
- "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
+ "Wrong time for ATIME: %08lx %08lx (correct %08x %08x)\n",
ft.dwLowDateTime, ft.dwHighDateTime, 0, 0);
SETUP_ATIME(st)
ok (SystemTimeToFileTime(&st,&ft), "Conversion Failed ATIME\n");
ok( (!((ft.dwHighDateTime != ATIME_HI) || (ft.dwLowDateTime!=ATIME_LOW))),
- "Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
+ "Wrong time for ATIME: %08lx %08lx (correct %08x %08x)\n",
ft.dwLowDateTime, ft.dwHighDateTime, ATIME_LOW, ATIME_HI);
@@ -138,7 +139,7 @@ static void test_conversions(void)
ok( (!((ft.dwHighDateTime != MAYDAY_2002_HI) ||
(ft.dwLowDateTime!=MAYDAY_2002_LO))),
- "Wrong time for 2002 %08x %08x (correct %08x %08x)\n", ft.dwLowDateTime,
+ "Wrong time for 2002 %08lx %08lx (correct %08x %08x)\n", ft.dwLowDateTime,
ft.dwHighDateTime, MAYDAY_2002_LO, MAYDAY_2002_HI);
@@ -147,7 +148,7 @@ static void test_conversions(void)
ok( (!((ft.dwHighDateTime!=NEWYEAR_1980_HI) ||
(ft.dwLowDateTime!=NEWYEAR_1980_LO))) ,
- "Wrong time for 1980 %08x %08x (correct %08x %08x)\n", ft.dwLowDateTime,
+ "Wrong time for 1980 %08lx %08lx (correct %08x %08x)\n", ft.dwLowDateTime,
ft.dwHighDateTime, NEWYEAR_1980_LO,NEWYEAR_1980_HI );
ok(DosDateTimeToFileTime(DOS_DATE(1980,1,1),DOS_TIME(0,0,0),&ft),
@@ -155,7 +156,7 @@ static void test_conversions(void)
ok( (!((ft.dwHighDateTime!=NEWYEAR_1980_HI) ||
(ft.dwLowDateTime!=NEWYEAR_1980_LO))),
- "Wrong time DosDateTimeToFileTime %08x %08x (correct %08x %08x)\n",
+ "Wrong time DosDateTimeToFileTime %08lx %08lx (correct %08x %08x)\n",
ft.dwHighDateTime, ft.dwLowDateTime, NEWYEAR_1980_HI, NEWYEAR_1980_LO);
}
@@ -173,7 +174,7 @@ static void test_invalid_arg(void)
"DosDateTimeToFileTime() failed\n");
ok( (ft.dwHighDateTime==NEWYEAR_1980_HI) && (ft.dwLowDateTime==NEWYEAR_1980_LO),
- "filetime for 1/1/80 00:00:00 was %08x %08x\n", ft.dwHighDateTime, ft.dwLowDateTime);
+ "filetime for 1/1/80 00:00:00 was %08lx %08lx\n", ft.dwHighDateTime, ft.dwLowDateTime);
/* now check SystemTimeToFileTime */
memset(&ft,0,sizeof ft);
@@ -206,7 +207,7 @@ static LONGLONG system_time_to_minutes(const SYSTEMTIME *st)
SetLastError(0xdeadbeef);
ret = SystemTimeToFileTime(st, &ft);
- ok(ret, "SystemTimeToFileTime error %u\n", GetLastError());
+ ok(ret, "SystemTimeToFileTime error %lu\n", GetLastError());
minutes = ((LONGLONG)ft.dwHighDateTime << 32) + ft.dwLowDateTime;
minutes /= (LONGLONG)600000000; /* convert to minutes */
@@ -226,7 +227,7 @@ static LONG get_tz_bias(const TIME_ZONE_INFORMATION *tzinfo, DWORD tz_id)
return tzinfo->StandardBias;
default:
- trace("unknown time zone id %d\n", tz_id);
+ trace("unknown time zone id %ld\n", tz_id);
/* fall through */
case TIME_ZONE_ID_UNKNOWN:
return 0;
@@ -249,19 +250,19 @@ static void test_GetTimeZoneInformation(void)
SetLastError(0xdeadbeef);
res = SystemTimeToFileTime(&st, &s_ft);
- ok(res, "SystemTimeToFileTime error %u\n", GetLastError());
+ ok(res, "SystemTimeToFileTime error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
res = FileTimeToLocalFileTime(&s_ft, &l_ft);
- ok(res, "FileTimeToLocalFileTime error %u\n", GetLastError());
+ ok(res, "FileTimeToLocalFileTime error %lu\n", GetLastError());
SetLastError(0xdeadbeef);
res = FileTimeToSystemTime(&l_ft, &local);
- ok(res, "FileTimeToSystemTime error %u\n", GetLastError());
+ ok(res, "FileTimeToSystemTime error %lu\n", GetLastError());
l_time = system_time_to_minutes(&local);
tz_id = GetTimeZoneInformation(&tzinfo);
ok(tz_id != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
- trace("tz_id %u (%s)\n", tz_id,
+ trace("tz_id %lu (%s)\n", tz_id,
tz_id == TIME_ZONE_ID_DAYLIGHT ? "TIME_ZONE_ID_DAYLIGHT" :
(tz_id == TIME_ZONE_ID_STANDARD ? "TIME_ZONE_ID_STANDARD" :
(tz_id == TIME_ZONE_ID_UNKNOWN ? "TIME_ZONE_ID_UNKNOWN" :
@@ -269,14 +270,14 @@ static void test_GetTimeZoneInformation(void)
WideCharToMultiByte(CP_ACP, 0, tzinfo.StandardName, -1, std_name, sizeof(std_name), NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, tzinfo.DaylightName, -1, dlt_name, sizeof(dlt_name), NULL, NULL);
- trace("bias %d, %s - %s\n", tzinfo.Bias, std_name, dlt_name);
- trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
+ trace("bias %ld, %s - %s\n", tzinfo.Bias, std_name, dlt_name);
+ trace("standard (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %ld\n",
tzinfo.StandardDate.wDay, tzinfo.StandardDate.wMonth,
tzinfo.StandardDate.wYear, tzinfo.StandardDate.wDayOfWeek,
tzinfo.StandardDate.wHour, tzinfo.StandardDate.wMinute,
tzinfo.StandardDate.wSecond, tzinfo.StandardDate.wMilliseconds,
tzinfo.StandardBias);
- trace("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %d\n",
+ trace("daylight (d/m/y): %u/%02u/%04u day of week %u %u:%02u:%02u.%03u bias %ld\n",
tzinfo.DaylightDate.wDay, tzinfo.DaylightDate.wMonth,
tzinfo.DaylightDate.wYear, tzinfo.DaylightDate.wDayOfWeek,
tzinfo.DaylightDate.wHour, tzinfo.DaylightDate.wMinute,
@@ -285,7 +286,7 @@ static void test_GetTimeZoneInformation(void)
diff = (LONG)(s_time - l_time);
ok(diff == tzinfo.Bias + get_tz_bias(&tzinfo, tz_id),
- "system/local diff %d != tz bias %d\n",
+ "system/local diff %ld != tz bias %ld\n",
diff, tzinfo.Bias + get_tz_bias(&tzinfo, tz_id));
ok(SetEnvironmentVariableA("TZ","GMT0") != 0,
@@ -317,16 +318,16 @@ static void test_GetTimeZoneInformation(void)
return;
}
- ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
+ ok(res, "SystemTimeToTzSpecificLocalTime error %lu\n", GetLastError());
s_time = system_time_to_minutes(¤t);
tzinfo.StandardBias -= 123;
tzinfo.DaylightBias += 456;
res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &local);
- ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
+ ok(res, "SystemTimeToTzSpecificLocalTime error %lu\n", GetLastError());
l_time = system_time_to_minutes(&local);
- ok(l_time - s_time == diff - get_tz_bias(&tzinfo, tz_id), "got %d, expected %d\n",
+ ok(l_time - s_time == diff - get_tz_bias(&tzinfo, tz_id), "got %ld, expected %ld\n",
(LONG)(l_time - s_time), diff - get_tz_bias(&tzinfo, tz_id));
/* pretend that there is no transition dates */
@@ -338,9 +339,9 @@ static void test_GetTimeZoneInformation(void)
tzinfo.StandardDate.wYear = 0;
res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &local);
- ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
+ ok(res, "SystemTimeToTzSpecificLocalTime error %lu\n", GetLastError());
l_time = system_time_to_minutes(&local);
- ok(l_time - s_time == diff, "got %d, expected %d\n",
+ ok(l_time - s_time == diff, "got %ld, expected %ld\n",
(LONG)(l_time - s_time), diff);
/* test 23:01, 31st of December date */
@@ -361,7 +362,7 @@ static void test_GetTimeZoneInformation(void)
utc.wHour = 23;
utc.wMinute = 1;
res = pSystemTimeToTzSpecificLocalTime(&tzinfo, &utc, &local);
- ok(res, "SystemTimeToTzSpecificLocalTime error %u\n", GetLastError());
+ ok(res, "SystemTimeToTzSpecificLocalTime error %lu\n", GetLastError());
ok(local.wYear==2012 && local.wMonth==12 && local.wDay==31 && local.wHour==23 && local.wMinute==1,
"got (%d-%d-%d %02d:%02d), expected (2012-12-31 23:01)\n",
local.wYear, local.wMonth, local.wDay, local.wHour, local.wMinute);
@@ -378,7 +379,7 @@ static void test_FileTimeToSystemTime(void)
ft.dwLowDateTime = 0;
ret = FileTimeToSystemTime(&ft, &st);
ok( ret,
- "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
+ "FileTimeToSystemTime() failed with Error %ld\n",GetLastError());
ok(((st.wYear == 1601) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 0) &&
(st.wMilliseconds == 0)),
@@ -388,7 +389,7 @@ static void test_FileTimeToSystemTime(void)
ft.dwLowDateTime = (UINT)time;
ret = FileTimeToSystemTime(&ft, &st);
ok( ret,
- "FileTimeToSystemTime() failed with Error %d\n",GetLastError());
+ "FileTimeToSystemTime() failed with Error %ld\n",GetLastError());
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
(st.wMilliseconds == 0)),
@@ -415,7 +416,7 @@ static void test_FileTimeToLocalFileTime(void)
ft.dwLowDateTime = (UINT)time;
ret = FileTimeToLocalFileTime(&ft, &lft);
ok( ret,
- "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
+ "FileTimeToLocalFileTime() failed with Error %ld\n",GetLastError());
FileTimeToSystemTime(&lft, &st);
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
@@ -429,7 +430,7 @@ static void test_FileTimeToLocalFileTime(void)
ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n");
ret = FileTimeToLocalFileTime(&ft, &lft);
ok( ret,
- "FileTimeToLocalFileTime() failed with Error %d\n",GetLastError());
+ "FileTimeToLocalFileTime() failed with Error %ld\n",GetLastError());
FileTimeToSystemTime(&lft, &st);
ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) &&
(st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) &&
@@ -647,25 +648,25 @@ static void test_FileTimeToDosDateTime(void)
ret = FileTimeToDosDateTime(&ft, NULL, NULL);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
- "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
SetLastError(0xdeadbeef);
ret = FileTimeToDosDateTime(&ft, &fatdate, NULL);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
- "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
SetLastError(0xdeadbeef);
ret = FileTimeToDosDateTime(&ft, NULL, &fattime);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
- "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
SetLastError(0xdeadbeef);
ret = FileTimeToDosDateTime(&ft, &fatdate, &fattime);
ok(!ret, "expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
- "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+ "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
}
static void test_GetCalendarInfo(void)
@@ -683,57 +684,57 @@ static void test_GetCalendarInfo(void)
ret = pGetCalendarInfoA( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
NULL, 0, &val1 );
- ok( ret, "GetCalendarInfoA failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoA failed err %lu\n", GetLastError() );
ok( ret == sizeof(val1), "wrong size %u\n", ret );
- ok( val1 >= 2000 && val1 < 2100, "wrong value %u\n", val1 );
+ ok( val1 >= 2000 && val1 < 2100, "wrong value %lu\n", val1 );
ret = pGetCalendarInfoW( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
NULL, 0, &val2 );
- ok( ret, "GetCalendarInfoW failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoW failed err %lu\n", GetLastError() );
ok( ret == sizeof(val2)/sizeof(WCHAR), "wrong size %u\n", ret );
- ok( val1 == val2, "A/W mismatch %u/%u\n", val1, val2 );
+ ok( val1 == val2, "A/W mismatch %lu/%lu\n", val1, val2 );
ret = pGetCalendarInfoA( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX, bufferA, sizeof(bufferA), NULL );
- ok( ret, "GetCalendarInfoA failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoA failed err %lu\n", GetLastError() );
ok( ret == 5, "wrong size %u\n", ret );
- ok( atoi( bufferA ) == val1, "wrong value %s/%u\n", bufferA, val1 );
+ ok( atoi( bufferA ) == val1, "wrong value %s/%lu\n", bufferA, val1 );
ret = pGetCalendarInfoW( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX, bufferW, ARRAY_SIZE(bufferW), NULL );
- ok( ret, "GetCalendarInfoW failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoW failed err %lu\n", GetLastError() );
ok( ret == 5, "wrong size %u\n", ret );
memset( bufferA, 0x55, sizeof(bufferA) );
WideCharToMultiByte( CP_ACP, 0, bufferW, -1, bufferA, sizeof(bufferA), NULL, NULL );
- ok( atoi( bufferA ) == val1, "wrong value %s/%u\n", bufferA, val1 );
+ ok( atoi( bufferA ) == val1, "wrong value %s/%lu\n", bufferA, val1 );
ret = pGetCalendarInfoA( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
NULL, 0, NULL );
ok( !ret, "GetCalendarInfoA succeeded\n" );
- ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
ret = pGetCalendarInfoA( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX, NULL, 0, NULL );
- ok( ret, "GetCalendarInfoA failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoA failed err %lu\n", GetLastError() );
ok( ret == 5, "wrong size %u\n", ret );
ret = pGetCalendarInfoW( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX | CAL_RETURN_NUMBER,
NULL, 0, NULL );
ok( !ret, "GetCalendarInfoW succeeded\n" );
- ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
ret = pGetCalendarInfoW( 0x0409, CAL_GREGORIAN, CAL_ITWODIGITYEARMAX, NULL, 0, NULL );
- ok( ret, "GetCalendarInfoW failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoW failed err %lu\n", GetLastError() );
ok( ret == 5, "wrong size %u\n", ret );
ret = pGetCalendarInfoA( LANG_SYSTEM_DEFAULT, CAL_GREGORIAN, CAL_SDAYNAME1,
bufferA, sizeof(bufferA), NULL);
- ok( ret, "GetCalendarInfoA failed err %u\n", GetLastError() );
+ ok( ret, "GetCalendarInfoA failed err %lu\n", GetLastError() );
ret2 = pGetCalendarInfoA( LANG_SYSTEM_DEFAULT, CAL_GREGORIAN, CAL_SDAYNAME1,
bufferA, 0, NULL);
- ok( ret2, "GetCalendarInfoA failed err %u\n", GetLastError() );
+ ok( ret2, "GetCalendarInfoA failed err %lu\n", GetLastError() );
ok( ret == ret2, "got %d, expected %d\n", ret2, ret );
ret2 = pGetCalendarInfoW( LANG_SYSTEM_DEFAULT, CAL_GREGORIAN, CAL_SDAYNAME1,
bufferW, ARRAY_SIZE(bufferW), NULL);
- ok( ret2, "GetCalendarInfoW failed err %u\n", GetLastError() );
+ ok( ret2, "GetCalendarInfoW failed err %lu\n", GetLastError() );
ret2 = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
ok( ret == ret2, "got %d, expected %d\n", ret, ret2 );
}
@@ -752,13 +753,13 @@ static void test_GetDynamicTimeZoneInformation(void)
ret = pGetDynamicTimeZoneInformation(&dyninfo);
ret2 = GetTimeZoneInformation(&tzinfo);
- ok(ret == ret2, "got %d, %d\n", ret, ret2);
+ ok(ret == ret2, "got %ld, %ld\n", ret, ret2);
- ok(dyninfo.Bias == tzinfo.Bias, "got %d, %d\n", dyninfo.Bias, tzinfo.Bias);
+ ok(dyninfo.Bias == tzinfo.Bias, "got %ld, %ld\n", dyninfo.Bias, tzinfo.Bias);
ok(!lstrcmpW(dyninfo.StandardName, tzinfo.StandardName), "got std name %s, %s\n",
wine_dbgstr_w(dyninfo.StandardName), wine_dbgstr_w(tzinfo.StandardName));
ok(!memcmp(&dyninfo.StandardDate, &tzinfo.StandardDate, sizeof(dyninfo.StandardDate)), "got different StandardDate\n");
- ok(dyninfo.StandardBias == tzinfo.StandardBias, "got %d, %d\n", dyninfo.StandardBias, tzinfo.StandardBias);
+ ok(dyninfo.StandardBias == tzinfo.StandardBias, "got %ld, %ld\n", dyninfo.StandardBias, tzinfo.StandardBias);
ok(!lstrcmpW(dyninfo.DaylightName, tzinfo.DaylightName), "got daylight name %s, %s\n",
wine_dbgstr_w(dyninfo.DaylightName), wine_dbgstr_w(tzinfo.DaylightName));
ok(!memcmp(&dyninfo.DaylightDate, &tzinfo.DaylightDate, sizeof(dyninfo.DaylightDate)), "got different DaylightDate\n");
@@ -856,7 +857,7 @@ static void test_GetSystemTimes(void)
ok( !NtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength),
"NtQuerySystemInformation failed\n" );
- ok( sizeof(sbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength );
+ ok( sizeof(sbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength );
/* Check if we have some return values */
trace( "Number of Processors : %d\n", sbi.NumberOfProcessors );
@@ -972,30 +973,30 @@ static void test_GetTimeZoneInformationForYear(void)
GetTimeZoneInformation(&local_tzinfo);
ret = pGetTimeZoneInformationForYear(systemtime.wYear, NULL, &tzinfo);
- ok(ret == TRUE, "GetTimeZoneInformationForYear failed, err %u\n", GetLastError());
- ok(tzinfo.Bias == local_tzinfo.Bias, "Expected Bias %d, got %d\n", local_tzinfo.Bias, tzinfo.Bias);
+ ok(ret == TRUE, "GetTimeZoneInformationForYear failed, err %lu\n", GetLastError());
+ ok(tzinfo.Bias == local_tzinfo.Bias, "Expected Bias %ld, got %ld\n", local_tzinfo.Bias, tzinfo.Bias);
ok(!lstrcmpW(tzinfo.StandardName, local_tzinfo.StandardName),
"Expected StandardName %s, got %s\n", wine_dbgstr_w(local_tzinfo.StandardName), wine_dbgstr_w(tzinfo.StandardName));
ok(!memcmp(&tzinfo.StandardDate, &local_tzinfo.StandardDate, sizeof(SYSTEMTIME)), "StandardDate does not match\n");
- ok(tzinfo.StandardBias == local_tzinfo.StandardBias, "Expected StandardBias %d, got %d\n", local_tzinfo.StandardBias, tzinfo.StandardBias);
+ ok(tzinfo.StandardBias == local_tzinfo.StandardBias, "Expected StandardBias %ld, got %ld\n", local_tzinfo.StandardBias, tzinfo.StandardBias);
ok(!lstrcmpW(tzinfo.DaylightName, local_tzinfo.DaylightName),
"Expected DaylightName %s, got %s\n", wine_dbgstr_w(local_tzinfo.DaylightName), wine_dbgstr_w(tzinfo.DaylightName));
ok(!memcmp(&tzinfo.DaylightDate, &local_tzinfo.DaylightDate, sizeof(SYSTEMTIME)), "DaylightDate does not match\n");
- ok(tzinfo.DaylightBias == local_tzinfo.DaylightBias, "Expected DaylightBias %d, got %d\n", local_tzinfo.DaylightBias, tzinfo.DaylightBias);
+ ok(tzinfo.DaylightBias == local_tzinfo.DaylightBias, "Expected DaylightBias %ld, got %ld\n", local_tzinfo.DaylightBias, tzinfo.DaylightBias);
pGetDynamicTimeZoneInformation(&dyn_tzinfo);
ret = pGetTimeZoneInformationForYear(systemtime.wYear, &dyn_tzinfo, &tzinfo);
- ok(ret == TRUE, "GetTimeZoneInformationForYear failed, err %u\n", GetLastError());
- ok(tzinfo.Bias == local_tzinfo.Bias, "Expected Bias %d, got %d\n", local_tzinfo.Bias, tzinfo.Bias);
+ ok(ret == TRUE, "GetTimeZoneInformationForYear failed, err %lu\n", GetLastError());
+ ok(tzinfo.Bias == local_tzinfo.Bias, "Expected Bias %ld, got %ld\n", local_tzinfo.Bias, tzinfo.Bias);
ok(!lstrcmpW(tzinfo.StandardName, local_tzinfo.StandardName),
"Expected StandardName %s, got %s\n", wine_dbgstr_w(local_tzinfo.StandardName), wine_dbgstr_w(tzinfo.StandardName));
ok(!memcmp(&tzinfo.StandardDate, &local_tzinfo.StandardDate, sizeof(SYSTEMTIME)), "StandardDate does not match\n");
- ok(tzinfo.StandardBias == local_tzinfo.StandardBias, "Expected StandardBias %d, got %d\n", local_tzinfo.StandardBias, tzinfo.StandardBias);
+ ok(tzinfo.StandardBias == local_tzinfo.StandardBias, "Expected StandardBias %ld, got %ld\n", local_tzinfo.StandardBias, tzinfo.StandardBias);
ok(!lstrcmpW(tzinfo.DaylightName, local_tzinfo.DaylightName),
"Expected DaylightName %s, got %s\n", wine_dbgstr_w(local_tzinfo.DaylightName), wine_dbgstr_w(tzinfo.DaylightName));
ok(!memcmp(&tzinfo.DaylightDate, &local_tzinfo.DaylightDate, sizeof(SYSTEMTIME)), "DaylightDate does not match\n");
- ok(tzinfo.DaylightBias == local_tzinfo.DaylightBias, "Expected DaylightBias %d, got %d\n", local_tzinfo.DaylightBias, tzinfo.DaylightBias);
+ ok(tzinfo.DaylightBias == local_tzinfo.DaylightBias, "Expected DaylightBias %ld, got %ld\n", local_tzinfo.DaylightBias, tzinfo.DaylightBias);
memset(&dyn_tzinfo, 0xaa, sizeof(dyn_tzinfo));
lstrcpyW(dyn_tzinfo.TimeZoneKeyName, L"Greenland Daylight Time");
@@ -1005,7 +1006,7 @@ static void test_GetTimeZoneInformationForYear(void)
broken_test = TRUE;
ok((ret == FALSE && GetLastError() == ERROR_FILE_NOT_FOUND) ||
broken(broken_test) /* vista,7 */,
- "GetTimeZoneInformationForYear err %u\n", GetLastError());
+ "GetTimeZoneInformationForYear err %lu\n", GetLastError());
memset(&dyn_tzinfo, 0xaa, sizeof(dyn_tzinfo));
lstrcpyW(dyn_tzinfo.TimeZoneKeyName, L"Altai Standard Time");
@@ -1014,7 +1015,7 @@ static void test_GetTimeZoneInformationForYear(void)
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
broken_test = TRUE;
ok(ret == TRUE || broken(broken_test) /* before 10 1809 */,
- "GetTimeZoneInformationForYear err %u\n", GetLastError());
+ "GetTimeZoneInformationForYear err %lu\n", GetLastError());
if (broken(broken_test))
{
@@ -1031,11 +1032,11 @@ static void test_GetTimeZoneInformationForYear(void)
ret = pGetTimeZoneInformationForYear(test_data[i].year, &dyn_tzinfo, &tzinfo);
todo_wine_if(test_data[i].tzinfo_todo)
- ok(ret == TRUE, "GetTimeZoneInformationForYear failed, err %u, for %s\n", GetLastError(), wine_dbgstr_w(test_data[i].tzname));
+ ok(ret == TRUE, "GetTimeZoneInformationForYear failed, err %lu, for %s\n", GetLastError(), wine_dbgstr_w(test_data[i].tzname));
if (!ret)
continue;
todo_wine_if(test_data[i].bias_todo)
- ok(tzinfo.Bias == test_data[i].bias, "Expected bias %d, got %d, for %s\n",
+ ok(tzinfo.Bias == test_data[i].bias, "Expected bias %ld, got %ld, for %s\n",
test_data[i].bias, tzinfo.Bias, wine_dbgstr_w(test_data[i].tzname));
todo_wine_if(test_data[i].std_month_todo)
ok(tzinfo.StandardDate.wMonth == test_data[i].std_month, "Expected standard month %d, got %d, for %s\n",
@@ -1045,7 +1046,7 @@ static void test_GetTimeZoneInformationForYear(void)
ok(std_day == test_data[i].std_day, "Expected standard day %d, got %d, for %s\n",
test_data[i].std_day, std_day, wine_dbgstr_w(test_data[i].tzname));
todo_wine_if(test_data[i].std_bias_todo)
- ok(tzinfo.StandardBias == test_data[i].std_bias, "Expected standard bias %d, got %d, for %s\n",
+ ok(tzinfo.StandardBias == test_data[i].std_bias, "Expected standard bias %ld, got %ld, for %s\n",
test_data[i].std_bias, tzinfo.StandardBias, wine_dbgstr_w(test_data[i].tzname));
todo_wine_if(test_data[i].dlt_month_todo)
ok(tzinfo.DaylightDate.wMonth == test_data[i].dlt_month, "Expected daylight month %d, got %d, for %s\n",
@@ -1055,7 +1056,7 @@ static void test_GetTimeZoneInformationForYear(void)
ok(dlt_day == test_data[i].dlt_day, "Expected daylight day %d, got %d, for %s\n",
test_data[i].dlt_day, dlt_day, wine_dbgstr_w(test_data[i].tzname));
todo_wine_if(test_data[i].dlt_bias_todo)
- ok(tzinfo.DaylightBias == test_data[i].dlt_bias, "Expected daylight bias %d, got %d, for %s\n",
+ ok(tzinfo.DaylightBias == test_data[i].dlt_bias, "Expected daylight bias %ld, got %ld, for %s\n",
test_data[i].dlt_bias, tzinfo.DaylightBias, wine_dbgstr_w(test_data[i].tzname));
if (i > 0 && test_data[i-1].tzname == test_data[i].tzname)
@@ -1090,8 +1091,8 @@ static void test_GetTickCount(void)
t3 = pNtGetTickCount();
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
- ok(t1 <= t2, "out of order %d %d\n", t1, t2);
- ok(t2 <= t3, "out of order %d %d\n", t2, t3);
+ ok(t1 <= t2, "out of order %ld %ld\n", t1, t2);
+ ok(t2 <= t3, "out of order %ld %ld\n", t2, t3);
}
BOOL (WINAPI *pQueryUnbiasedInterruptTime)(ULONGLONG *time);
@@ -1106,22 +1107,22 @@ static void test_QueryUnbiasedInterruptTime(void)
{
SetLastError( 0xdeadbeef );
ret = pQueryUnbiasedInterruptTime( &time );
- ok( ret, "QueryUnbiasedInterruptTime failed err %u\n", GetLastError() );
+ ok( ret, "QueryUnbiasedInterruptTime failed err %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pQueryUnbiasedInterruptTime( NULL );
ok( !ret, "QueryUnbiasedInterruptTime succeeded\n" );
- ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
}
else win_skip( "QueryUnbiasedInterruptTime not supported\n" );
if (pRtlQueryUnbiasedInterruptTime)
{
SetLastError( 0xdeadbeef );
ret = pRtlQueryUnbiasedInterruptTime( &time );
- ok( ret, "RtlQueryUnbiasedInterruptTime failed err %u\n", GetLastError() );
+ ok( ret, "RtlQueryUnbiasedInterruptTime failed err %lu\n", GetLastError() );
SetLastError( 0xdeadbeef );
ret = pRtlQueryUnbiasedInterruptTime( NULL );
ok( !ret, "RtlQueryUnbiasedInterruptTime succeeded\n" );
- ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError() );
}
else win_skip( "RtlQueryUnbiasedInterruptTime not supported\n" );
}
2
1
[PATCH 1/4] windows.gaming.input: Implement CreateGameController for RawGameController runtimeclass.
by Rémi Bernon March 9, 2022
by Rémi Bernon March 9, 2022
March 9, 2022
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/windows.gaming.input/controller.c | 242 ++++++++++++++++++++++++-
dlls/windows.gaming.input/manager.c | 36 +++-
dlls/windows.gaming.input/private.h | 34 ++--
3 files changed, 288 insertions(+), 24 deletions(-)
diff --git a/dlls/windows.gaming.input/controller.c b/dlls/windows.gaming.input/controller.c
index 94343c0927d..9b08528b01b 100644
--- a/dlls/windows.gaming.input/controller.c
+++ b/dlls/windows.gaming.input/controller.c
@@ -18,11 +18,237 @@
*/
#include "private.h"
+#include "provider.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(input);
+struct controller
+{
+ IGameControllerImpl IGameControllerImpl_iface;
+ IGameControllerInputSink IGameControllerInputSink_iface;
+ IRawGameController IRawGameController_iface;
+ IGameController *IGameController_outer;
+ LONG ref;
+
+ IGameControllerProvider *provider;
+};
+
+static inline struct controller *impl_from_IGameControllerImpl( IGameControllerImpl *iface )
+{
+ return CONTAINING_RECORD( iface, struct controller, IGameControllerImpl_iface );
+}
+
+static HRESULT WINAPI controller_QueryInterface( IGameControllerImpl *iface, REFIID iid, void **out )
+{
+ struct controller *impl = impl_from_IGameControllerImpl( iface );
+
+ TRACE( "iface %p, iid %s, out %p.\n", iface, debugstr_guid( iid ), out );
+
+ if (IsEqualGUID( iid, &IID_IUnknown ) ||
+ IsEqualGUID( iid, &IID_IInspectable ) ||
+ IsEqualGUID( iid, &IID_IGameControllerImpl ))
+ {
+ IInspectable_AddRef( (*out = &impl->IGameControllerImpl_iface) );
+ return S_OK;
+ }
+
+ if (IsEqualGUID( iid, &IID_IGameControllerInputSink ))
+ {
+ IInspectable_AddRef( (*out = &impl->IGameControllerInputSink_iface) );
+ return S_OK;
+ }
+
+ if (IsEqualGUID( iid, &IID_IRawGameController ))
+ {
+ IInspectable_AddRef( (*out = &impl->IRawGameController_iface) );
+ return S_OK;
+ }
+
+ WARN( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
+ *out = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI controller_AddRef( IGameControllerImpl *iface )
+{
+ struct controller *impl = impl_from_IGameControllerImpl( iface );
+ ULONG ref = InterlockedIncrement( &impl->ref );
+ TRACE( "iface %p increasing refcount to %lu.\n", iface, ref );
+ return ref;
+}
+
+static ULONG WINAPI controller_Release( IGameControllerImpl *iface )
+{
+ struct controller *impl = impl_from_IGameControllerImpl( iface );
+ ULONG ref = InterlockedDecrement( &impl->ref );
+
+ TRACE( "iface %p decreasing refcount to %lu.\n", iface, ref );
+
+ if (!ref)
+ {
+ IGameControllerProvider_Release( impl->provider );
+ free( impl );
+ }
+
+ return ref;
+}
+
+static HRESULT WINAPI controller_GetIids( IGameControllerImpl *iface, ULONG *iid_count, IID **iids )
+{
+ FIXME( "iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI controller_GetRuntimeClassName( IGameControllerImpl *iface, HSTRING *class_name )
+{
+ return WindowsCreateString( RuntimeClass_Windows_Gaming_Input_RawGameController,
+ ARRAY_SIZE(RuntimeClass_Windows_Gaming_Input_RawGameController),
+ class_name );
+}
+
+static HRESULT WINAPI controller_GetTrustLevel( IGameControllerImpl *iface, TrustLevel *trust_level )
+{
+ FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI controller_Initialize( IGameControllerImpl *iface, IGameController *outer,
+ IGameControllerProvider *provider )
+{
+ struct controller *impl = impl_from_IGameControllerImpl( iface );
+
+ TRACE( "iface %p, outer %p, provider %p.\n", iface, outer, provider );
+
+ impl->IGameController_outer = outer;
+ IGameControllerProvider_AddRef( (impl->provider = provider) );
+
+ return S_OK;
+}
+
+static const struct IGameControllerImplVtbl controller_vtbl =
+{
+ controller_QueryInterface,
+ controller_AddRef,
+ controller_Release,
+ /* IInspectable methods */
+ controller_GetIids,
+ controller_GetRuntimeClassName,
+ controller_GetTrustLevel,
+ /* IGameControllerImpl methods */
+ controller_Initialize,
+};
+
+DEFINE_IINSPECTABLE_OUTER( input_sink, IGameControllerInputSink, struct controller, IGameController_outer )
+
+static HRESULT WINAPI input_sink_OnInputResumed( IGameControllerInputSink *iface, UINT64 timestamp )
+{
+ FIXME( "iface %p, timestamp %I64u stub!\n", iface, timestamp );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI input_sink_OnInputSuspended( IGameControllerInputSink *iface, UINT64 timestamp )
+{
+ FIXME( "iface %p, timestamp %I64u stub!\n", iface, timestamp );
+ return E_NOTIMPL;
+}
+
+static const struct IGameControllerInputSinkVtbl input_sink_vtbl =
+{
+ input_sink_QueryInterface,
+ input_sink_AddRef,
+ input_sink_Release,
+ /* IInspectable methods */
+ input_sink_GetIids,
+ input_sink_GetRuntimeClassName,
+ input_sink_GetTrustLevel,
+ /* IGameControllerInputSink methods */
+ input_sink_OnInputResumed,
+ input_sink_OnInputSuspended,
+};
+
+DEFINE_IINSPECTABLE_OUTER( raw_controller, IRawGameController, struct controller, IGameController_outer )
+
+static HRESULT WINAPI raw_controller_get_AxisCount( IRawGameController *iface, INT32 *value )
+{
+ FIXME( "iface %p, value %p stub!\n", iface, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_get_ButtonCount( IRawGameController *iface, INT32 *value )
+{
+ FIXME( "iface %p, value %p stub!\n", iface, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_get_ForceFeedbackMotors( IRawGameController *iface, IVectorView_ForceFeedbackMotor **value )
+{
+ FIXME( "iface %p, value %p stub!\n", iface, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_get_HardwareProductId( IRawGameController *iface, UINT16 *value )
+{
+ FIXME( "iface %p, value %p stub!\n", iface, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_get_HardwareVendorId( IRawGameController *iface, UINT16 *value )
+{
+ FIXME( "iface %p, value %p stub!\n", iface, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_get_SwitchCount( IRawGameController *iface, INT32 *value )
+{
+ FIXME( "iface %p, value %p stub!\n", iface, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_GetButtonLabel( IRawGameController *iface, INT32 index,
+ enum GameControllerButtonLabel *value )
+{
+ FIXME( "iface %p, index %d, value %p stub!\n", iface, index, value );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_GetCurrentReading( IRawGameController *iface, UINT32 buttons_size, BOOLEAN *buttons,
+ UINT32 switches_size, enum GameControllerSwitchPosition *switches,
+ UINT32 axes_size, DOUBLE *axes, UINT64 *timestamp )
+{
+ FIXME( "iface %p, buttons_size %u, buttons %p, switches_size %u, switches %p, axes_size %u, axes %p, timestamp %p stub!\n",
+ iface, buttons_size, buttons, switches_size, switches, axes_size, axes, timestamp );
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI raw_controller_GetSwitchKind( IRawGameController *iface, INT32 index, enum GameControllerSwitchKind *value )
+{
+ FIXME( "iface %p, index %d, value %p stub!\n", iface, index, value );
+ return E_NOTIMPL;
+}
+
+static const struct IRawGameControllerVtbl raw_controller_vtbl =
+{
+ raw_controller_QueryInterface,
+ raw_controller_AddRef,
+ raw_controller_Release,
+ /* IInspectable methods */
+ raw_controller_GetIids,
+ raw_controller_GetRuntimeClassName,
+ raw_controller_GetTrustLevel,
+ /* IRawGameController methods */
+ raw_controller_get_AxisCount,
+ raw_controller_get_ButtonCount,
+ raw_controller_get_ForceFeedbackMotors,
+ raw_controller_get_HardwareProductId,
+ raw_controller_get_HardwareVendorId,
+ raw_controller_get_SwitchCount,
+ raw_controller_GetButtonLabel,
+ raw_controller_GetCurrentReading,
+ raw_controller_GetSwitchKind,
+};
+
struct controller_statics
{
IActivationFactory IActivationFactory_iface;
@@ -213,8 +439,20 @@ DEFINE_IINSPECTABLE( controller_factory, ICustomGameControllerFactory, struct co
static HRESULT WINAPI controller_factory_CreateGameController( ICustomGameControllerFactory *iface, IGameControllerProvider *provider,
IInspectable **value )
{
- FIXME( "iface %p, provider %p, value %p stub!\n", iface, provider, value );
- return E_NOTIMPL;
+ struct controller *impl;
+
+ TRACE( "iface %p, provider %p, value %p.\n", iface, provider, value );
+
+ if (!(impl = calloc( 1, sizeof(*impl) ))) return E_OUTOFMEMORY;
+ impl->IGameControllerImpl_iface.lpVtbl = &controller_vtbl;
+ impl->IGameControllerInputSink_iface.lpVtbl = &input_sink_vtbl;
+ impl->IRawGameController_iface.lpVtbl = &raw_controller_vtbl;
+ impl->ref = 1;
+
+ TRACE( "created RawGameController %p\n", impl );
+
+ *value = (IInspectable *)&impl->IGameControllerImpl_iface;
+ return S_OK;
}
static HRESULT WINAPI controller_factory_OnGameControllerAdded( ICustomGameControllerFactory *iface, IGameController *value )
diff --git a/dlls/windows.gaming.input/manager.c b/dlls/windows.gaming.input/manager.c
index f5b5654a4c6..489588a68ab 100644
--- a/dlls/windows.gaming.input/manager.c
+++ b/dlls/windows.gaming.input/manager.c
@@ -40,6 +40,7 @@ struct controller
{
IGameController IGameController_iface;
IGameControllerBatteryInfo IGameControllerBatteryInfo_iface;
+ IInspectable *IInspectable_inner;
LONG ref;
struct list entry;
@@ -73,9 +74,7 @@ static HRESULT WINAPI controller_QueryInterface( IGameController *iface, REFIID
return S_OK;
}
- FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
- *out = NULL;
- return E_NOINTERFACE;
+ return IInspectable_QueryInterface( impl->IInspectable_inner, iid, out );
}
static ULONG WINAPI controller_AddRef( IGameController *iface )
@@ -95,6 +94,9 @@ static ULONG WINAPI controller_Release( IGameController *iface )
if (!ref)
{
+ /* guard against re-entry if inner releases an outer iface */
+ InterlockedIncrement( &impl->ref );
+ IInspectable_Release( impl->IInspectable_inner );
ICustomGameControllerFactory_Release( impl->factory );
IGameControllerProvider_Release( impl->provider );
free( impl );
@@ -111,14 +113,14 @@ static HRESULT WINAPI controller_GetIids( IGameController *iface, ULONG *iid_cou
static HRESULT WINAPI controller_GetRuntimeClassName( IGameController *iface, HSTRING *class_name )
{
- FIXME( "iface %p, class_name %p stub!\n", iface, class_name );
- return E_NOTIMPL;
+ struct controller *impl = impl_from_IGameController( iface );
+ return IInspectable_GetRuntimeClassName( impl->IInspectable_inner, class_name );
}
static HRESULT WINAPI controller_GetTrustLevel( IGameController *iface, TrustLevel *trust_level )
{
- FIXME( "iface %p, trust_level %p stub!\n", iface, trust_level );
- return E_NOTIMPL;
+ struct controller *impl = impl_from_IGameController( iface );
+ return IInspectable_GetTrustLevel( impl->IInspectable_inner, trust_level );
}
static HRESULT WINAPI controller_add_HeadsetConnected( IGameController *iface, ITypedEventHandler_IGameController_Headset *handler,
@@ -421,13 +423,33 @@ IGameControllerFactoryManagerStatics2 *manager_factory = &manager_statics.IGameC
static HRESULT controller_create( ICustomGameControllerFactory *factory, IGameControllerProvider *provider,
struct controller **out )
{
+ IGameControllerImpl *inner_impl;
struct controller *impl;
+ HRESULT hr;
if (!(impl = malloc(sizeof(*impl)))) return E_OUTOFMEMORY;
impl->IGameController_iface.lpVtbl = &controller_vtbl;
impl->IGameControllerBatteryInfo_iface.lpVtbl = &battery_vtbl;
impl->ref = 1;
+ if (FAILED(hr = ICustomGameControllerFactory_CreateGameController( factory, provider, &impl->IInspectable_inner )))
+ WARN( "Failed to create game controller, hr %#lx\n", hr );
+ else if (FAILED(hr = IInspectable_QueryInterface( impl->IInspectable_inner, &IID_IGameControllerImpl, (void **)&inner_impl )))
+ WARN( "Failed to find IGameControllerImpl iface, hr %#lx\n", hr );
+ else
+ {
+ if (FAILED(hr = IGameControllerImpl_Initialize( inner_impl, &impl->IGameController_iface, provider )))
+ WARN( "Failed to initialize game controller, hr %#lx\n", hr );
+ IGameControllerImpl_Release( inner_impl );
+ }
+
+ if (FAILED(hr))
+ {
+ if (impl->IInspectable_inner) IInspectable_Release( impl->IInspectable_inner );
+ free( impl );
+ return hr;
+ }
+
ICustomGameControllerFactory_AddRef( (impl->factory = factory) );
IGameControllerProvider_AddRef( (impl->provider = provider) );
diff --git a/dlls/windows.gaming.input/private.h b/dlls/windows.gaming.input/private.h
index 56d03abad44..e3da45621b4 100644
--- a/dlls/windows.gaming.input/private.h
+++ b/dlls/windows.gaming.input/private.h
@@ -49,38 +49,42 @@ extern void provider_remove( const WCHAR *device_path );
extern void manager_on_provider_created( IGameControllerProvider *provider );
extern void manager_on_provider_removed( IGameControllerProvider *provider );
-#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \
- static inline impl_type *impl_from_##iface_type( iface_type *iface ) \
+#define DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from, iface_mem, expr ) \
+ static inline impl_type *impl_from( iface_type *iface ) \
{ \
- return CONTAINING_RECORD( iface, impl_type, iface_type##_iface ); \
+ return CONTAINING_RECORD( iface, impl_type, iface_mem ); \
} \
static HRESULT WINAPI pfx##_QueryInterface( iface_type *iface, REFIID iid, void **out ) \
{ \
- impl_type *impl = impl_from_##iface_type( iface ); \
- return IInspectable_QueryInterface( (IInspectable *)&impl->base_iface, iid, out ); \
+ impl_type *impl = impl_from( iface ); \
+ return IInspectable_QueryInterface( (IInspectable *)(expr), iid, out ); \
} \
static ULONG WINAPI pfx##_AddRef( iface_type *iface ) \
{ \
- impl_type *impl = impl_from_##iface_type( iface ); \
- return IInspectable_AddRef( (IInspectable *)&impl->base_iface ); \
+ impl_type *impl = impl_from( iface ); \
+ return IInspectable_AddRef( (IInspectable *)(expr) ); \
} \
static ULONG WINAPI pfx##_Release( iface_type *iface ) \
{ \
- impl_type *impl = impl_from_##iface_type( iface ); \
- return IInspectable_Release( (IInspectable *)&impl->base_iface ); \
+ impl_type *impl = impl_from( iface ); \
+ return IInspectable_Release( (IInspectable *)(expr) ); \
} \
static HRESULT WINAPI pfx##_GetIids( iface_type *iface, ULONG *iid_count, IID **iids ) \
{ \
- impl_type *impl = impl_from_##iface_type( iface ); \
- return IInspectable_GetIids( (IInspectable *)&impl->base_iface, iid_count, iids ); \
+ impl_type *impl = impl_from( iface ); \
+ return IInspectable_GetIids( (IInspectable *)(expr), iid_count, iids ); \
} \
static HRESULT WINAPI pfx##_GetRuntimeClassName( iface_type *iface, HSTRING *class_name ) \
{ \
- impl_type *impl = impl_from_##iface_type( iface ); \
- return IInspectable_GetRuntimeClassName( (IInspectable *)&impl->base_iface, class_name ); \
+ impl_type *impl = impl_from( iface ); \
+ return IInspectable_GetRuntimeClassName( (IInspectable *)(expr), class_name ); \
} \
static HRESULT WINAPI pfx##_GetTrustLevel( iface_type *iface, TrustLevel *trust_level ) \
{ \
- impl_type *impl = impl_from_##iface_type( iface ); \
- return IInspectable_GetTrustLevel( (IInspectable *)&impl->base_iface, trust_level ); \
+ impl_type *impl = impl_from( iface ); \
+ return IInspectable_GetTrustLevel( (IInspectable *)(expr), trust_level ); \
}
+#define DEFINE_IINSPECTABLE( pfx, iface_type, impl_type, base_iface ) \
+ DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, &impl->base_iface )
+#define DEFINE_IINSPECTABLE_OUTER( pfx, iface_type, impl_type, outer_iface ) \
+ DEFINE_IINSPECTABLE_( pfx, iface_type, impl_type, impl_from_##iface_type, iface_type##_iface, impl->outer_iface )
--
2.35.1
1
3