Official eMule-Board: Some Minor Fixes - Official eMule-Board

Jump to content


Page 1 of 1

Some Minor Fixes

#1 User is offline   dolphinX 

  • Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 09-October 08

Posted 06 December 2009 - 12:11 PM

Hi, here are the recently found issues and fixes.

1. In void CAbstractFile::SetInt64TagValue(uint8 tagname, uint64 uValue)
	CTag* pTag = new CTag(tagname, uValue);

should be
	CTag* pTag = new CTag(tagname, uValue, true);


2.Improvements in CDownloadListCtrl
Add and remove sources only if partfiles' srcarevisible

In void CDownloadListCtrl::RemoveSource(CUpDownClient* source, CPartFile* owner)
	CtrlItem_Struct* delItem  = it->second;
	if(owner == NULL || owner == delItem->owner){
		// Remove it from the m_ListItems			
		it = m_ListItems.erase(it);

		if(owner == NULL || owner->srcarevisible){// this line
			// Remove it from the CListCtrl
 			LVFINDINFO find;
			...
		}

		// finally it could be delete
		delete delItem;


In bool CDownloadListCtrl::RemoveFile(const CPartFile* toremove)
	CtrlItem_Struct* delItem = it->second;
	if(delItem->owner == toremove || delItem->value == (void*)toremove){
		// Remove it from the m_ListItems
		it = m_ListItems.erase(it);

		if(delItem->owner == NULL ||  delItem->owner->srcarevisible){// this line
			// Remove it from the CListCtrl
			LVFINDINFO find;
			...
		}

		// finally it could be delete
		delete delItem;
		bResult = true;


In void CDownloadListCtrl::UpdateItem(void* toupdate)
	CtrlItem_Struct* updateItem  = it->second;
	if (updateItem->owner && !updateItem->owner->srcarevisible)// this line
		continue;
	// Find entry in CListCtrl and update object
	LVFINDINFO find;
	...


3. Minimize issue
Sometimes tray icon is not in tray while m_bTrayIconVisible is true. That make eMule can't minimize to tray.
To fix it, remove if (!m_bTrayIconVisible) in CTrayDialog::TrayShow() .
BOOL CTrayDialog::TrayShow()
{
	BOOL bSuccess = FALSE;
	//if (!m_bTrayIconVisible)


4. UPNP issue - I've posted this fix to miniupnp forum.
After I installed VMWare, eMule's upnp did't work. VMWare add 2 Virtual Ethernet Adapters into my system. I guess upnp would fail when the system had 2 or more adapters.
Here's the fix.
In miniupnpc.c
add
#include <IPHlpApi.h>

for WIN32
In function upnpDiscover
at first
#ifndef WIN32

add else part
#else
MIB_IPFORWARDROW ip_forward;

And change
    sockudp_w.sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);

to
#ifdef WIN32
	if ( GetBestRoute(inet_addr("223.255.255.255"), 0, &ip_forward) != NO_ERROR) return NULL;
	sockudp_w.sin_addr.s_addr = ip_forward.dwForwardNextHop;
#else
	sockudp_w.sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);
#endif


5. VS2008 Windows 2000 issue
This should be added into SendMail.cpp if VS2008-compiled eMule wanna run on windows 2000(as freeaddrinfo is not available on windows 2000).
#if _MSC_VER >= 1500
#include <Ws2tcpip.h>
#include <Wspiapi.h>
#endif


6. VS2005 invalid_parameter
Recently my eMule encounters unexpectable crashes, and it can't create .dmp file. This might not happened to eMule compiled with VS2003.
As Ms said,

Quote

Significant enhancements have been made to make the CRT more secure in VS2005.

See Security Enhancements in the CRT
eMule should update its CMiniDumper to avoid something like http://connect.micro...edbackID=101337 (this page is also useful)
I've only implemented invalid_parameter which makes me fix that issue.
In void CMiniDumper::Enable(LPCTSTR pszAppName, bool bShowErrors, LPCTSTR pszDumpDir) @ mdump.cpp
change
	if (pfnMiniDumpWriteDump)
		SetUnhandledExceptionFilter(TopLevelFilter);

to
	if (pfnMiniDumpWriteDump){
		SetUnhandledExceptionFilter(TopLevelFilter);
#if _MSC_VER >= 1400
		_set_invalid_parameter_handler(InvalidParameterHandler);
#endif
	}


The InvalidParameterHandler's code is similarly with _invoke_watson @ crt\src\invarg.c(just remove
SetUnhandledExceptionFilter(NULL);
)

