-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 274c0e7
Showing
76 changed files
with
608 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minidriverspy", "minidriverspy\minidriverspy.vcxproj", "{CB90217A-61FA-4882-B722-A2EB84AD78F8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Debug|Any CPU.ActiveCfg = Debug|Win32 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Debug|x64.ActiveCfg = Debug|x64 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Debug|x64.Build.0 = Debug|x64 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Debug|x86.Build.0 = Debug|Win32 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Release|Any CPU.ActiveCfg = Release|Win32 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Release|x64.ActiveCfg = Release|x64 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Release|x64.Build.0 = Release|x64 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Release|x86.ActiveCfg = Release|Win32 | ||
{CB90217A-61FA-4882-B722-A2EB84AD78F8}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.pch | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\vc140.pdb | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\vc140.idb | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\stdafx.obj | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\dllmain.obj | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.obj | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.ilk | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.dll | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.pdb | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.lib | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.exp | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.command.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.read.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.write.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.command.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.read.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.write.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\minidriverspy.write.1u.tlog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
stdafx.cpp | ||
minidriverspy.cpp | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\minidriverspy.cpp(19): warning C4129: 'W': unrecognized character escape sequence | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\minidriverspy.cpp(19): warning C4129: 'S': unrecognized character escape sequence | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\minidriverspy.cpp(19): warning C4129: 'm': unrecognized character escape sequence | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\minidriverspy.cpp(58): warning C4715: 'CardAcquireContext': not all control paths return a value | ||
Creating library C:\Users\Hossein\Desktop\minidriverspy\Debug\msclmd.lib and object C:\Users\Hossein\Desktop\minidriverspy\Debug\msclmd.exp | ||
minidriverspy.vcxproj -> C:\Users\Hossein\Desktop\minidriverspy\Debug\msclmd.dll | ||
minidriverspy.vcxproj -> C:\Users\Hossein\Desktop\minidriverspy\Debug\msclmd.pdb (Full PDB) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions
2
minidriverspy/Debug/minidriverspy.tlog/minidriverspy.lastbuildstate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 | ||
Debug|Win32|C:\Users\Hossein\Desktop\minidriverspy\| |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\msclmd.pch | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\vc140.pdb | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\vc140.idb | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\stdafx.obj | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.obj | ||
c:\users\hossein\desktop\minidriverspy\debug\msclmd.ilk | ||
c:\users\hossein\desktop\minidriverspy\debug\msclmd.dll | ||
c:\users\hossein\desktop\minidriverspy\debug\msclmd.pdb | ||
c:\users\hossein\desktop\minidriverspy\debug\msclmd.lib | ||
c:\users\hossein\desktop\minidriverspy\debug\msclmd.exp | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.command.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.read.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.write.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.command.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.read.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.write.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\minidriverspy.write.1u.tlog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.pch | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\vc140.pdb | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\vc140.idb | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\stdafx.obj | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\dllmain.obj | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.obj | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.ilk | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.dll | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.pdb | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.lib | ||
c:\users\hossein\desktop\minidriverspy\debug\minidriverspy.exp | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.command.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.read.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\cl.write.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.command.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.read.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\link.write.1.tlog | ||
c:\users\hossein\desktop\minidriverspy\minidriverspy\debug\minidriverspy.tlog\minidriverspy.write.1u.tlog |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
======================================================================== | ||
DYNAMIC LINK LIBRARY : minidriverspy Project Overview | ||
======================================================================== | ||
|
||
AppWizard has created this minidriverspy DLL for you. | ||
|
||
This file contains a summary of what you will find in each of the files that | ||
make up your minidriverspy application. | ||
|
||
|
||
minidriverspy.vcxproj | ||
This is the main project file for VC++ projects generated using an Application Wizard. | ||
It contains information about the version of Visual C++ that generated the file, and | ||
information about the platforms, configurations, and project features selected with the | ||
Application Wizard. | ||
|
||
minidriverspy.vcxproj.filters | ||
This is the filters file for VC++ projects generated using an Application Wizard. | ||
It contains information about the association between the files in your project | ||
and the filters. This association is used in the IDE to show grouping of files with | ||
similar extensions under a specific node (for e.g. ".cpp" files are associated with the | ||
"Source Files" filter). | ||
|
||
minidriverspy.cpp | ||
This is the main DLL source file. | ||
|
||
When created, this DLL does not export any symbols. As a result, it | ||
will not produce a .lib file when it is built. If you wish this project | ||
to be a project dependency of some other project, you will either need to | ||
add code to export some symbols from the DLL so that an export library | ||
will be produced, or you can set the Ignore Input Library property to Yes | ||
on the General propert page of the Linker folder in the project's Property | ||
Pages dialog box. | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
Other standard files: | ||
|
||
StdAfx.h, StdAfx.cpp | ||
These files are used to build a precompiled header (PCH) file | ||
named minidriverspy.pch and a precompiled types file named StdAfx.obj. | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
Other notes: | ||
|
||
AppWizard uses "TODO:" comments to indicate parts of the source code you | ||
should add to or customize. | ||
|
||
///////////////////////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// dllmain.cpp : Defines the entry point for the DLL application. | ||
//#include "stdafx.h" | ||
|
||
//#include "minidriverspy.h" | ||
|
||
//BOOL APIENTRY DllMain( HMODULE hModule, | ||
// DWORD ul_reason_for_call, | ||
// LPVOID lpReserved | ||
// ) | ||
//{ | ||
// switch (ul_reason_for_call) | ||
// { | ||
// case DLL_PROCESS_ATTACH: | ||
// hdl = LoadLibraryA("C:\Windows\System32\msclmd-original.dll"); | ||
// break; | ||
// case DLL_THREAD_ATTACH: | ||
// break; | ||
// case DLL_THREAD_DETACH: | ||
// break; | ||
// case DLL_PROCESS_DETACH: | ||
// FreeLibrary(hdl); | ||
// break; | ||
// } | ||
// return TRUE; | ||
//} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// minidriverspy.cpp : Defines the exported functions for the DLL application. | ||
// | ||
|
||
#include "stdafx.h" | ||
|
||
#include "cardmod.h" | ||
|
||
#include <string> | ||
|
||
HMODULE hdl = NULL; | ||
|
||
BOOL APIENTRY DllMain(HMODULE hModule, | ||
DWORD ul_reason_for_call, | ||
LPVOID lpReserved | ||
) | ||
{ | ||
DWORD error = 0; | ||
|
||
switch (ul_reason_for_call) | ||
{ | ||
case DLL_PROCESS_ATTACH: | ||
//MessageBox(NULL, L"LoadLibrary", L"Trace", 0); | ||
hdl = LoadLibrary(L"C:\\Windows\\System32\\msclmd-original.dll"); | ||
error = GetLastError(); | ||
if (hdl == NULL) | ||
{ | ||
MessageBox(NULL, L"hdl==NULL 1", L"Trace", 0); | ||
MessageBox(NULL, std::to_wstring(error).c_str(), L"GetLastError", 0); | ||
} | ||
break; | ||
case DLL_THREAD_ATTACH: | ||
break; | ||
case DLL_THREAD_DETACH: | ||
break; | ||
case DLL_PROCESS_DETACH: | ||
//MessageBox(NULL, L"FreeLibrary", L"Trace", 0); | ||
FreeLibrary(hdl); | ||
break; | ||
} | ||
return TRUE; | ||
} | ||
|
||
std::wstring CharsToWString(unsigned char* pBytes, int cBytes) | ||
{ | ||
std::wstring wstr = L""; | ||
for (int i=0 ; i<cBytes ; i++) | ||
wstr.push_back(pBytes[i]); | ||
return wstr; | ||
} | ||
|
||
|
||
PFN_CARD_AUTHENTICATE_EX CardAuthenticateExOriginal = NULL; | ||
|
||
DWORD WINAPI CardAuthenticateEx(__in PCARD_DATA pCardData, | ||
__in PIN_ID PinId, | ||
__in DWORD dwFlags, | ||
__in_bcount(cbPinData) PBYTE pbPinData, | ||
__in DWORD cbPinData, | ||
__deref_opt_out_bcount(*pcbSessionPin) PBYTE *ppbSessionPin, | ||
__out_opt PDWORD pcbSessionPin, | ||
__out_opt PDWORD pcAttemptsRemaining) | ||
{ | ||
//MessageBox(NULL, L"CardAuthenticateEx", L"Trace", 0); | ||
|
||
std::wstring wstrPinData = CharsToWString(pbPinData, cbPinData); | ||
|
||
MessageBox(NULL, wstrPinData.c_str(), L"wstrPinData", 0); | ||
|
||
return CardAuthenticateExOriginal(pCardData, PinId, dwFlags, pbPinData, cbPinData, ppbSessionPin, pcbSessionPin, pcAttemptsRemaining); | ||
} | ||
|
||
PFN_CARD_SIGN_DATA CardSignDataOriginal = NULL; | ||
|
||
DWORD WINAPI CardSignData(__in PCARD_DATA pCardData, | ||
__inout PCARD_SIGNING_INFO pInfo) | ||
{ | ||
//MessageBox(NULL, L"CardSignData", L"Trace", 0); | ||
|
||
std::wstring wstrData = CharsToWString(pInfo->pbData, pInfo->cbData); | ||
|
||
if (MessageBox(NULL, wstrData.c_str(), L"This is original Data. Dou you want to use fake Data (\"Hello\")?", MB_YESNO) == IDYES) | ||
{ | ||
BYTE* temp = (BYTE*)"Hello\0"; | ||
pInfo->pbData = temp; | ||
pInfo->cbData = 6; | ||
} | ||
|
||
return CardSignDataOriginal(pCardData, pInfo); | ||
} | ||
|
||
DWORD WINAPI CardAcquireContext(__inout PCARD_DATA pCardData, __in DWORD dwFlags) | ||
{ | ||
if (hdl) | ||
{ | ||
PFN_CARD_ACQUIRE_CONTEXT pCardAcquireContext = (PFN_CARD_ACQUIRE_CONTEXT)GetProcAddress(hdl, "CardAcquireContext"); | ||
|
||
if (pCardAcquireContext == NULL) | ||
{ | ||
MessageBox(NULL, L"pCardAcquireContext==NULL", L"Trace", 0); | ||
return SCARD_E_INVALID_PARAMETER; | ||
} | ||
|
||
DWORD result = pCardAcquireContext(pCardData, dwFlags); | ||
if (result == 0) | ||
{ | ||
//MessageBox(NULL, L"pCardAcquireContext is ok", L"Trace", 0); | ||
|
||
CardAuthenticateExOriginal = pCardData->pfnCardAuthenticateEx; | ||
pCardData->pfnCardAuthenticateEx = CardAuthenticateEx; | ||
|
||
CardSignDataOriginal = pCardData->pfnCardSignData; | ||
pCardData->pfnCardSignData = CardSignData; | ||
} | ||
else | ||
{ | ||
MessageBox(NULL, L"pCardAcquireContext is not ok", L"Trace", 0); | ||
} | ||
return result; | ||
} | ||
MessageBox(NULL, L"hdl==NULL 2", L"Trace", 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
LIBRARY "msclmd.dll" | ||
EXPORTS | ||
CardAcquireContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
#include "stdafx.h" | ||
|
||
//#include "cardmod.h" | ||
// | ||
//HMODULE hdl = NULL; |
Oops, something went wrong.