|
Knave* wrote:
MSVCPP70
Check the dll's used with Dependency Walker.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Sounds more like a firewall/network problem to me. Where is the server located? Is it accesible from your friend's PC?
|
|
|
|
|
Hi,
I got error code 10013 for the follow fuction. But I can't fix the problem, some body help , please!!!
if(WSCInstallProvider( &filterguid, (unsigned short *)filter_path, &iplayerinfo, 1, &errorcode) == SOCKET_ERROR)
{
AfxMessageBox( "WSCInstallProvider Error : " + itos( errorcode ) );
return;
}
|
|
|
|
|
Just in case you haven't already read it, the following is from the documentation of Windows Sockets Error Codes[^] in MSDN:
WSAEACCES
10013
Permission denied.
An attempt was made to access a socket in a way forbidden by its access permissions. An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO_BROADCAST).
Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4 SP4 or later), another application, service, or kernel mode driver is bound to the same address with exclusive access. Such exclusive access is a new feature of Windows NT 4 SP4 and later, and is implemented by using the SO_EXCLUSIVEADDRUSE option.
See also: Windows Sockets Network Programming - Appendix C: Error Reference[^]
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Besides, what's the type of filter_path ? Why do you need a cast to (unsigned short*) ?
Hint: if filter_path is a char* , as I suspect, simply casting to (unsigned short*) won't work.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
<br />
PIMAGE_DOS_HEADER pDosHeader;<br />
PIMAGE_NT_HEADERS pNtHeader;<br />
DWORD NewEntryPoint = (DWORD)0x40123456;<br />
<br />
HANDLE hFile;
HANDLE hFileMapping;
<br />
hFile = CreateFile("Example.exe",FILE_ALL_ACCESS,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);<br />
<br />
hFileMapping = CreateFileMapping(hFile,0,PAGE_READWRITE,0,0,0);<br />
<br />
pDosHeader = (PIMAGE_DOS_HEADER)MapViewOfFile(hFileMapping,FILE_MAP_READ | FILE_MAP_WRITE,0,0,0);<br />
<br />
pNtHeader = (PIMAGE_NT_HEADERS)((DWORD)pDosHeader + (DWORD)pDosHeader->e_lfanew);<br />
<br />
char apa[1024];<br />
itoa((DWORD)pNtHeader->OptionalHeader.AddressOfEntryPoint,apa,1024);<br />
MessageBox(0,apa,"a",MB_OK);<br />
<br />
(DWORD)pNtHeader->OptionalHeader.AddressOfEntryPoint = (DWORD) NewEntryPoint;<br />
<br />
this:
<br />
pNtHeader = (PIMAGE_NT_HEADERS)((DWORD)pDosHeader + (DWORD)pDosHeader->e_lfanew);<br />
makes an error like this:
Unhandled exception at 0x00411b52 in pan.exe: 0xC0000005: Access violation reading location 0x0000003c.
how can I make this work right?
|
|
|
|
|
Hi Spirit,
First id like to declare that Ive never used the functions that you're using
in this code snippet but here's my two bobs worth.
1) It looks like MapViewOfFile is returning NULL (which it does in case of error). (so pDosHeader->e_lfanew evaluates to 0x3c... sounds feasible?)
2) Reading to doco it looks like the "dwDesiredAccess" flag isnt "addable"
(Ths do saye "This parameter can be one of the following values").
It also says that FILE_MAP_WRITE by iself gives RW access.
Try playing with the MapViewOfFile args and check the returned value for NULL maybe
Cheers
|
|
|
|
|
Maybe because in MapViewOfFile you left the last parameter at 0 (dwNumberOfBytesToMap) instead of setting it to size of file?
|
|
|
|
|
I’m trying to use a list box control in a windows app I’m writing. I put on the control on my dialog resource, I assign it a member variable: as a control, CListBox. But in my code, when I try to use the function AddString (i.e. dlg.m_variableName.AddString(“Some Letters”) ) I get a debug assertion failure. Maybe I’m missing a step here? Is there more initialization I have to do?
I don’t really need the selectability of a list box. I tried just making it an edit box with a scroll bar, but I can’t get each item on a new line.
Danny
|
|
|
|
|
|
Chris Losinger wrote:
where does the assert happen ?
The simple answer? Somewhere in the AddString method.
The more complicated answer? The debug pop up tells me the assertion failed at afxwin2.inl at line 669.
Danny
|
|
|
|
|
_AFXWIN_INLINE int CListBox::AddString(LPCTSTR lpszItem)
{ ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); }
it's failing because the CListBox isn't a window (yet). i'm guessing you're calling AddString before the dialog has had a chance to create the list box and/or associate it with your member variable.
put a breakpoint on your AddString and one in your dialog's OnInitDialog. if the AddString breakpoint hits first, you need to move it to after the dialog has been initialized.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
Alternatively, the release version works, or rather, survives. It works with the exception of the text that I wanted to put in the list box is not there.
Danny
|
|
|
|
|
The debug version ASSERT s because the window hasn't been created yet. In the release version, the ASSERT doesn't fire, and the SendMessage call silently fails. In this case, the control eventually gets created, but the string you're looking for isn't there due to the earlier SendMessage failure.
Software Zen: delete this;
|
|
|
|
|
bugDanny wrote:
But in my code, when I try to use the function AddString
Make sure you are doing this in the dialog's OnInitDialog() method, after the default method has been called.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Im trying to read a large text file with a CStdioFile object (the file's around 2.3 Gb, OS Windows XP, File System NTFS).
After reading for a while an exception is thrown during a CStdioFile::ReadString call which says something like "Controler Invalid"
I simplified the code so that its doing nothing more than loopìng around the ReadString call, and the error persists.
Could there be an inherent limit on the size of a file readable using CStdioFile (I dont belive that 2.3 Gb is too big for NTFS ?!?)
Thanks,
Dave
|
|
|
|
|
You may be running into some unexpected 32bit dword limitations, not necessarily a file os problem, but a file pointer limitation.
|
|
|
|
|
That sounds something like whats happening, but does anybody know of any settable limmitations of this type that exist?
|
|
|
|
|
Are you using VC6? if so then the file pointer used is a 32 bit value, with a limit of 2GB. AFAIK if you are using VC7+ then the file pointer is a 64 bit value.
If you want to get around this limit in VC6 then do not use the MFC classes (which wrap the fopen, fread, etc CRT functions) and use the SDK functions CreateFile, ReadFile etc.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Yes thats it PJ!
I am using VC6.
(I guess its time to shell out for an upgrade!)
Thanks so much for the help
|
|
|
|
|
PJ Arends wrote:
do not use the MFC classes (which wrap the fopen, fread, etc CRT functions)
Seriously? I always though that MFC didn't wrap CRT functions, but rather the WIN API directly! The CRT file API's (I don't know about the others) are just a layer on top of the OS's API's, which are CreateFile, ReadFile, etc..
I don't know about the MFC shipped with VC6, but the newer MFC version 8, does wrap the window's API's...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
From VC 6.0 MFC Source (FILECORE.CPP Line 111)
Yes it wraps Win32 API, not standard C runtime calls...
BOOL CFile::Open(LPCTSTR lpszFileName, UINT nOpenFlags,<br />
CFileException* pException)<br />
{<br />
<br />
...<br />
<br />
HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa,<br />
dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);<br />
if (hFile == INVALID_HANDLE_VALUE)<br />
{<br />
if (pException != NULL)<br />
{<br />
pException->m_lOsError = ::GetLastError();<br />
pException->m_cause =<br />
CFileException::OsErrorToException(pException->m_lOsError);<br />
<br />
<br />
pException->m_strFileName = lpszFileName;<br />
}<br />
return FALSE;<br />
}<br />
m_hFile = (HFILE)hFile;<br />
m_bCloseOnDelete = TRUE;
|
|
|
|
|
Just as I expected. It would be just silly for MS to use some portable API that is a layer on top of their own API, instead of their own API.
Thanks for the info!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I guess I should read the MFC source instead of MSDN[^]
[quote]
A CStdioFile object represents a C run-time stream file as opened by the run-time function fopen.
[/quote]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|