|
Thank you very much for your help!!!
|
|
|
|
|
I tried this
CDataDialog *pDlg = new CDataDialog(this);
pDlg->InsertItems(m_DialogCon);
as you wrote me above but I have one more function where error appears in function InsertItems()
BOOL CDataDialog::OnInitDialog()
{
ListView_SetExtendedListViewStyle(::GetDlgItem
(m_hWnd, IDC_LIST1), LVS_EX_FULLROWSELECT |
LVS_EX_GRIDLINES);
InsertItems ();
::ShowWindow(::GetDlgItem(m_hWnd, IDC_EDIT1), SW_HIDE);
return TRUE;
}
Thank you in advance!
|
|
|
|
|
You are calling InsertItems() from OnInitDialog() . Then you can't pass the variable from the parent dialog and have to call SetCon() from the parent dialog. Remove the argument from InsertItems() and use m_nCon within that function.
|
|
|
|
|
Well, the whole point of C++, any object oriented code in fact, is that you DONT share variable.
So, you need to rethink your design, and how these two classes interact.
|
|
|
|
|
|
I was not sure I should make that point, since it isnt really very helpful, but fundamentally this isnt a programming question, its an architecture one, and the OP clearly needs to go back to basics on this and rework his architecture.
Of course you can use 'friend' classes, or use the classic C# hack Getxxxx() Setxxx() functions. A hack so bad you wonder why bother using C# and why not just use C.
Anyway, enough of my ramblings.
|
|
|
|
|
I try everything you propose!!every answer is helpful as I trying something like this for the first time!!thank you for your proposes!!
|
|
|
|
|
We have an application exe developed in VC++ under VS2008.
We are using an external software named HASP SRM for license protection. When we protect our Application exe using the software, its size is changed. I could understand that the exe is being encrypted.
Now I want to find a way in the application at runtime to identify if it is protected or encrypted or not for some logging purpose.
Is it possible to write a code inside the application to find it at runtime.
Can anyone help me in this regard
|
|
|
|
|
You may open and read the binary file (argv[0] ) and check if that contains a signature inserted by the encryption software.
Ask the maker of the software if you don't know the signature. They may also already have a documented method to perform such checks.
|
|
|
|
|
Our Application is a MFC application. Can you please provide me the C++ source code and detail me the steps to do so.
|
|
|
|
|
I can't because I don't know what to look for.
Therefore, I suggested to ask the maker of the encryption software.
Alternatively, do a binary file compare of an encrypted and original version of your sofware to find out where they are different. But only you can do that beacuse I neither have your software nor the encryption software.
If you know what to look for (binary pattern, length, and offset):
const unsigned char pattern[] = { 0x00, 0x01 };
char buf[sizeof(pattern)];
FILE *f = fopen(argv[0], "rb");
fseek(f, offset, SEEK_SET);
fread(buf, 0, sizeof(pattern), f);
fclose(f);
if (0 == memcmp(pattern, buf, sizeof(pattern)))
{
}
|
|
|
|
|
Hi,
manoharbalu wrote: Is it possible to write a code inside the application to find it at runtime.
Maybe.
manoharbalu wrote: Can anyone help me in this regard
One of the first thing at occurs after the executable begins execution... (For brevity I will not describe the NT loader) is that it jumps to the IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint and begins executing some code there.
Do the following:
1.) Protect around a dozen files with the packer/protector.
2.) Read some bytes at the IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint offset on all these protected files. (maybe 16 bytes of instructions)
3.) Save those bytes into an array.
4.) If all those bytes are the same... use that for your signature detection.
All PE packers and protections add the decryption/decompressing functions at the IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint
Note that in the old days some vendors used polymorphic instruction generators to avoid detection... but these days most vendors are using static instructions so that anti-virus vendors can detect the unpacker signature.
Note that you can also iterate through the PE sections...
A typical PE file from a Microsoft based compiler will contain:
.text
.bss
.rdata
.data
.idata
.reloc
... few others
I believe the HASP SRM packer/protector generates an additional PE section:
.protect
Keep in mind that you are performing a statistical analysis so...
if the instructions at IMAGE_OPTIONAL_HEADER.AddressOfEntryPoint are the same as instructions from other binaries packed with HASP SRM
{
if There is an additional section named .protect which is consistent with the HASP SRM product.
{
Probably protected by HASP SRM
}
}
Best Wishes,
-David Delaune
modified 17-Mar-17 14:38pm.
|
|
|
|
|
Hi everyone! I have problem using list control in visual c++. I tried to create a table which appears on a dialog window but when I run the executable on dialog appears only an empty "window" without the data I wrote. I used the "report view". Here is the code:
void CDataDialog::OnLvnItemchangedStoreItems(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
*pResult = 0;
m_StoreItems.InsertColumn(
0,
L"ID",
LVCFMT_LEFT,
100);
m_StoreItems.InsertColumn(1, L"Resistivity", LVCFMT_CENTER, 80);
m_StoreItems.InsertColumn(2, L"Permeability", LVCFMT_LEFT, 100);
m_StoreItems.InsertColumn(3, L"Rdc", LVCFMT_LEFT, 80);
int nItem;
nItem = m_StoreItems.InsertItem(0, L"1");
m_StoreItems.SetItemText(nItem, 1, L"0.000869");
m_StoreItems.SetItemText(nItem, 2, L"1");
m_StoreItems.SetItemText(nItem, 3, L"0.09136");
nItem = m_StoreItems.InsertItem(0, L"2");
m_StoreItems.SetItemText(nItem, 1, L"0.0008603");
m_StoreItems.SetItemText(nItem, 2, L"1");
m_StoreItems.SetItemText(nItem, 3, L"0.09136");
nItem = m_StoreItems.InsertItem(0, L"3");
m_StoreItems.SetItemText(nItem, 1, L"0.000869");
m_StoreItems.SetItemText(nItem, 2, L"1");
m_StoreItems.SetItemText(nItem, 3, L"0.09136");
}
void CInputView::OnLinefeaturesData()
{
CInputDoc* pDoc = GetDocument();
CDataDialog DialogWindow;
DialogWindow.DoModal();
}
|
|
|
|
|
OnLvnItemchangedStoreItems seems to be a LVN_ITEMCHANGED notification code (Windows)[^] handler. That is called whenever an item of a list control is changed but you are trying to create columns and add items there. But that handler is never called while you are not adding and changing items (and will produce a stack overflow or dead lock when adding items from within the handler).
Move the code from the handler to CDataDialog::OnInitDialog . That will populate the list and show it.
|
|
|
|
|
Thank you very much sir!!It worked!!!
|
|
|
|
|
I have one dialog without border
and on it i have one picture control
I wanted to move the window using picture control like we are moving using title bar
|
|
|
|
|
Exactly what do you want to move, and how? Do you want to move the picture within the dialog using the mouse, or some other feature? Or do you want to move the entire dialog?
|
|
|
|
|
Entire Dialog I want to move
|
|
|
|
|
|
See if this helps.
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 11-Mar-17 10:20am.
|
|
|
|
|
Indeed.
You simply needs to return HTCAPTION on the WM_NCHITTEST message. Which is OnNcHitTest in the MFC framework.
Best Wishes,
-David Delaune
|
|
|
|
|
You need to process the mouse messages in your dialog, you have to do all the work because you don't have a frame.
Usually you have a select trigger, lets say that is left mouse click down (WM_LBUTTONDOWN) that sets a flag in your dialog handler.
When that flag is set you process WM_MOUSEMOVE messages to actually move the the window with the mouse.
Then you have a trigger to release, lets say that is left mouse button up (WM_LBUTTONUP) that clears the flag in your dialog handler.
You can confine the triggers to areas on your dialog or the whole dialog just by looking at position of the trigger messages and allowing or ignoring.
That is what the frame handler does and why you can't drag the dialog around without the frame. It also has triggers on the keys to allow you to size and move the window by the keys. The normal frame handler has special areas that turn triggers on/off the top bar allows dragging, the bottom right allows X,Y sizing the sides one direction sizing etc.
On MDI and SDI's they call a global default handler called DefFrameProc with some structures, you can look it up on MSDN. That should give you the detail of what you need to do if you want to complete implementation.
For graphical dragging and the like I only ever do the basic mouse one.
In vino veritas
modified 10-Mar-17 22:32pm.
|
|
|
|
|
Hi
I just used SnagIt Screen Capture to go over window pane by window pane of both the compiler options for debug and release and the only debug and release version
is the run time library 1) release its Multi threaded DLL /MD while in Debug its debug DLL /MDd
However I keep on getting different compile errors
at one point I had a clean build for Debug while Release was giving me errors
|
|
|
|
|
ForNow wrote: ...while Release was giving me errors And those would be?
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
mainly with CString.Format (I was using it like the C sprintf) and it looked for const wchar_t * for the format string. The Doc says the string is of type LPCTSTR
I am working on Release when I get a clean build from Release I should have no problem
with Debug I hope
Thanks
|
|
|
|