15,886,815 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Tomazas77 (Top 36 by date)
Tomazas77
2-Oct-12 10:24am
View
See updates with code
Tomazas77
5-Feb-12 16:28pm
View
Thanks I'll have a look. I got another similar source.
Tomazas77
12-Jan-12 14:03pm
View
Thanks, removing const worked.
Tomazas77
12-Jan-12 13:42pm
View
netbuf data has to be copied to data value, not to cd.
CWS_NETMSGSIZE is constant and its value 240.
Tomazas77
12-Jan-12 13:26pm
View
not, true, cd is used its just strip out.
using first option compilation is not possible with error:
"Error 1 error C2664: 'memcpy' : cannot convert parameter 1 from 'const unsigned char *' to 'void *' c:\PROJECTS\C++\NewCamdLibrary\NewCamdLibrary\CardServer\cWrapper.cpp 88"
Tomazas77
12-Jan-12 11:50am
View
Thanks, uncommenting =0 part solved the issue!
Great
Tomazas77
12-Jan-12 11:48am
View
just declaration virtual in class.
Tomazas77
12-Jan-12 11:40am
View
yes, still have linker problem
Tomazas77
12-Jan-12 11:29am
View
I've just added this file so is not linked anywhere yet, but insede file is linked in cString cPlainKey::ToString(bool hide)
I can copy rest of code ("type,IdSize(),id,&PrintKeyNr()") but this should not be a problems as all of them return int.
Tomazas77
12-Jan-12 11:06am
View
just added to question
Tomazas77
12-Jan-12 11:05am
View
I used #defined cString because this code copy and paste. More simple to define than to do replacement.
Setting warning to level 4 does not add more errors, just one.
Tomazas77
11-Jan-12 11:05am
View
Any tries to compile project with initialisation of structure fails over with error:
"Could not load type 'WindowsApplication1.NewCamD.DES_ks' from assembly 'NewCamDLibrary_test.NET, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because it contains an object field at offset 0 that is incorrectly aligned or overlapped by a non-object field."
Your structure missing another array of 16 values. Structure should be something like
<structlayout(layoutkind.explicit)> _
Structure DES_key_schedule
<fieldoffset(0),MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Dim ks() As DES_ks
Sub New(ByVal val As Boolean)
ReDim ks(16)
For j As Integer = 0 To 15
ks(j) = New DES_ks(True)
Next
End Sub
End Structure
<structlayout(layoutkind.explicit)> _
Structure DES_ks
<fieldoffset(0),MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Dim cblock() As Byte
<fieldoffset(0)> Dim dlong As UInt32
Sub New(ByVal val As Boolean)
ReDim cblock(8)
End Sub
End Structure
Tomazas77
11-Jan-12 10:37am
View
I've tried to replicate the structure but I couldn't. It's just too complex and event quit good
explanation link
did not helped me. All structures was in C++ with invalid pointers.
Then I've tried just to copy all structure to binary array (the size I know - its 128) and this did not returned errors. That just worked! Its just bytes.
I may think that your proposed structure may work. I'll try this out later.
Thanks
Tomazas77
11-Jan-12 5:42am
View
I found some article regarding the struct union in C++ where it says that struct with unions can be only pointers. Now I've tried to pass just this structure to C++ and I can see invalid pointers in this structure, so I guess that my structure is not right for vb.net.
Tomazas77
11-Jan-12 4:46am
View
Stefan, could you check if I transfered C++ structure corectly to .NET (see edited question)? Or this relates to
KB327106
?
Tomazas77
11-Jan-12 4:32am
View
Looks like it copies the data but this returns an error in .NET interface:
"An unhandled exception of type 'System.ExecutionEngineException' occurred in Application1.exe"
Tomazas77
10-Jan-12 6:04am
View
Yes (static=Shared), you can write in C# I will translate it to VB.NET. I declared in my VB as: internal class win32API { public const Path = "..\\"; [DllImport(Path + "NewCamdLibrary.dll", EntryPoint = "TestBytes", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)] public static extern int TestBytes( [MarshalAs(UnmanagedType.AsAny)] ref char[] a, short index, [MarshalAs(UnmanagedType.AsAny)] ref char @out); }
Tomazas77
10-Jan-12 6:04am
View
Deleted
Finally removed most enoying message by removing flag for LoaderLock :
Debug -> Exceptions -> Managed Debug Assistants
and unchecking the LoaderLock item.
But still strugling to pass byte array to unsigned char a[] in C++
Tomazas77
10-Jan-12 4:46am
View
Any attempts to change code makes no difference. I am still getting same error:
"Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang."
I've moved code to Class and tried to use shared. No luck.
Found working C++ to VB6 example ant that works except my line with bytes (crashes all VB6). Migrated code to VB.NET does not work at all (same error, moved to class).
Tomazas77
9-Jan-12 11:56am
View
Not sure what do you mean with this, but I don't use CLR in C++ code and this is not for Win CE.
Tomazas77
7-Jan-12 16:41pm
View
I've modified then CNewCamdLib::QueryInterface code and I may thing there is an error in there, but I am not familiar with COM objects especially in C++.
Tomazas77
7-Jan-12 15:33pm
View
As I said, it compiles then code, but using COM interface class is not returned.
VB6 for example return error:
Run-time error 424: Object required on line
Set obj = CreateObject("TomSoft.NewCamDLibrary")
VB.NET return on same line:
Cannot create ActiveX component.
Tomazas77
5-Jan-12 12:30pm
View
Thanks for advice, I've been searching on web for a function to convert string hex values separated by space to unsigned chars. I came across only with this solution.
And, I've solved the issue. You pointed out in option 7: the length to copy was much bigger (117 bytes instead 14). This was the fault.
Thanks
Tomazas77
5-Jan-12 12:07pm
View
This is what I get in stack:
32800042()
> msvcr90d.dll!_CrtIsValidHeapPointer(const void * pUserData=0x651bd496) Line 2103 C++
0042fd58()
NewCamD_test.exe!pre_cpp_init() Line 327 + 0x21 bytes C
0042fe2c()
kernel32.dll!7556339a()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!76f49ed2()
ntdll.dll!76f49ea5()
Tomazas77
5-Jan-12 10:49am
View
Please see my updated question as I've narrowed down to the line after which return in Login() fails over.
My guess is something not right in function str2char() as function RecvMsg() is completely empty and just calls str2char() function.
Tomazas77
5-Jan-12 10:17am
View
Sorry for incomplete code, I've added more. SendMessage is a function in class not a threading SendMessage().
Tomazas77
5-Jan-12 10:05am
View
Deleted
commenting out "if(NextProto()) return Login();" line also did not resolved issue...
Forced moving to return true also did not made effect. So returning of this function does not work...
Tomazas77
5-Jan-12 9:47am
View
stops inside void __cdecl _unlock() function
Tomazas77
5-Jan-12 9:44am
View
Removing Threading did not solved the issue. Given code I am trying to convert from Linux version to Windows. The original code does use multi-threading but I am currently working on console application and don't need any multi-threading. So for this reason I ignored any multi-threading lines. So purely in my code I am not using any threads.
But I am getting to the point where socket has to be used.
Tomazas77
3-Jan-12 8:15am
View
Can be this falt due to my PC AMD processor (not Intel)?
If I move include line as you suggested:
#ifdef CRYPT_H
#error CRYPT_H already defined
#endif
#include "crypt.h"
#ifndef CRYPT_H
#error CRYPT_H not defined
#endif
I get only 4 errors (same 4 times):
Error 3 error C3861: 'memset': identifier not found c:\PROJECTS\C++\NewCamD_test\NewCamD_test\crypt.cpp 142 NewCamD_test
Tomazas77
2-Jan-12 16:27pm
View
under windows system md5.h file not found.
Tomazas77
30-Dec-11 14:13pm
View
output still not right:
random: Length: 14 (Hex 2109560Ì203078u203078'203078á203078r203078½203078â20307
8r203078‗203078}2030784203078<203078¼2030786)
desKey: Length: 14 (Hex 203078☺203078☻203078♥203078♦203078♣203078♠2030782030720
3078 203078
203078♫)03078♀203078
Press any key to continue . . .
It shoud come like
random: Length: 14 (Hex DE 75 27 A0 72 AB ......)
desKey: Length: 14 (Hex 01 02 03 04 05 06 ......)
Tomazas77
30-Dec-11 12:01pm
View
You are right, seems to be all of them made for Linux system. But this file should use MD5 algorythm with salt option so conversion is possible to Windows system.
So anyone has this file?
Tomazas77
30-Dec-11 11:57am
View
Hi David,
Thanks very much for explanation. I completely forgot that some time ago I've added VC6 library path in VS2008 options which was priority.
Removing this path has solved my problems. And changing Runtime library /MDd to something else cause more problems.
Thanks
Tomazas77
29-Dec-11 16:24pm
View
David,
would you be able to tell me why I get these string errors after recompiling (added "using namespace std"):
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >(char const *)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) referenced in function "public: virtual void __thiscall Test::Start(void)" (?Start@Test@@UAEXXZ) NewCamD_test.obj NewCamD_test
Error 4 error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$?prn@Test@@UAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAE@Z NewCamD_test.obj NewCamD_test
Error 5 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::_Osfx(void)" (__imp_?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::sentry::~sentry(void)" (??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ) NewCamD_test.obj NewCamD_test
Error 6 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char=""> >::_Lock(void)" (__imp_?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::_Sentry_base::_Sentry_base(class std::basic_ostream<char,struct std::char_traits<char=""> > &)" (??0_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@AAV12@@Z) NewCamD_test.obj NewCamD_test
Error 7 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::basic_streambuf<char,struct std::char_traits<char=""> >::_Unlock(void)" (__imp_?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ) referenced in function "public: __thiscall std::basic_ostream<char,struct std::char_traits<char=""> >::_Sentry_base::~_Sentry_base(void)" (??1_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@XZ) NewCamD_test.obj NewCamD_test
Thanks
Tomazas77
29-Dec-11 4:41am
View
Thanks David,
This was other way round. Setting /GS- flag solved my issues.
Show More