Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
cf663d17
Commit
cf663d17
authored
Mar 01, 2010
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Implement SHFormatDateTimeA/SHFormatDateTimeW with tests.
parent
5d74e575
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
11 deletions
+75
-11
ordinal.c
dlls/shlwapi/ordinal.c
+64
-11
ordinal.c
dlls/shlwapi/tests/ordinal.c
+0
-0
shlwapi.h
include/shlwapi.h
+11
-0
No files found.
dlls/shlwapi/ordinal.c
View file @
cf663d17
...
...
@@ -4661,7 +4661,7 @@ HRESULT WINAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPWSTR bag_name,
* fileTime [I] Pointer to FILETIME structure specifying the time
* flags [I] Flags specifying the desired output
* buf [O] Pointer to buffer for output
*
bufSize
[I] Number of characters that can be contained in buffer
*
size
[I] Number of characters that can be contained in buffer
*
* RETURNS
* success: number of characters written to the buffer
...
...
@@ -4669,10 +4669,65 @@ HRESULT WINAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPWSTR bag_name,
*
*/
INT
WINAPI
SHFormatDateTimeW
(
const
FILETIME
UNALIGNED
*
fileTime
,
DWORD
*
flags
,
LPWSTR
buf
,
UINT
bufS
ize
)
LPWSTR
buf
,
UINT
s
ize
)
{
FIXME
(
"%p %p %s %d STUB
\n
"
,
fileTime
,
flags
,
debugstr_w
(
buf
),
bufSize
);
return
0
;
#define SHFORMATDT_UNSUPPORTED_FLAGS (FDTF_RELATIVE | FDTF_LTRDATE | FDTF_RTLDATE | FDTF_NOAUTOREADINGORDER)
DWORD
fmt_flags
=
flags
?
*
flags
:
FDTF_DEFAULT
;
SYSTEMTIME
st
;
FILETIME
ft
;
INT
ret
=
0
;
TRACE
(
"%p %p %p %u
\n
"
,
fileTime
,
flags
,
buf
,
size
);
if
(
!
buf
||
!
size
)
return
0
;
if
(
fmt_flags
&
SHFORMATDT_UNSUPPORTED_FLAGS
)
FIXME
(
"ignoring some flags - 0x%08x
\n
"
,
fmt_flags
&
SHFORMATDT_UNSUPPORTED_FLAGS
);
FileTimeToLocalFileTime
(
fileTime
,
&
ft
);
FileTimeToSystemTime
(
&
ft
,
&
st
);
/* first of all date */
if
(
fmt_flags
&
(
FDTF_LONGDATE
|
FDTF_SHORTDATE
))
{
static
const
WCHAR
sep1
[]
=
{
','
,
' '
,
0
};
static
const
WCHAR
sep2
[]
=
{
' '
,
0
};
DWORD
date
=
fmt_flags
&
FDTF_LONGDATE
?
DATE_LONGDATE
:
DATE_SHORTDATE
;
ret
=
GetDateFormatW
(
LOCALE_USER_DEFAULT
,
date
,
&
st
,
NULL
,
buf
,
size
);
if
(
ret
>=
size
)
return
ret
;
/* add separator */
if
(
ret
<
size
&&
(
fmt_flags
&
(
FDTF_LONGTIME
|
FDTF_SHORTTIME
)))
{
if
((
fmt_flags
&
FDTF_LONGDATE
)
&&
(
ret
<
size
+
2
))
{
if
(
ret
<
size
+
2
)
{
lstrcatW
(
&
buf
[
ret
-
1
],
sep1
);
ret
+=
2
;
}
}
else
{
lstrcatW
(
&
buf
[
ret
-
1
],
sep2
);
ret
++
;
}
}
}
/* time part */
if
(
fmt_flags
&
(
FDTF_LONGTIME
|
FDTF_SHORTTIME
))
{
DWORD
time
=
fmt_flags
&
FDTF_LONGTIME
?
0
:
TIME_NOSECONDS
;
if
(
ret
)
ret
--
;
ret
+=
GetTimeFormatW
(
LOCALE_USER_DEFAULT
,
time
,
&
st
,
NULL
,
&
buf
[
ret
],
size
-
ret
);
}
return
ret
;
#undef SHFORMATDT_UNSUPPORTED_FLAGS
}
/***********************************************************************
...
...
@@ -4682,21 +4737,19 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags,
*
*/
INT
WINAPI
SHFormatDateTimeA
(
const
FILETIME
UNALIGNED
*
fileTime
,
DWORD
*
flags
,
LP
CSTR
buf
,
UINT
bufS
ize
)
LP
STR
buf
,
UINT
s
ize
)
{
WCHAR
*
bufW
;
DWORD
buflenW
,
convlen
;
INT
retval
;
if
(
!
buf
||
!
bufS
ize
)
if
(
!
buf
||
!
s
ize
)
return
0
;
buflenW
=
bufSize
;
bufW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
buflenW
);
retval
=
SHFormatDateTimeW
(
fileTime
,
flags
,
bufW
,
buflenW
);
bufW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
size
);
retval
=
SHFormatDateTimeW
(
fileTime
,
flags
,
bufW
,
size
);
if
(
retval
!=
0
)
convlen
=
WideCharToMultiByte
(
CP_ACP
,
0
,
bufW
,
-
1
,
(
LPSTR
)
buf
,
bufS
ize
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
bufW
,
-
1
,
buf
,
s
ize
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
bufW
);
return
retval
;
...
...
dlls/shlwapi/tests/ordinal.c
View file @
cf663d17
This diff is collapsed.
Click to expand it.
include/shlwapi.h
View file @
cf663d17
...
...
@@ -1074,6 +1074,17 @@ BOOL WINAPI IsOS(DWORD);
#define TPS_EXECUTEIO 0x00000001
#define TPS_LONGEXECTIME 0x00000008
/* SHFormatDateTimeA/SHFormatDateTimeW flags */
#define FDTF_SHORTTIME 0x00000001
#define FDTF_SHORTDATE 0x00000002
#define FDTF_DEFAULT (FDTF_SHORTDATE | FDTF_SHORTTIME)
#define FDTF_LONGDATE 0x00000004
#define FDTF_LONGTIME 0x00000008
#define FDTF_RELATIVE 0x00000010
#define FDTF_LTRDATE 0x00000100
#define FDTF_RTLDATE 0x00000200
#define FDTF_NOAUTOREADINGORDER 0x00000400
#include <poppack.h>
#ifdef __cplusplus
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment