16,472
社区成员
发帖
与我相关
我的任务
分享
011328EE mov ecx,dword ptr [esp+14h]//黄色右向箭头停在此行开头
--- D:\aaa\ZY_code\PhonePayment\PPcode\payment.cpp -------------------------------------------------------------------------------------------------------
17:
18: extern "C" _declspec(dllexport) int SendParamter( char *posseg, char *transAmount, char *gatewayId, char *orderId, char *transType, char *cardNo, char *validDate, char *cvv2, char *IDNum, char *name )
19: {
011328F0 and al,14h
// telpay.cpp : Defines the entry point for the DLL application: PhonePaymentService.wsdl.
// It is a program for the WSDL - Web Service linking.
#include <afx.h>
#include "stdafx.h"
#include "soapH.h"
#include "PhonePaymentServiceHttpBinding.nsmap"
#include<stdio.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" _declspec(dllexport) int SendParamter( char *posseg, char *transAmount, char *gatewayId, char *orderId, char *transType, char *cardNo, char *validDate, char *cvv2, char *IDNum, char *name )
{
ns2__MBFRequestHeader header; //定义的header
ns3__sendPaymentInfoRequestBody body; //定义的body
ns3__sendPaymentInfoRequest request; //定义的request
ns3__sendPaymentInfoResponse response;//定义的response
_ns3__sendPaymentInfo soapinput;// 定义的输入
_ns3__sendPaymentInfoResponse soapoutput;// 定义的输出
//初始化soap
struct soap soap;
soap_init ( &soap );
const char* server = "http://192.168.100.53:9106/SuNingServiceWeb/mb";//定义测试服务器的URL
// const char* server = "http://192.168.130.106:9106/SuNingServiceWeb/mb";//定义生产服务器的URL
//20091028a v10.
// const char* server = "http://192.168.134.66:9106/SuNingServiceWeb/mb";//定义PRE服务器的URL
//给输入变量赋值
header.MBServiceCode = "PHONE_PAY_SENDPAYMENTINFO";
body.POSID = "00000009"; // A1
body.POSPWD = "123456"; // A2
body.POSSEG = "1100"; // A3
body.transAmount = transAmount; // B1
body.gatewayId = gatewayId; // B2
body.orderId = orderId; // B3 6-16
body.transType = transType; // B4
body.cardNo = cardNo; // B5 12~19
body.validDate = validDate; // B6
body.cvv2 = cvv2; // B7
body.IDNum = IDNum; // B8 max20
body.name = name; // B9
request.MbfHeader = &header;
request.MbfBody = &body;
soapinput.input1 = &request;
FILE *fp = fopen("paymentlog.txt", "a"); //以添加的方式输出到文件
CTime tm; //获取系统时间
tm = CTime::GetCurrentTime();
fprintf(fp,"[%s] ",tm.Format("%m/%d/%Y %H:%M:%S"));
fprintf(fp," %s; %s,%s,%s,%s,%s; ", header.MBServiceCode,body.POSID,body.POSPWD,body.POSSEG,body.transAmount,body.gatewayId,body.orderId,body.transType,body.cardNo,body.validDate,body.cvv2,body.IDNum,body.name);
fprintf(fp,"\n");
char *flag = new char[256]; //soap输出的值
//调用Webservice
if(soap_call___ns1__sendPaymentInfo(&soap,server,NULL,&soapinput,&soapoutput) == 0)
{
response = *soapoutput.output1;
strcpy(flag,response.flag);
tm = CTime::GetCurrentTime();
fprintf(fp,"[%s] ",tm.Format("%m/%d/%Y %H:%M:%S"));
fprintf(fp," flag=%s;",flag);
fprintf(fp,"\n");
fclose(fp);
return atoi(flag);
}
else
{
soap_print_fault(&soap, stderr); // display the SOAP fault message on the stderr stream
tm = CTime::GetCurrentTime();
fprintf(fp,"[%s] ",tm.Format("%m/%d/%Y %H:%M:%S"));
fprintf(fp," error:communicate with web service failure");
fprintf(fp,"\n");
fclose(fp);
return 2;
// exit(1);
}
//收尾
soap_destroy(&soap); // delete deserialized class instances
soap_end(&soap); // remove deserialized data and clean up
soap_done(&soap); // detach the gSOAP environment
delete []flag;
return 0;
}
// ThreadTestDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ThreadTest.h"
#include "ThreadTestDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
typedef int (*MYPROC)( char *posseg, char *transAmount, char *gatewayId, char *orderId, char *transType, char *cardNo, char *validDate, char *cvv2, char *IDNum, char *name );
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CThreadTestDlg dialog
CThreadTestDlg::CThreadTestDlg(CWnd* pParent /*=NULL*/)
: CDialog(CThreadTestDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CThreadTestDlg)
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CThreadTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CThreadTestDlg)
DDX_Control(pDX, IDC_STATIC_NUM, m_static);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CThreadTestDlg, CDialog)
//{{AFX_MSG_MAP(CThreadTestDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON_START, OnButtonStart)
ON_BN_CLICKED(IDC_BUTTON_PAUSE, OnButtonPause)
ON_BN_CLICKED(IDC_BUTTON_CONTINUE, OnButtonContinue)
ON_BN_CLICKED(IDC_BUTTON_END, OnButtonEnd)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CThreadTestDlg message handlers
BOOL CThreadTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
void CThreadTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CThreadTestDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CThreadTestDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void lpRecvProc(LPVOID lpParam)
{
CStatic* pStatic=(CStatic*)lpParam;
//显式加载dll
HMODULE hModule=::LoadLibrary("..\\PPtest\\Release\\PPcode.dll");
MYPROC SendParamter = 0;
char str1[] = "1100";
char str2[] = "20.00";
char str3[] = "T6";
char str4[] = "2010011117009999";
char str5[] = "P";
char str6[] = "45645645645698";
char str7[] = "1212";
char str8[] = "778";
char str9[] = "111222333444555666";
char str10[] = "钱包包";
int sum = 0;
for(int i=0;i<5;i++)
{
CString str;
// str1.Format("%08d",i);
// pStatic->SetWindowText(str1);
MYPROC SendParamter= (MYPROC) GetProcAddress(hModule, "SendParamter");
int rtn = SendParamter(str1,str2,str3,str4,str5,str6,str7,str8,str9,str10);
sum = sum + rtn;
str.Format("%08d",sum);
pStatic->SetWindowText(str);
}
}
void CThreadTestDlg::OnButtonStart()
{
if(hThread)
TerminateThread(hThread,dwThreadId);
hThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)lpRecvProc,&m_static,0,&dwThreadId);
if(hThread==NULL)
AfxMessageBox("创建线程失败!");
}
void CThreadTestDlg::OnButtonPause()
{
if(hThread)
SuspendThread(hThread);
}
void CThreadTestDlg::OnButtonContinue()
{
if(hThread)
ResumeThread(hThread);
}
void CThreadTestDlg::OnButtonEnd()
{
if(hThread)
{
TerminateThread(hThread,dwThreadId);
}
else
{
MessageBox("");
}
}