Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
jlib
Commits
11216891
Commit
11216891
authored
Dec 11, 2018
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
0bc24748
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
12 deletions
+42
-12
log2.h
jlib/log2.h
+2
-7
DeviceUniqueIdentifierHeaderOnly.h
jlib/win32/DeviceUniqueIdentifierHeaderOnly.h
+40
-5
No files found.
jlib/log2.h
View file @
11216891
...
...
@@ -55,13 +55,8 @@ inline void init_logger(const std::wstring& file_name = L"")
sinks
.
push_back
(
std
::
make_shared
<
spdlog
::
sinks
::
msvc_sink_mt
>
());
#endif
sinks
.
push_back
(
std
::
make_shared
<
spdlog
::
sinks
::
stdout_sink_mt
>
());
sinks
.
push_back
(
std
::
make_shared
<
spdlog
::
sinks
::
daily_file_sink_mt
>
(
#ifdef WIN32
file_name
+
L".log"
#else
file_name
+
".log"
#endif
,
23
,
59
));
sinks
.
push_back
(
std
::
make_shared
<
spdlog
::
sinks
::
daily_file_sink_mt
>
(
file_name
+
L".log"
,
23
,
59
));
auto
combined_logger
=
std
::
make_shared
<
spdlog
::
logger
>
(
g_logger_name
,
begin
(
sinks
),
end
(
sinks
));
combined_logger
->
set_pattern
(
"[%Y-%m-%d %H:%M:%S.%e] [tid %t] [%L] %v"
);
spdlog
::
register_logger
(
combined_logger
);
...
...
jlib/win32/DeviceUniqueIdentifierHeaderOnly.h
View file @
11216891
...
...
@@ -441,10 +441,31 @@ static bool query(const std::vector<QueryType>& queryTypes, std::unordered_map<Q
{
bool
ok
=
false
;
// 初始化COM
HRESULT
hres
=
CoInitializeEx
(
NULL
,
COINIT_
APARTMENT
THREADED
);
// 初始化COM
COINIT_APARTMENTTHREADED
HRESULT
hres
=
CoInitializeEx
(
NULL
,
COINIT_
MULTI
THREADED
);
if
(
FAILED
(
hres
))
{
return
false
;
#ifndef __AFXWIN_H__
_com_error
ce
(
hres
);
qDebug
()
<<
"CoInitializeEx with COINIT_MULTITHREADED failed:
\n
"
<<
ce
.
Error
()
<<
QString
::
fromWCharArray
(
ce
.
ErrorMessage
());
//
#endif
if
(
hres
==
0x80010106
)
{
#ifndef __AFXWIN_H__
qDebug
()
<<
"already initilized, pass"
;
//
#endif
}
else
{
#ifndef __AFXWIN_H__
qDebug
()
<<
"trying CoInitializeEx with COINIT_APARTMENTTHREADED"
;
//
#endif
hres
=
CoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
if
(
FAILED
(
hres
))
{
#ifndef __AFXWIN_H__
qDebug
()
<<
"CoInitializeEx with COINIT_APARTMENTTHREADED failed, exit"
;
#endif
return
false
;
}
}
}
// 设置COM的安全认证级别
...
...
@@ -460,6 +481,9 @@ static bool query(const std::vector<QueryType>& queryTypes, std::unordered_map<Q
NULL
);
if
(
FAILED
(
hres
))
{
#ifndef __AFXWIN_H__
qDebug
()
<<
"CoInitializeSecurity:"
<<
QString
::
fromWCharArray
(
_com_error
(
hres
).
ErrorMessage
());
#endif
CoUninitialize
();
return
false
;
}
...
...
@@ -474,6 +498,9 @@ static bool query(const std::vector<QueryType>& queryTypes, std::unordered_map<Q
reinterpret_cast
<
LPVOID
*>
(
&
pLoc
)
);
if
(
FAILED
(
hres
))
{
#ifndef __AFXWIN_H__
qDebug
()
<<
"CoCreateInstance:"
<<
QString
::
fromWCharArray
(
_com_error
(
hres
).
ErrorMessage
());
#endif
CoUninitialize
();
return
false
;
}
...
...
@@ -491,8 +518,9 @@ static bool query(const std::vector<QueryType>& queryTypes, std::unordered_map<Q
&
pSvc
);
if
(
FAILED
(
hres
))
{
_com_error
e
(
hres
);
e
.
ErrorMessage
();
#ifndef __AFXWIN_H__
qDebug
()
<<
"ConnectServer:"
<<
QString
::
fromWCharArray
(
_com_error
(
hres
).
ErrorMessage
());
#endif
pLoc
->
Release
();
CoUninitialize
();
return
false
;
...
...
@@ -510,6 +538,9 @@ static bool query(const std::vector<QueryType>& queryTypes, std::unordered_map<Q
EOAC_NONE
);
if
(
FAILED
(
hres
))
{
#ifndef __AFXWIN_H__
qDebug
()
<<
"CoSetProxyBlanket:"
<<
QString
::
fromWCharArray
(
_com_error
(
hres
).
ErrorMessage
());
#endif
pSvc
->
Release
();
pLoc
->
Release
();
CoUninitialize
();
...
...
@@ -537,6 +568,10 @@ static bool query(const std::vector<QueryType>& queryTypes, std::unordered_map<Q
//pSvc->Release();
//pLoc->Release();
//CoUninitialize();
#ifndef __AFXWIN_H__
qDebug
()
<<
"ExecQuery:
\n
"
<<
QString
::
fromWCharArray
(
query
.
szSelect
)
<<
'\n'
<<
QString
::
fromWCharArray
(
_com_error
(
hres
).
ErrorMessage
());
#endif
results
[
queryType
]
=
_com_error
(
hres
).
ErrorMessage
();
continue
;
}
...
...
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