7. Memory leak after Low ID smart check fail.
I don't know whether it will happen to Official eMule. However, the OfFixed 1.0 apply this fix at a wrong place.
In void CServerSocket::OnReceive(int nErrorCode){
If "Use smart Low ID check on connect" is checked, CEMSocket::OnReceive(nErrorCode); possiblely call CServerConnect::ConnectionFailed in which it is said
// IMPORTANT: mark this socket not to be deleted in StopConnectionTry(),
// because it will delete itself after this function!

To fix it, add
	if(connectionstate == CS_ERROR){
		serverconnect->DestroySocket(this);
		return;
	}

after
CEMSocket::OnReceive(nErrorCode);

This post has been edited by dolphinX: 06 December 2009 - 12:16 PM

0

#2 User is offline   Stulle 

  • [Enter Mod] Dev
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5804
  • Joined: 07-April 04

Posted 07 December 2009 - 08:39 PM

imo the first is unneeded. uValue is a uint32 so it's just fine to go with uint32 in CTag(...).

other than that... you got some nice stuff there! thanks for sharing.
I am an emule-web.de member and fan!

[Imagine there was a sarcasm meter right here!]

No, there will not be a new version of my mods. No, I do not want your PM. No, I am certain, use the board and quit sending PMs. No, I am not kidding, there will not be a new version of my mods just because of YOU asking for it!
0

#3 User is offline   erpirata 

  • Member
  • PipPip
  • Group: Members
  • Posts: 48
  • Joined: 28-December 06

Posted 10 December 2009 - 09:16 AM

your code generates the following error:

Quote

1>miniupnpc.lib(miniupnpc.obj) : error LNK2001: unresolved external symbol _GetBestRoute@12
1>Output\Release\\emule.exe : fatal error LNK1120: 1 unresolved external Error

0

#4 User is offline   tHeWiZaRdOfDoS 

  • Man, what a bunch of jokers...
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5630
  • Joined: 28-December 02

Posted 10 December 2009 - 10:05 AM

You prolly have to add Iphlpapi.lib to the dependencies of your project.

@Stulle: the first one is valid as it's inside
void CAbstractFile::SetInt64TagValue(uint8 tagname, uint64 uValue)

Good eye, dolphinX!
0

#5 User is offline   Stulle 

  • [Enter Mod] Dev
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 5804
  • Joined: 07-April 04

Posted 11 December 2009 - 09:26 AM

you are right there, wiz, but then the bool parameter makes no sense whatsoever and could be removed, couldn't it?
I am an emule-web.de member and fan!

[Imagine there was a sarcasm meter right here!]

No, there will not be a new version of my mods. No, I do not want your PM. No, I am certain, use the board and quit sending PMs. No, I am not kidding, there will not be a new version of my mods just because of YOU asking for it!
0

#6 User is offline   fox88 

  • Golden eMule
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 4974
  • Joined: 13-May 07

Posted 19 February 2013 - 07:17 PM

Old topic, old issue.

View PostdolphinX, on 06 December 2009 - 03:11 PM, said:

3. Minimize issue
Sometimes tray icon is not in tray while m_bTrayIconVisible is true. That make eMule can't minimize to tray.
To fix it, remove if (!m_bTrayIconVisible) in CTrayDialog::TrayShow() .
BOOL CTrayDialog::TrayShow()
{
	BOOL bSuccess = FALSE;
	//if (!m_bTrayIconVisible)


I tried that idea.
Tray icon glitches are rare, but recently I use Remote Desktop Connection quite regularly, and almost every time when RDC is active, restored eMule does not remove icon from the tray. After that, I cannot minimize to tray.
Then I decided to comment out similar line in nearby TrayHide() in addition to the above. Like this:
BOOL CTrayDialog::TrayHide()
{
	BOOL bSuccess = FALSE;
//	if (m_bTrayIconVisible)


That is, Shell_NotifyIcon() always executes unconditionally both on minimize and on restore.
Appears to be working, though I'll keep watching.

As far as I get, Shell_NotifyIcon() sometimes could return error codes (obviously, for no major reasons). Error code should be analyzed and appropriate actions taken, while eMule essentially only was skiping change of value of the variable m_bTrayIconVisible. That way the variable gets out of sync with the tray icon, which prevents normal behaviour.
Commenting out variable check should not be very risky in my opinion.

Addition.
If someone wants to keep the variable m_bTrayIconVisible, then probably it should be unconditionally reset in CemuleDlg::RestoreWindow(). In the very least, it should be reset when command line "eMule restore" was executed.
That would give more chances to get back into sync with tray icon.

This post has been edited by fox88: 20 February 2013 - 02:54 PM

0

  • Member Options

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users