|
When you say 'exploding' can you be a bit more specific? Are you getting a valid 'buffer' back or is it NULL? Is the error itself a read access violation, or a write violation? Is it the first value of 'i' that errors, or one of the later ones? What's 'dwDesiredAccess' - does it contain 'FILE_MAP_READ'? How are you getting hFileMappingObject? Is the file you're modifying read only?
The code looks sensible enough to me there, so I suspect it'll be something outside of the snippet you've posted there
Matt Godbolt
Engineer, ProFactor Software
StyleManager project
|
|
|
|
|
It hangs up in the first i value, but I tried reading and it works fine.
So the problem is when I try to write the filemap...
Is strange, because I'm in a windows hook, and the filemap is beign oppened by the notepad, who provides read/write access to the file.
I'll check filemap access rights
Thanks for the feedback Matt
|
|
|
|
|
(buf2[i])++;
looks suspecious. Check two things:
1) What MapViewOfFile() returned is the starting address of a memory chunk in your address space. You may not be able to apply [i] to buf2.
2) If the memory is not initialized, you cannot apply ++ to its content.
Best,
Jun
|
|
|
|
|
If I read buf2 contents, I can see the contents of the file.
When I try to write in buf2, the program hangs up.
What is the method to read some specific data of the file mapping?
Let me explain me better, if I have a CFile object I can use Seek method to move around.
In a Memory mapped file, how can I do that?
|
|
|
|
|
Solved at last, I added PAGE_READWRITE access rights to CreateFileMapping.
I dont understand how a progran can save the changes in the document if it hasn't write rights...
Now the problem, is that whatever I change, is changed in the file too.
I need to keep working.
Thanks to all for the feedback
|
|
|
|
|
Using SHBrowseForFolder not possible have ComboBox and Edit box
if any Directory is selected then both Edit box and combo box are Being filled with Searched directories.
|
|
|
|
|
|
Hi,
I would like to write PushSource filter. This filter should allow the user to pass the single sample with method defined in interface. The problem is that this source filter should be universal, I mean capable to connect with any other filter. For example if I add into the graph a new decompressor that we haven't known before our source filter should connect to it and pass the samples. Does anyone have any idea how to do this? Or the only possible way is to set a lot of possibilities in GetMediaType?
|
|
|
|
|
For every mediatype you support, your source filter must be able to output that media type. If you want it to connect to a decompressor which supports a media type you don't know about, how do you output the samples it's expecting then?
Ok I think I know what you mean now. In that case you just have to provide another interface method that allows the user to set the media type of the sample that he's going to send. He would have to set the media type of the sample before the rest of the graph is built.
-- modified at 9:26 Wednesday 28th June, 2006
|
|
|
|
|
Thanks.
I was considering it before but to the last moment I wasn't sure if it is good idea.
|
|
|
|
|
I search a free book about Design Patterns in C++. If you know some please send me the link.
Thanks.
-:KNOX:-
|
|
|
|
|
|
|
Please say me what is the difference betweem typename and class in templates ?
Thanks.
-:KNOX:-
-- modified at 9:11 Wednesday 28th June, 2006
|
|
|
|
|
AFAIK one difference is that
1)'typename' can only be used in template definitions.
2) 'class' - could be for both class and template definitions.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I think they both have the same effect when are used in template declaration:
template< class T > ...
can be replaced with:
template< typename T > ...
But typename keyword has one more meaning when is used within the declared template class.
-- modified at 9:32 Wednesday 28th June, 2006
|
|
|
|
|
Thanks for the help.
-:KNOX:-
|
|
|
|
|
When dealing with templates, there is no difference between them.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hey,
I've a string including multiple lines. Now I want to use the DrawText DT_CALC feature to calc the height of the bounding rectangle, but leave the right side as it is.
The returning rect has always a extended right side. How can I solve this problem?
Thank you...
<br />
CRect reRect(0,0,150,0);<br />
CString szText("Hallo\ndies ist ein Test\nHello\nthis is a test");<br />
pDC->DrawText(szText,&reRect, DT_CALCRECT);<br />
-- modified at 9:12 Wednesday 28th June, 2006
|
|
|
|
|
|
Maybe you should include DT_WORDBREAK flags?
pDC->DrawText(szText, reRect, DT_CALCRECT | DT_WORDBREAK);
|
|
|
|
|
try using \r\n instead of \n only in szText
|
|
|
|
|
Hi,
This is my first post in the List.
I'm trying to compile a C++ code that uses AxisCpp on Windows
I get the following error:
[Linker error] undefined reference to `axiscpp::Stub::Stub(char const*, axiscpp::AXIS_PROTOCOL_TYPE)'
I have included the necessary libraries (axis_client.lib,axis_server.lib) and also mentioned where to look for the axiscpp header files.
I'm using Dev-Cpp 4.9.9.2 IDE for compiling. I have the axis package from http://ws.apache.org/axis (axiscpp for windows)
I'm unable to compile in Eclipse with CDT Plugin, also.
I'm able to compile the same using Visual Studio VC7.0 onwards.
Does anyone know a solution to this problem? (any extra linker options?)
Regards,
Sriram.V
|
|
|
|
|
|
Hi Sarath,
It's a linker error. I'm able to link all my other libraries except axiscpp libraries.
I'm having axis-c-1.6b for win32. The axis package provides 2 libraries "axis_client.lib" and "axis_server.lib".
The cl compiler that Visual Studio uses is able to find the libraries and I'm able to execute my project, but the g++ compiler that comes with Dev-Cpp and Eclipse with CDT plugin is unable to find the axis libraries.
One guess is that, the library I'm using is not conformant to the mingw compiler
or Does any extra linker arguments need to be specified for linking only axis libraries?
Extract from compile log:
----------------------------------
g++.exe ../../../../../CVSWorkspace/MyProject/agent/src/register/RegisterAgent.o ../../../../../CVSWorkspace/MyProject/agent/src/register/Agent.o ../../../../../CVSWorkspace/MyProject/agent/src/webserviceclient/stubs/Query.o
-o "RegisterAgent.exe" -L"D:/Dev-Cpp/lib" -L"D:/AxisClient/axis-c/axis-c-1.6b-Win32-trace-bin/lib/axis" -L"D:/CVSWorkspace/MyProject/3rdparty/agent-lib" -L"D:/CVSWorkspace/MyProject/3rdparty/sql-lib" -L"D:/AxisClient/axis-c/axis-c-1.6b-Win32-trace-bin/lib/axis" ../../../../../CVSWorkspace/MyProject/3rdparty/sql-lib/sqlite3.lib ../../../../../AxisClient/axis-c/axis-c-1.6b-Win32-trace-bin/lib/axis/axis_client.lib
../../../../../CVSWorkspace/MyProject/agent/src/webserviceclient/stubs/Query.o(.text+0x154):Query.cpp: undefined reference to `axiscpp::Stub::Stub(char const*, axiscpp::AXIS_PROTOCOL_TYPE)'
../../../../../CVSWorkspace/MyProject/agent/src/webserviceclient/stubs/Query.o(.text+0x844):Query.cpp: undefined reference to `axiscpp::Stub::~Stub()'
collect2: ld returned 1 exit status
make.exe: *** [RegisterAgent.exe] Error 1
Execution terminated
----------------------------------
Regards,
Sriram.V
|
|
|
|