This is my first time using the registry, and I was hoping I'm going about it the right way.

Basically, this code finds the desired registry key, finds the value corresponding to a certain string, then fills a RECT structure with the entry.

Code:
RECT GetRegCoords(char *lpCmdLine)
{
	RECT rcCoords={-1,-1,-1,-1};
	HKEY hKeySoftware;
	HKEY hKeyNote;

	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software",0,KEY_ALL_ACCESS,&hKeySoftware)==ERROR_SUCCESS)
	{ //Can we open the HKEY_LOCAL_MACHINE\Software key?
		DWORD dwKeyExists;
		if (RegCreateKeyEx(hKeySoftware,"Note",0,NULL,REG_OPTION_NON_VOLATILE,
							KEY_ALL_ACCESS,NULL,&hKeyNote,&dwKeyExists)==ERROR_SUCCESS)
		{//Can we open/create the Note key?
			if (dwKeyExists==REG_OPENED_EXISTING_KEY)
			{//Did the key already exist?
				int nCount=0;
				char *lpValue=new char[64];
				char *lpEntry=new char[32];
				DWORD cbName=64;
				DWORD dwSize=32;
				DWORD dwType;
				while (RegEnumValue(hKeyNote,nCount,lpValue,&cbName,0,&dwType,(LPBYTE)lpEntry,&dwSize)==ERROR_SUCCESS)
				{//Are there any values left to enumerate?
					if (!lstrcmpi(lpValue,lpCmdLine))
					{//The key name matches the named passed in through the command line
						char *lpTemp=new char[8];
						DWORD nStrCount=0;
						DWORD nRectCount=0;
						DWORD nStrLen=strlen(lpEntry);
						lpTemp[0]=0;

						for (UINT i=0;i<(nStrLen+1);i++)
						{
							if (nRectCount>3)	//Already found 4 vertices?
								break;			//Then break the for loop
							if ( (lpEntry[i]!=',') && (lpEntry[i]!=0) ) //It wasn't a comma or null 
								lpTemp[nStrCount++]=lpEntry[i];			//so add the number to temp
							else //Found a comma, so null-terminate temp, and enter it into rcCoords
							{
								lpTemp[nStrCount]=0;	
								((LONG *)&rcCoords)[nRectCount++]=atoi(lpTemp);
								lpTemp[nStrCount=0]=0; //reset nStrCount and lpTemp
							}
						}
						//Done parsing
						delete [] lpTemp;
						break; //Break out the the while loop
					}
					//Selected value did not match command line specified file
					nCount++; //Increase the key enum index
				}
				//No subkeys left to enumerate
				delete [] lpValue;
				delete [] lpEntry;
			}
			else
			{}//Key didn't already exist, we created it
		}
		else{}//We couldn't open or even create the Note key
	}
	else{}//We couldn't open the HKEY_LOCAL_MACHINE\Software key

	return rcCoords;
}
Can anyone see any ways to reduce my registry code down? I'm pretty sure I'm doing the bare minimum needed.