|
FYI found the reason - there is no data found!
This is the routine reporting it. Observe the lack of correct code for
nFieldIndex - 1!
Now I need to find out why - the data is there!
long PASCAL CRecordset::GetData(CDatabase* pdb, HSTMT hstmt,
short nFieldIndex, short nFieldType, LPVOID pvData, int nLen,
short nSQLType)
{
UNUSED(nSQLType);
long nActualSize;
RETCODE nRetCode;
// Retrieve the column in question
AFX_ODBC_CALL(::SQLGetData(hstmt, nFieldIndex,
nFieldType, pvData, nLen, &nActualSize));
// Ignore data truncated warnings for long data
if (nRetCode == SQL_SUCCESS_WITH_INFO)
{
#ifdef _DEBUG
CDBException e(nRetCode);
if (afxTraceFlags & traceDatabase)
{
CDBException e(nRetCode);
// Build the error string but don't send nuisance output to TRACE window
e.BuildErrorString(pdb, hstmt, FALSE);
// If not a data truncated warning on long var column,
// then send debug output
if ((nSQLType != SQL_LONGVARCHAR &&
nSQLType != SQL_LONGVARBINARY) ||
(e.m_strStateNativeOrigin.Find(_afxDataTruncated) < 0))
{
TRACE1("Warning: ODBC Success With Info on field %d.\n",
nFieldIndex - 1);
e.TraceErrorMessage(e.m_strError);
e.TraceErrorMessage(e.m_strStateNativeOrigin);
}
}
#endif // _DEBUG
}
else if (nRetCode == SQL_NO_DATA_FOUND)
{
NICE Mr Bill
TRACE0("Error: GetFieldValue operation failed on field %d.\n");
TRACE1("\tData already fetched for this field.\n",
nFieldIndex - 1);
NICE Mr Bill
AfxThrowDBException(nRetCode, pdb, hstmt);
}
else if (nRetCode != SQL_SUCCESS)
{
TRACE1("Error: GetFieldValue operation failed on field %d.\n",
nFieldIndex - 1);
AfxThrowDBException(nRetCode, pdb, hstmt);
}
return nActualSize;
}
|
|
|
|
|
I have changed the CString in pRecordset->GetFieldValue( index, varValue );
to CDBVariant varValue.
Same problem - only first field is retrieved.
Identical record is retrieved when different SQl is used and more than one record are retrieved. So the data is there.
The first field is AutoNumber in Access and the rest of fields are Text.
I may have to insert dummy record to make this play.
|
|
|
|
|
Vaclav_Sal wrote: It seem that the field index is not being advanced.I stepped thru the GetFieldValue, but cannot find the actuall source for the error routine.
Have you looked at CRecordset::GetData() in dbcore.cpp ?
Vaclav_Sal wrote: If I do MoveFirst on this one record record set , I get an error that I am attempting to move past the beginning of the recordset.That would be expected.
So do you need to call IsBOF() first?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 19-Dec-11 8:19am.
|
|
|
|
|
No, I just did it to test stuff.
Actually, the "solution" is to do AddNew to any recordset without doing any checking if there is only one record in recordset.Real hack.
|
|
|
|
|
Vaclav_Sal wrote: No, I just did it to test stuff.
Did what?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
So do you need to call IsBOF() first?
Sorry, I just read only this part. So I answered that.
My appology.
I'll check the GetData.
Vaclav
|
|
|
|
|
I have an application which has several extern variables, I need to access them inside dll. Is that possible?
modified 16-Dec-11 2:58am.
|
|
|
|
|
You may, for instance, pass them (their pointers or references) as parameters of a DLL function.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks,
I agree the way you are saying is right and genuine. But unfortunately I don't have exe's source code
I have injected a dll into exe's process space and now want to get the data from exe's memory space. I tried with hooking the system level functions like LoadLibrary and TextOut etc but I could not hook GetProfileInt, CString's sprintf, format etc functions.
Any way to do so ?
I wonder who downvoted my question 
|
|
|
|
|
So you're an hacker?!
I upvoted your question for balancing.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Nopes! I am not; but I like to explore the things at extreme level 
|
|
|
|
|
Use a shared header externing the variable in the dll. Include this in the exe, and then the linker will do the rest for you.
==============================
Nothing to say.
|
|
|
|
|
Thanks Eric,
But I don't have exe's code. See my above reply for more details.
|
|
|
|
|
you can access extern (and exported) variables in a DLL from an EXE.
you cannot access variables in an EXE from a DLL.
you could, in theory, decompile the EXE, find the references to the data you want, figure out if the data is statically or dynamically allocated, then create some mechanism to probe the EXE's memory at the right locations and times, etc.. a huge task.
|
|
|
|
|
Thanks Chris for verifying that I cannot access variables in an EXE from a DLL directly.
So I am doing the Huge task. Still I think hooking should work as it is working for few of the functions; I will try a little more before leaving hooks.
|
|
|
|
|
This is largely a waste of time as there is nothing in the executable file that would get you a reference to the location of the variables. The use of extern on a variable declaration merely tells the compiler that it exists in a different source module. Such references are then resolved by the linker but no more information about them is held in the EXE file.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
that's true.
i suppose i left out the "...in a debugger..." part.
|
|
|
|
|
What you wrote looked fine to me; I just think the OP read more into it than you intended.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I am getting error at following line of code
ShowControlBar(&m_wndColorBar, !m_wndColorBar.IsVisible(), FALSE);
the error is
error C2664: 'CFrameWnd::ShowControlBar' : cannot convert parameter 1 from 'CMFCToolBar *' to 'CControlBar *'
I understand the error is due to m_wndColorBar is a variable of
CToolBar ,but of CMFCToolbar. Please guide me which function can I use instead of ShowControlBar
Be Happy
|
|
|
|
|
It seems m_wndColorBar is a variable of type CMFCToolBar not CToolBar. Can you check what is the base class of CMFCToolbar??. It is supposed to be a child of CToolBar. But seems it is not
|
|
|
|
|
I don't understand why I can do CryptCreateHash with CALG_MD5 no problem, but when I use CALG_DES, It fails.
I want just the Basic DES Encryption, using a pair of keys. I suspect that I have the wrong CryptAcquireContext Statement, in which I may be calling the wrong service, but I can't find any reference other than PROV_RS_FULL. I did some research and I'll swear that the DES is a member of the MS_STRONG_PROV.
My Goal is to replicate a function in asp.net to c++
bResult = CryptAcquireContextW( &hProv, 0, MS_STRONG_PROV, PROV_RSA_FULL, 0);
if(!bResult){
bResult=CryptAcquireContext(&hProv, NULL, MS_STRONG_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET);
return 0;
}
bResult = CryptCreateHash(hProv, CALG_DES, 0, 0, &hHash);
asp.net function:
Dim cryptoProvider As DESCryptoServiceProvider = New DESCryptoServiceProvider()
Dim ms As MemoryStream = New MemoryStream()
Dim cs As CryptoStream = New CryptoStream(ms, cryptoProvider.CreateEncryptor(KEY_64, IV_64), _
CryptoStreamMode.Write)
Dim sw As StreamWriter = New StreamWriter(cs)
|
|
|
|
|
Call GetLastError after using CryptCreateHash and see what the error is (and tell us). See this[^] or this[^] for error codes.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I should of done that last night, was really tired, this is my 4th time though the program.
The code is 2148073480
2148073480 NTE_BAD_ALGID: Invalid algorithm specified.
|
|
|
|
|
Yeah, it happens... anyways, i think Richard got the right answer.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I just tried this and received error code 0x80090008 which means "Invalid algorithm specified", so I guess the implementation does not match the documentation.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|