index > Visual C# General > Help with dll call

Help with dll call

These are c++6 dll calls, how would i do them in c++.net or C#.net ?




//////////////////////////////////////////////////////////////////////
// -- MXSock.dll --
// WinMX WPNP Support Dynamic Link Library Header File
// Copyright 2004 [Nushi]@[2SN]
//////////////////////////////////////////////////////////////////////
#pragma once


//////////////////////////////////////////////////////////////////////
// includes
//////////////////////////////////////////////////////////////////////
#include <Windows.h>


//////////////////////////////////////////////////////////////////////
// Export or Import Switching
//////////////////////////////////////////////////////////////////////
#ifdef _MXSOCK_DEV_
#define MXSOCKAPI extern "C" __declspec(dllexport)
#else
#define MXSOCKAPI extern "C" __declspec(dllimport)
#endif


//////////////////////////////////////////////////////////////////////
// Export Functions
//////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////
// Decrypt Message From FrontCode Peer Cache Server
//
// Parameters
// pSrc : (IN) Message From Peer Cache Server. Buffer must be 132 bytes.
// pDst : (OUT) Primary Node Addresses. Buffer must be 120 bytes.
//
// Remarks
// Node Address Structure
//
// typedef struct TAG_NODEINFO {
// DWORD dwNodeIP; // Primary Node IP Addresses
// WORD wUDPPort; // Primary Node UDP Port
// WORD wTCPPort; // Primary Node TCP Port
// BYTE bFreePri; // Free Primary Connections
// BYTE bFreeSec; // Free Secondary Connections
// WORD wDummy; // Padding
// } NODEINFO, *PNODEINFO;
//
// Example
// NODEINFO NodeInfo[10];
// DecryptFrontCode(pBuff, (BYTE *)NodeInfo);
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI void DecryptFrontCode(const BYTE *pSrc, BYTE *pDst);


//////////////////////////////////////////////////////////////////////
// Create Crypt Key Block for send
//
// Parameters
// wID : (IN) Crypt Key ID.
// pBlock : (OUT) Key Block . Buffer must be 16 bytes.
//
// Remarks
// WPNP Key IDs
// 0x0050 : Primary Client
// 0x0051 : Primary Server
// 0x0052 : Secondary Client
// 0x0053 : Secondary Server
// 0x0057 : Chat Client
// 0x0058 : Chat Server
//
// Example
// BYTE KeyBlock[16];
// CreateCryptKeyID(0x0057, KeyBlock);
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI void CreateCryptKeyID(const WORD wID, BYTE *pBlock);


//////////////////////////////////////////////////////////////////////
// Get Key ID from Key Block
//
// Parameters
// pBlock : (IN) Key Block. Buffer must be 16 bytes.
//
// Return Value
// WPNP Key ID
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI const WORD GetCryptKeyID(const BYTE *pBlock);


//////////////////////////////////////////////////////////////////////
// Get Crypt Key from Key Block
//
// Parameters
// pBlock : (IN) Key Block. Buffer must be 16 bytes.
// pUpKey : (OUT) Pointer to Crypt Key for send
// pDwKey : (OUT) Pointer to Crypt Key for recv
//
// Return Value
// WPNP Key ID
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI const WORD GetCryptKey(const BYTE *pBlock, DWORD *pUpKey, DWORD *pDwKey);


//////////////////////////////////////////////////////////////////////
// Encrypt or Decrypt WPNP TCP Message
//
// Parameters
// pBuf : (IN) Message.
// iLen : (IN) Message Size.
// dwKey : (IN) Crypt Key
// Remarks
// WPNP TCP Message Format
//
// typedef struct TAG_MXTCPMESSAGE {
// WORD wType; // Message Type
// WORD wLen; // Data Length
// BYTE Data[0]; // Data
// } MXTCPMESSAGE, *PMXTCPMESSAGE;
//
// Return Value
// New Crypt Key
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI const DWORD DecryptMXTCP(BYTE *pBuf, const int iLen, const DWORD dwKey);
MXSOCKAPI const DWORD EncryptMXTCP(BYTE *pBuf, const int iLen, const DWORD dwKey);


//////////////////////////////////////////////////////////////////////
// Decrypt WPNP UDP Message
//
// Parameters
// pBuf : (IN) Message.
// iLen : (IN) Message Size.
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI void DecryptMXUDP(BYTE *pBuf, const int iLen);


//////////////////////////////////////////////////////////////////////
// Get File Hash from file
//
// Parameters
// lpszFileName : (IN) File Path.
// pHash : (OUT) File Hash.
// pFileLen : (OUT) File Length.
//
// Example
// DWORD dwHash;
// DWORD dwLen;
// GetFileHash("c:\\Example.avi", &dwHash, &dwLen);
//
// Return Value
// If no error occurs, GetFileHash returns TRUE
//
//////////////////////////////////////////////////////////////////////

MXSOCKAPI const BOOL GetFileHash(LPCTSTR lpszFileName, DWORD *pHash, DWORD *pFileLen);





www.winmxunlimited.net
Joshizzle
That is a tall order to fill in a forum post. Here is what I recommend. Since this is a C# forum I will direct you appropriately. Read up on Interoperability (C#) once you have perused that look at the Platform Invoke Sample (PInvoke). Good Luck!



OmegaMan
OmegaMan
reply 2

You can use google to search for other answers

 

More Articles

• Accessing a child control from a parent
• Trying to set projectype property
• Item Template Problem
• strtok in C#
• problem registering windows service
• Is there a way to marshal a CArray from unmanaged function
• Accessing and identifying PCI boards
• is there any software to convert from C++ source to C# source?
• C# .NET Naming Conventions
• whats the difference between "string" and "String&...
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Adding tables programmatically
• OpenFileDialog
• How can I right align a progress bar pla
• how long a string can be??
• Language symbols problem
• connect to an oracle database
• Esc key stroke on a form causes debug as
• How to convert arabic text to english sp
• How do I pass a class to another form?
• How can i get the holidays from my outlo
• why I need to define (impliment) interfa
• Exception Error Display
• Opening Forms inside another form
• security que
• how to hide form when using notifyicon b

Hot Articles

• Form inheritance - newbie question
• boolean expression evaluation
• xsl transform
• Executing aspx files not working
• Change Service Logon information program
• Restore SQL 2005 DB from C#
• declaring 2d arrays
• style and height/width
• Problem REFRESHING UserPaint-ed controls.
• Win To Web
• C# socket programming help
• Updating label or textbox in a loop
• converting
• Outlook add-in (auto-scheduler)
• C# vs VB.Net

Recommend Articles

• ListBox And DataGridView
• How to validate correct Enum name?
• URGENT PLZ: Extract data from a website
• Converting a float[] reference to byte[]
• Threading Exception
• HttpWebResponse problems...
• Creating objects at runtime
• CS2001 & CS2008 errors
• Excel Cell data validation
• change visio shape color
• Not able to find references in GAc in th
• How do I prevent a screen saver for clos
• rollovers on links
• Default Text property in User Control
• Row Filter