Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: BitMapButton using VC++ -MFC Pin
madyastha11-Aug-08 22:59
madyastha11-Aug-08 22:59 
QuestionHow to make a context menu in list control Pin
VCProgrammer11-Aug-08 18:24
VCProgrammer11-Aug-08 18:24 
QuestionRe: How to make a context menu in list control Pin
Mark Salsbery12-Aug-08 5:42
Mark Salsbery12-Aug-08 5:42 
QuestionFlushing Serial Port using Win32api Pin
Lord Dark11-Aug-08 18:19
Lord Dark11-Aug-08 18:19 
AnswerRe: Flushing Serial Port using Win32api Pin
kakan11-Aug-08 20:17
professionalkakan11-Aug-08 20:17 
GeneralRe: Flushing Serial Port using Win32api Pin
Lord Dark11-Aug-08 21:00
Lord Dark11-Aug-08 21:00 
GeneralRe: Flushing Serial Port using Win32api Pin
kakan11-Aug-08 22:22
professionalkakan11-Aug-08 22:22 
QuestionStack around the variable 'ctemp' was corrupted ?? Pin
monsieur_jj11-Aug-08 15:31
monsieur_jj11-Aug-08 15:31 
Hi,

I have this code .lic:

// LicMACMP.Lic
//

{
		{
			HKEY hkey;
			TCHAR temp[/*REGDATALEN*/50];
#pragma warning(push)
#pragma warning(disable:4309)
			/*TCHAR*/char szKey[47]={0x10, 0xDB, 0x7C, 0x7C, 0x45, 0xCA, 0x2F, 0x4C, 0xCF, 0xF1, 0xEF, 0x5F, 0xDC, 0x3E, 0x02, 0x8F, 0xA3, 0xA8, 0xB2, 0x00, 0x59, 0xFD, 0xDE, 0x89, 0x5F, 0x3B, 0x75, 0x97, 0xD9, 0x3D, 0xA0, 0x45, 0x9B, 0x95, 0x64, 0xA8, 0xA9, 0xA9, 0xEE, 0x0A, 0x8A, 0xD6, 0xBB, 0x1C, 0xBF, 0x2B, 0};
#pragma warning(pop)
			EncryptDecrypt((BYTE *)szKey, sizeof(szKey) - 1, REVERSE + GROUP1, 0);

			if (RegOpenKeyExA(HKEY_LOCAL_MACHINE,
				szKey,
				0,
				KEY_QUERY_VALUE | KEY_SET_VALUE,
				&hkey) == ERROR_SUCCESS)
			{
				DWORD dwType = 0;
				DWORD dwSize = sizeof(temp);
				if (RMRegQueryValueEx(hkey,
					_T("H1"),
					NULL,
					&dwType,
					(BYTE*)temp,
					&dwSize) != ERROR_SUCCESS)
				{

					CString SiteCodeMAC;
		
					{
						int		iNicCount=0;
						BOOL	bCont = true;

						CDeviceLocationInformationList_SortedByLocation	dlisLocation;
						iNicCount =  dlisLocation.Collect();
						if (iNicCount == 0)
						{
							bCont = false;
						} 
						else if (iNicCount == 1)
						{
						}

						if (bCont)
						{
							CDeviceLocationInformationList_SortedByPdo	dlisPdo;
							dlisPdo.Collect();

							dlisLocation.EnumReset();
							dlisPdo.EnumReset();  

							ReportNICInfoMP( TRUE, dlisLocation, SiteCodeMAC );
							if (SiteCodeMAC.IsEmpty())
							{
							}
							else
							{
							}
						}
						m_strSiteCodeGeneratedInOtherPlace = SiteCodeMAC;

					}
					
					{
						char XXXX_HASH1_HASH4[4 + 4*8 + 1];
						char ss[32 + 1];
						char cXXXX_MacHdd12[32 + 1];
#if defined(_UNICODE)
						sprintf(cXXXX_MacHdd12, "%S", SiteCodeMAC);
#else
						sprintf(cXXXX_MacHdd12, "%s", SiteCodeMAC);
#endif

#if defined(_UNICODE)
						sprintf(XXXX_HASH1_HASH4, ("%S"), SiteCodeMAC.Left(4));
#else
						strcpy(XXXX_HASH1_HASH4, SiteCodeMAC.Left(4));
#endif

						sprintf(ss, "%08lX", hashpjw(cXXXX_MacHdd12, REALSITECODELEN));
						strcat(XXXX_HASH1_HASH4, ss);

						sprintf(ss, "%08lX", calc_hashnr(cXXXX_MacHdd12, REALSITECODELEN));
						strcat(XXXX_HASH1_HASH4, ss);

						sprintf(ss, "%08lX", calc_hashnr_new(cXXXX_MacHdd12, REALSITECODELEN));
						strcat(XXXX_HASH1_HASH4, ss);

						sprintf(ss, "%08lX", hash(cXXXX_MacHdd12));
						strcat(XXXX_HASH1_HASH4, ss);

#if defined(_UNICODE)
						TCHAR XXXX_HASH1_HASH4_[sizeof(XXXX_HASH1_HASH4)];
						_stprintf(XXXX_HASH1_HASH4_, _T("%S"), XXXX_HASH1_HASH4);
						RMRegSetValueEx(hkey,				// handle to key
									_T("H1"),				// value name
									0,						// reserved
									REG_SZ,					// value type
									(BYTE*)XXXX_HASH1_HASH4_,	// value data
									(_tcsclen(XXXX_HASH1_HASH4_)+1) * sizeof(TCHAR));	// size of value data
#else
						RMRegSetValueEx(hkey,				// handle to key
									_T("H1"),				// value name
									0,						// reserved
									REG_SZ,					// value type
									(BYTE*)XXXX_HASH1_HASH4,		// value data
									(_tcsclen(XXXX_HASH1_HASH4)+1) * sizeof(TCHAR));	// size of value data
#endif

					}
				}
				else
				{
					CString SiteCodeMAC;
#if defined(_UNICODE)
					char ctemp[32 + 1];
#endif
		
					{
						int		iNicCount=0;
						BOOL	bCont = true;

						CDeviceLocationInformationList_SortedByLocation	dlisLocation;
						iNicCount =  dlisLocation.Collect();
						if (iNicCount == 0)
						{
							bCont = false;
						} 
						else if (iNicCount == 1)
						{
						}

						if (bCont)
						{
							CDeviceLocationInformationList_SortedByPdo	dlisPdo;
							dlisPdo.Collect();

							dlisLocation.EnumReset();
							dlisPdo.EnumReset();  

#if defined(_UNICODE)
							sprintf(ctemp, "%S", temp);
							ReportNICInfoMP( FALSE, dlisLocation, SiteCodeMAC, ctemp );
#else
							ReportNICInfoMP( FALSE, dlisLocation, SiteCodeMAC, temp );
#endif
							if (SiteCodeMAC.IsEmpty())
							{
							}
							else
							{
							}
						}

						if (SiteCodeMAC.IsEmpty())
						{
							m_strSiteCodeGeneratedInOtherPlace = _T("");
							
							{
								if (GetKeyState(VK_CONTROL) < 0 && GetKeyState(VK_SHIFT) < 0 && GetKeyState(VK_MENU) < 0)
									RegDeleteValue(hkey, _T("H1"));
							}
						}
						else
						{
							m_strSiteCodeGeneratedInOtherPlace = SiteCodeMAC;
						}

					}
					
				}

				RegCloseKey(hkey);
			}
			else
			{
			}
		}
}



