1
- /* file: service_daal_load_win_dynamic_lib.cpp */
2
- /* ******************************************************************************
3
- * Copyright 2021 Intel Corporation
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *******************************************************************************/
1
+ // ===-- dpctl_dynamic_lib_helper.cpp - Dynamic library helper -*-C++-*- ===//
2
+ //
3
+ // Data Parallel Control (dpctl)
4
+ //
5
+ // Copyright 2020-2021 Intel Corporation
6
+ //
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ //
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ //
13
+ // Unless required by applicable law or agreed to in writing, software
14
+ // distributed under the License is distributed on an "AS IS" BASIS,
15
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ // See the License for the specific language governing permissions and
17
+ // limitations under the License.
18
+ //
19
+ // ===----------------------------------------------------------------------===//
17
20
18
21
/*
19
22
//++
23
26
24
27
#if defined(_WIN32) || defined(_WIN64)
25
28
26
- #include " services/daal_defines .h"
29
+ #include " Support/DllExport .h"
27
30
#include < windows.h>
28
31
29
- #if !defined(DAAL_CHECK_DLL_SIG )
30
- #define DAAL_LOAD_DLL (name ) LoadLibrary(name)
32
+ #if !defined(DPCTL_CHECK_DLL_SIG )
33
+ #define DPCTL_LOAD_DLL (name ) LoadLibrary(name)
31
34
#else
32
- #define DAAL_LOAD_DLL (name ) _DAALLoadLibrary (name)
35
+ #define DPCTL_LOAD_DLL (name ) _DPCTLLoadLibrary (name)
33
36
34
37
#include < stdio.h>
35
38
#include < Softpub.h>
38
41
39
42
#pragma comment(lib, "Wintrust.lib")
40
43
41
- static HMODULE WINAPI _DAALLoadLibrary (LPCTSTR filename)
44
+ static HMODULE WINAPI _DPCTLLoadLibrary (LPCTSTR filename)
42
45
{
43
46
TCHAR PathBuf[MAX_PATH];
44
47
DWORD rv;
@@ -57,21 +60,21 @@ static HMODULE WINAPI _DAALLoadLibrary(LPCTSTR filename)
57
60
rv1 = SetDllDirectoryA (" " );
58
61
if (0 == rv1)
59
62
{
60
- printf (" Intel oneDAL FATAL ERROR: Cannot exclude current directory from serch path.\n " );
63
+ printf (" Intel dpctl FATAL ERROR: Cannot exclude current directory from serch path.\n " );
61
64
return NULL ;
62
65
}
63
66
64
67
rv2 = LoadLibraryExA (filename, NULL , DONT_RESOLVE_DLL_REFERENCES);
65
68
if (NULL == rv2)
66
69
{
67
- printf (" Intel oneDAL FATAL ERROR: Cannot find/load library %s.\n " , filename);
70
+ printf (" Intel dpctl FATAL ERROR: Cannot find/load library %s.\n " , filename);
68
71
return NULL ;
69
72
}
70
73
71
74
rv = GetModuleFileNameA (rv2, PathBuf, MAX_PATH);
72
75
if (0 == rv)
73
76
{
74
- printf (" Intel oneDAL FATAL ERROR: Cannot find module %s in memory.\n " , filename);
77
+ printf (" Intel dpctl FATAL ERROR: Cannot find module %s in memory.\n " , filename);
75
78
return NULL ;
76
79
}
77
80
@@ -118,27 +121,27 @@ static HMODULE WINAPI _DAALLoadLibrary(LPCTSTR filename)
118
121
lerr = GetLastError ();
119
122
if (TRUST_E_NOSIGNATURE == lerr || TRUST_E_SUBJECT_FORM_UNKNOWN == lerr || TRUST_E_PROVIDER_UNKNOWN == lerr)
120
123
{
121
- printf (" Intel oneDAL FATAL ERROR: %s is not signed.\n " , filename);
124
+ printf (" Intel dpctl FATAL ERROR: %s is not signed.\n " , filename);
122
125
}
123
126
else
124
127
{
125
- printf (" Intel oneDAL FATAL ERROR: An unknown error occurred trying to verify the signature of the %s.\n " , filename);
128
+ printf (" Intel dpctl FATAL ERROR: An unknown error occurred trying to verify the signature of the %s.\n " , filename);
126
129
}
127
130
break ;
128
131
129
- case TRUST_E_EXPLICIT_DISTRUST: printf (" Intel oneDAL FATAL ERROR: The signature/publisher of %s is disallowed.\n " , filename); break ;
132
+ case TRUST_E_EXPLICIT_DISTRUST: printf (" Intel dpctl FATAL ERROR: The signature/publisher of %s is disallowed.\n " , filename); break ;
130
133
131
134
case ERROR_SUCCESS: break ;
132
135
133
- case TRUST_E_SUBJECT_NOT_TRUSTED: printf (" Intel oneDAL FATAL ERROR: The signature of %s in not trusted.\n " , filename); break ;
136
+ case TRUST_E_SUBJECT_NOT_TRUSTED: printf (" Intel dpctl FATAL ERROR: The signature of %s in not trusted.\n " , filename); break ;
134
137
135
138
case CRYPT_E_SECURITY_SETTINGS:
136
- printf (" Intel oneDAL FATAL ERROR: %s. The subject hash or publisher was not explicitly trusted and user trust was not allowed "
139
+ printf (" Intel dpctl FATAL ERROR: %s. The subject hash or publisher was not explicitly trusted and user trust was not allowed "
137
140
" (CRYPT_E_SECURITY_SETTINGS).\n " ,
138
141
filename);
139
142
break ;
140
143
141
- default : printf (" Intel oneDAL FATAL ERROR: %s. Error code is 0x%x.\n " , filename, (unsigned int )sverif); break ;
144
+ default : printf (" Intel dpctl FATAL ERROR: %s. Error code is 0x%x.\n " , filename, (unsigned int )sverif); break ;
142
145
}
143
146
144
147
pWVTData.dwStateAction = WTD_STATEACTION_CLOSE;
@@ -159,9 +162,9 @@ static HMODULE WINAPI _DAALLoadLibrary(LPCTSTR filename)
159
162
}
160
163
#endif
161
164
162
- DAAL_EXPORT HMODULE _daal_load_win_dynamic_lib (LPCTSTR filename)
165
+ DPCTL_API HMODULE _dpctl_load_win_dynamic_lib (LPCTSTR filename)
163
166
{
164
- return DAAL_LOAD_DLL (filename);
167
+ return DPCTL_LOAD_DLL (filename);
165
168
}
166
169
167
170
#endif // defined(_WIN32) || defined(_WIN64)
0 commit comments