Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FreemudWrapper
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李定达
FreemudWrapper
Commits
1120503a
Commit
1120503a
authored
Sep 01, 2017
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.将依赖dll路径修改为设置程序当前的环境变量
parent
28827eb8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
12 deletions
+32
-12
FreemudWrapper.cpp
+28
-12
freemudwrapper.def
+4
-0
No files found.
FreemudWrapper.cpp
View file @
1120503a
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include <Windows.h>
#include <Windows.h>
#include <Winbase.h>
#include <Winbase.h>
#include <string>
#include <string>
#include <iostream>
#pragma comment(lib, "Kernel32.lib")
#pragma comment(lib, "Kernel32.lib")
...
@@ -40,29 +41,44 @@ int init_sign = 0;
...
@@ -40,29 +41,44 @@ int init_sign = 0;
HMODULE
GetInstance
()
HMODULE
GetInstance
()
{
{
char
current_dir
[
MAX_PATH
]
=
{
0
};
char
current_dir
[
MAX_PATH
]
=
{
0
};
if
(
0
<
GetCurrentDirectoryA
(
MAX_PATH
,
current_dir
))
{
char
chBuf
[
10240
]
=
{
0
};
char
mod
[
MAX_PATH
]
=
{
0
};
char
mod
[
MAX_PATH
]
=
{
0
};
GetModuleFileNameA
((
HMODULE
)
&
__ImageBase
,
mod
,
MAX_PATH
);
GetModuleFileNameA
((
HMODULE
)
&
__ImageBase
,
mod
,
MAX_PATH
);
char
*
ch
=
strrchr
(
mod
,
'\\'
);
char
*
ch
=
strrchr
(
mod
,
'\\'
);
if
(
ch
++
)
{
if
(
ch
++
)
{
*
ch
=
'\0'
;
*
ch
=
'\0'
;
}
printf
(
"Current directory: %s
\n
Module path: %s
\n
"
,
current_dir
,
mod
);
DWORD
dwSize
=
GetEnvironmentVariable
(
"path"
,
chBuf
,
10240
);
printf
(
"Changing current to: %s
\n
"
,
mod
);
std
::
string
currpath
(
chBuf
);
SetCurrentDirectory
(
mod
);
currpath
+=
(
std
::
string
(
";"
)
+
std
::
string
(
mod
));
std
::
cout
<<
currpath
;
char
instance
[
MAX_PATH
]
=
{
0
};
char
instance
[
MAX_PATH
]
=
{
0
};
sprintf
(
instance
,
"%s%s"
,
mod
,
SBKPAYDLL
);
sprintf
(
instance
,
"%s%s"
,
mod
,
SBKPAYDLL
);
//if(init_sign == 0)
// DoCopyFile(mod);
//init_sign = 1;
HMODULE
hMod
=
LoadLibraryA
(
instance
);
//HMODULE hModw = LoadLibraryW(L"C:\\Users\\dingda.li\\Desktop\\sbkpay\\sbkpay.dll");
printf
(
"Changing current to: %s
\n
"
,
current_dir
);
SetCurrentDirectory
(
current_dir
);
SetEnvironmentVariable
(
"path"
,
currpath
.
data
());
HMODULE
hMod
=
LoadLibraryA
(
instance
);
return
hMod
;
return
hMod
;
// printf("Current directory: %s\nModule path: %s\n", current_dir, mod);
// printf("Changing current to: %s\n", mod);
// SetCurrentDirectory(mod);
// char instance[MAX_PATH] = { 0 };
// sprintf(instance, "%s%s", mod, SBKPAYDLL);
////if(init_sign == 0)
//// DoCopyFile(mod);
////init_sign = 1;
// HMODULE hMod = LoadLibraryA(instance);
////HMODULE hModw = LoadLibraryW(L"C:\\Users\\dingda.li\\Desktop\\sbkpay\\sbkpay.dll");
// printf("Changing current to: %s\n", current_dir);
// SetCurrentDirectory(current_dir);
// return hMod;
}
}
return
NULL
;
return
NULL
;
...
...
freemudwrapper.def
View file @
1120503a
LIBRARY
EXPORTS
FreemudPay
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