This could really be the answer ! But I should exhume the code wherever it is now, after three years. However this seems an useful clue. Thanks. :)
Nyarlatotep
Posts
-
CFileDialog -
Exporting function from a C# dll with __stdcall calling conventionThe method of a wrapper c++ class was the first one I've thought and probably will be the final choice. Anothre question ... If a c# class method is declared as static, is it possible to export it in some way ?+ Thanks for your time
-
Exporting function from a C# dll with __stdcall calling conventionHi, I'm a newbie in C#. I want to create a C# dll exporting some functions to be used from a thirdy party application. This application can call functions exported froma DLL but those functions have to be declared as __stdcall. Is there a simple way to export functions froma C# dll as __stdcall (or in a way it works as __stdcall) ? Thanks
-
WinInet: Open an URL simulating HTML Form POSTHi, There is a site with a page containing an HTML form for accessing private areas. This form requests an username and password to login. I need to programmatically send username and password to the destination page of the form using POST method (to download an automatically generated file contained into the site reserved area). This is not very hard to do I think, but my question is: whenever login succeeded (the destination page of the form has accepted and verified username/password sent and probably that page redirects to another page, which should be the reserved area, on successfull login), is there a way to request a page from the reserved area ? The 'user' is still logged in for the server between a WinInet request and the next one ? (who manages the session and cookies to mantain the user logged?) Thanks
-
CryptoAPI: Send a challenge to a smart card:) It could be but ... CryptAcquireContext() does not raise this error, it succeeded. It's CryptDecrypt() which fails. Naturally this function tries (would?) to decrypt data using the AT_KEYEXCHANGE key obtained with CryptGetUserKey() from the context acquired from the smart card. According to MSDN: "The CryptGetUserKey function retrieves a handle of one of a user's two public/private key pairs..." If I'm not wrong CryptoAPI CryptEncrypt()/CryptDecrypt() should use the public key to encrypt and the private key to decrypt, but decrypting with the private key from the smart card fails. Changhing the key type to AT_SIGNING when retrieving the key pair with CryptGetUserKey() has no effects (and it has not sense for me. I don't want to sign a piece of data with the private key. I want decrypt a piece of data with it ).
-
CryptoAPI: Send a challenge to a smart cardVarious smart card certificates are imported into the system store. When a smart card is inserted into the reader, the user have to select his certificate from the list of certificates in the sistem and then insert the PIN. To verify that the certificate selected from the system store correspond to the smart card currently in the reader I try to send a challenge to the smart card (GemPlus CSP) - A crypto context from the certificate selected from the system store is acquired. - A crypto context from the smart card in the reader is acquired. - A challenge is created with random data (CryptGenRandom()). - The public/private key pair is obtained from the certificate in the system. (CryptGetUserKey(AT_KEYEXCHANGE)). - The challenge is encrypted with the previous public key from the certificate in the system store (CryptEncrypt()). - The public/private key pair is obtained from the smart card (CryptGetUserKey(AT_KEYEXCHANGE)). - The encrypted challenge is decrypted with the smart card (CryptDecrypt(AT_KEYEXCHANGE)) which should use his private key. But when CryptDecrypt() with the crypto context of the smart card is called, error NTE_PROVIDER_DLL_FAIL (0x8009001D) is obtained. Where is the error ? NTE_PROVIDER_DLL_FAIL is an error raised when a context is acquired, according to the documentation, but it seems to have no relation with Crypt/Decrypt ! Thanks
-
Store an encryption keyI'm using VC++ without managed code. However it seems that DPAPI could solve this problem, either using a machine-store or a user store. For the latter, a point is not clear for me: for user-store it seems DPAPI use the windows user logon credentials to generate the master and session keys. The CryptProtectData and CryptUnprotectData functions have the chance to show a dialog to allow the user to insert a password. Is this only necessary if the windows user has no password set (may be a standalone machine) ?
-
Store an encryption keyIt's the same solution I have thought, in some way. And now I'm reading some articles about DPAPI to see if it can help me for this kind of problems. Thanks a lot
-
Store an encryption keyI need a user/password pair to connect to a RDBMS through my application. Now I want to store those informations in a secure manner and I have thought to store them inside an encrypted archive using a strong encryption algorithm (may be AES, for example). Now, what is the smartest way to store the encyption key needed to access the user/password pair ? Inside the application binary ? In which secure way ? Into another kind of container ? Thanks
-
CFileDialogI've Acrobat Reader 5.1 (7.0 is too heavy :) ). I have given the application to a friend of mine, running on W2000: same error. I have used the API GetOpenFileName (in every 'taste') instead of MFC CFileDialog obtaining the same problem. I've build a brand new MFC dialog application with no other code than a button which open a dialog and does a fake SQLite query and a button which runs GetOpenFileName, to be sure no other code could cause the problem in conjunction with GetOpenFileName: same error. Summary: when a common dialog is shown (Open file dialog, File save dialog, Printer dialog), the next call to sqlite3_prepare() (which compile a SQLite query) fails with an exception. Naturally I've used either common dialog+SQLite many times in the past with no such problems. To get around this problem, I've have decided to put the Common Dialog call into a little application and call that from the main application which some kind of interprocess communication.
-
CFileDialogI've avoided CFileDialog and used the GetOpenFileName API. So no problem with destructors and CFileDialog but the original problem still occurs ...
-
CFileDialogconst char *szFilter = "Excel Worksheet Files (*.xls)|*.xls||"; CFileDialog dlg( TRUE, "xls", NULL, OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST, szFilter, this ); if( dlg.DoModal() != IDOK ) { return; } Tried this code (compiling with /D_WIN32_WINNT=0x500) and when CFileDialog destructor is invoked an exception occurs.
-
CFileDialogIt could be. (even if, searching around, some 'weirdness' for the MFC CFileDialog wrapper class has been found). However, I've used this functions thousand of times with no problems, in the past. May be some system DLL has been replaced by some software ?
-
CFileDialogyes I've tried to ignore the GetOpenFileName() result and using a static string but it doesn't solve. Perhaps I have to follow another way but to me it seems the problem resides in the GetOpenFileName() API, whichever it is ...
-
CFileDialogNow i'm tring directly with the GetOpenFileName() and a static buffer (char strPath[MAX_PATH]) for the OPENFILENAME. No MFC, therefore. But it doesn't solve ... Tried to use the OPENFILENAME_NT4 structure and the OPENFILENAME_SIZE_VERSION_400 structure size (in MSDN they say MFC42 application compiled with _WIN32_WINNT set to 0x0500 should use this structure to avoid avoid heap corruption). Nothing ...
-
CFileDialogNeither of those events would occur. 1) User clickx on button A 2) Dialog A is opened and the database is opened in the OnInitDialog and a query is executed (and closed) 3) A browse button is pressed in Dialog A and CFileDialog (or GetOpenFileName API) is invoked to browse for a file 4) When Dialog A is closed data is saved into the db with an update (but the problems occurs even if no update is done) 5) User now clicks on button B 6) Dialog B is opened and the database is opened in the OnInitDialog and a query is executed ==> Exception if point 3) is not executed (and file is not selected) no problems arise ... I'm getting crazy ... :(
-
CFileDialogThe instruction which throws the exception (in another CDialog, different from those where CFileDialog is invoked) is a execution of a SQLite query. The exception catched doesn't explain very much: only a error code of 1, which in SQLite is generic.
-
CFileDialogOh i've commented out the code which is executed when the OK button is pressed. It doesn't solve ...
-
CFileDialogI store the file path returned by CFileDialog into a database table and neither opened or modified. The exception, however, is thrown when a query is executed in another table and in another CDialog, with no relations with the CDialog where CFileDialog has been executed. I've even tried to compile with #define _WIN32_WINNT 0x500 and CFileDialog allocated on heap and when "delete dlg" is called, an exception is thrown immediatly. It seems CFileDialog/GetOpenFileName has some weird behaviours. Searching around the web no solution i've applied has worked.
-
read an excel fileYou could use Automation to read and write to excel sheets, even in VC++. Search for "Excel Automation"