After using this .lic I am getting "Run-Time Check Failure #2 - Stack around the variable 'ctemp' was corrupted." error, what does this mean? what should I do to eliminate it?

Thanks,
Jayjay
AnswerRe: Stack around the variable 'ctemp' was corrupted ?? Pin
David Crow11-Aug-08 16:04
David Crow11-Aug-08 16:04 
AnswerRe: Stack around the variable 'ctemp' was corrupted ?? Pin
Randor 11-Aug-08 16:11
professional Randor 11-Aug-08 16:11 
GeneralRe: Stack around the variable 'ctemp' was corrupted ?? Pin
David Crow12-Aug-08 3:23
David Crow12-Aug-08 3:23 
GeneralRe: Stack around the variable 'ctemp' was corrupted ?? Pin
Randor 12-Aug-08 5:18
professional Randor 12-Aug-08 5:18 
GeneralRe: Stack around the variable 'ctemp' was corrupted ?? Pin
David Crow12-Aug-08 5:29
David Crow12-Aug-08 5:29 
Questionchanging the color of the menu [modified] Pin
hariakuthota11-Aug-08 1:49
hariakuthota11-Aug-08 1:49 
AnswerRe: changing the color of the menu Pin
vikas amin11-Aug-08 5:32
vikas amin11-Aug-08 5:32 
Questionc++ win32 console connect to mysql Pin
phokojoe11-Aug-08 1:16
phokojoe11-Aug-08 1:16 
AnswerRe: c++ win32 console connect to mysql Pin
VirtualVoid.NET11-Aug-08 1:38
VirtualVoid.NET11-Aug-08 1:38 
AnswerRe: c++ win32 console connect to mysql Pin
David Crow11-Aug-08 3:16
David Crow11-Aug-08 3:16 
QuestionSDI File Open Pin
ShilpiP11-Aug-08 1:05
ShilpiP11-Aug-08 1:05 
AnswerRe: SDI File Open Pin
Le@rner11-Aug-08 2:04
Le@rner11-Aug-08 2:04 
GeneralRe: SDI File Open Pin
ShilpiP11-Aug-08 2:56
ShilpiP11-Aug-08 2:56 
GeneralRe: SDI File Open Pin
David Crow11-Aug-08 3:17
David Crow11-Aug-08 3:17 
GeneralRe: SDI File Open Pin
ShilpiP12-Aug-08 0:13
ShilpiP12-Aug-08 0:13 
QuestionRe: SDI File Open Pin
David Crow12-Aug-08 3:15
David Crow12-Aug-08 3:15 
QuestionWin32 to MFC Pin
NewVC++11-Aug-08 1:03
NewVC++11-Aug-08 1:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.