I have dll that export funtion and on of the parameters is C-style strings a serial number. extern "C" int __stdcall calc(char *SerialNumber) The parameters can be come from VB, C#, C++ , C I want to make som basic indata validation check that C-style is good kondition. That point is not pointing at null and that the array is null-terminated. Somebody can point me in the right direction. I don't want buffer over flow with staring to handel the string. Code sample?
Johan Bertilsdotter
Posts
-
Indata validation char* input -
How to register a new List<IChecker> to Actofac ContainerBuildervar servers = new List {
//Server1
new DatabaseSystem { ServerName = "ANTIVIRUS" },
new DatabaseSizes { ServerName = "ANTIVIRUS"},
new DiskBackup { ServerName = "ANTIVIRUS"},
new SqlServerEventLog { ServerName="ANTIVIRUS"},
new DiskSystem { ServerName="ANTIVIRUS"},
//Server1
new DatabaseSystem { ServerName="SEJKG-S-DB01" },
new DatabaseSizes { ServerName = "SEJKG-S-DB01"},
new DiskBackup { ServerName = "SEJKG-S-DB01"},
new SqlServerEventLog { ServerName="SEJKG-S-DB01"},
new DiskSystem { ServerName="SEJKG-S-DB01"},
};var builder = new ContainerBuilder();
builder.RegisterInstance(notifiers).As>();
builder.RegisterInstance(servers).As>();
builder.Register(c => new ServerChecker(c.Resolve>(), c.Resolve>()));
return builder.Build();I have a problem with how I should register my "where server = new List {..} 'to the Container Builder. My List of iChecker passed as a parameter to a ServerChecker. So much have I been able to solve, but not the list itself but I must have outside. The usual list of servers is much greater.
-
wsprintf in 32 and 64 bit windows.Thank you. I missed that on my project. It’s work perfect. Some of my collage at work pointed out that change to “std::string” in the project. But still the interface to dll need to be native C with c-style string. Is std::string more neutral to the character set? Comming from Delphi to C# world then C/C++ for this project lot of reading "new" things. My old Charles Petzold book is back on the self again. ;D
-
wsprintf in 32 and 64 bit windows.Can i change the code copy to the szVer in a better way that does not use wsprint. Just want the format. xx.xx.xx.xx
-
wsprintf in 32 and 64 bit windows.When compling in platform win32 works. Whan compile in x64. cannot convert parameter 1 from 'char [512]' to 'LPWSTR' in the wsprintf call first parameter szVer. Understand that de definition "change" för char in the call or I have tride windhows.h and TCHAR.
-
wsprintf in 32 and 64 bit windows.CFileVersionInfo fvi;
char szVer[ 512 ] = { 0 };
if( fvi.Open( _T( "Econovent.dll" )))
{
::wsprintf( szVer,
_T( "%d.%d.%d.%d" ),
fvi.GetFileVersionMajor(), // Major version
fvi.GetFileVersionMinor(), // Minor version
fvi.GetFileVersionBuild(), // Build number
fvi.GetFileVersionQFE() // QFE
);
fvi.Close();}It works perfect in win32, But when complied in x64 the "wsprintf", stops working. Are the a better solution that works in x64 and win32 at the same time. I understand that i have change. I have tried but then its not working in win32 mode. The code need to be old C-style version. I'm not native C/C++ i'm just trying to fixa a "bug".