mapviewoffile problem can't use it more than once? The Next CEO of Stack OverflowBatch file to delete files older than N daysWhy can't variables be declared in a switch statement?Why are elementwise additions much faster in separate loops than in a combined loop?Why is reading lines from stdin much slower in C++ than Python?fork() branches more than expected?Why is it faster to process a sorted array than an unsorted array?Can't start Eclipse - Java was started but returned exit code=13Is < faster than <=?Why should I use a pointer rather than the object itself?C++ code for testing the Collatz conjecture faster than hand-written assembly - why?

Is this a new Fibonacci Identity?

How do I secure a TV wall mount?

Calculate the Mean mean of two numbers

Upgrading From a 9 Speed Sora Derailleur?

Does the Idaho Potato Commission associate potato skins with healthy eating?

How can I replace x-axis labels with pre-determined symbols?

Could you use a laser beam as a modulated carrier wave for radio signal?

Is the offspring between a demon and a celestial possible? If so what is it called and is it in a book somewhere?

Find the majority element, which appears more than half the time

How seriously should I take size and weight limits of hand luggage?

Oldie but Goldie

How to coordinate airplane tickets?

How can I separate the number from the unit in argument?

Can Sri Krishna be called 'a person'?

Could a dragon use its wings to swim?

Is it reasonable to ask other researchers to send me their previous grant applications?

Is a linearly independent set whose span is dense a Schauder basis?

Read/write a pipe-delimited file line by line with some simple text manipulation

Why does the freezing point matter when picking cooler ice packs?

Does Germany produce more waste than the US?

How does a dynamic QR code work?

Is it "common practice in Fourier transform spectroscopy to multiply the measured interferogram by an apodizing function"? If so, why?

How should I connect my cat5 cable to connectors having an orange-green line?

How badly should I try to prevent a user from XSSing themselves?



mapviewoffile problem can't use it more than once?



The Next CEO of Stack OverflowBatch file to delete files older than N daysWhy can't variables be declared in a switch statement?Why are elementwise additions much faster in separate loops than in a combined loop?Why is reading lines from stdin much slower in C++ than Python?fork() branches more than expected?Why is it faster to process a sorted array than an unsorted array?Can't start Eclipse - Java was started but returned exit code=13Is < faster than <=?Why should I use a pointer rather than the object itself?C++ code for testing the Collatz conjecture faster than hand-written assembly - why?










0















 auto Readstring = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

printf("message has been sent to kernel [Read]! n");


FlushViewOfFile(Readstring, 4096);
UnmapViewOfFile(Readstring);


// maybe am stupid

auto send_test = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);


printf("message has been sent to kernel [Test]! n");


FlushViewOfFile(send_test, 4096);
UnmapViewOfFile(send_test);


that's what am trying to do and everytime i try to send the "Read" string + "Test" string it doesn't do anything but , if i only send "Read" string to my mapped section i can read it fine . i just want to know is it a problem because am not defining any offset to mapviewoffile but i have also tried to use (sizeof(char*)) and it didn't work. basically its simple i just want to send this 2 strings to my second process which has a while loop running it will check the first string and if its equal to the shared memory section it will execute the other while loop which keeps reading shared memory until its equal to the string "Test" this is how am reading the strings from my second process "its kernel btw".



while (TRUE)
{
DbgPrintEx(0, 0, "running waiting for a command to execute.. n");
ReadSharedMemory();
if (strcmp((PCHAR)SharedSection, "Stop") == 0)
DbgPrintEx(0, 0, "breaking out of the loop");
break;

while (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Read") == 0)

DbgPrintEx(0, 0, "Read loop is runningn");



ReadSharedMemory();
DbgPrintEx(0, 0, "sharedsection string - > : %sn", (PCHAR)SharedSection);



LARGE_INTEGER Timeout;
Timeout.QuadPart = RELATIVE(SECONDS(1));
KeDelayExecutionThread(KernelMode, FALSE, &Timeout);


if (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Test") == 0)

DbgPrintEx(0, 0, "it works finally !!!! n");
DbgPrintEx(0, 0, "[Test while loop]sharedsection string - > : %sn", (PCHAR)SharedSection);





and here is how i am reading shared memory



if (sectionHandle)
return;

if (SharedSection)
ZwUnmapViewOfSection(NtCurrentProcess(), SharedSection);

SIZE_T ulViewSize = 1024 * 10;
NTSTATUS ntStatus = ZwMapViewOfSection(sectionHandle, NtCurrentProcess(), &SharedSection, 0, ulViewSize, NULL, &ulViewSize, ViewShare, 0, PAGE_READWRITE | PAGE_NOCACHE);
if (ntStatus != STATUS_SUCCESS)

DbgPrintEx(0,0,"ZwMapViewOfSection fail! Status: %pn", ntStatus);
ZwClose(sectionHandle);
return;

DbgPrintEx(0,0,"ZwMapViewOfSection completed!n");
DbgPrintEx(0, 0, "String is : %s now !n", (PCHAR)SharedSection);


and sharedsections is just a null PVOID.










share|improve this question
























  • Could you please post a Minimal, Complete, and Verifiable example? It's a bit hard to try and understand what you are asking purely from your explanation + code snippet. A fully formed example would help.

    – Jesper Juhl
    Mar 21 at 20:17











  • @Jesper Juhl edited my post : couldn't add much better because i haven't seen anyone having this problem so i can't create an example because i really don't know why its doing that .

    – Frankoo
    Mar 21 at 20:24











  • I think tou may not understand what a Minimal, Complete, and Verifiable example is about. Perhaps read about SSCCE. The basic point is that you should produce a simple program (that we can cut-n-paste) that reproduces the problem and does not include anything unrelated to the problem. This means a main function + whatever else you need to cause the problem, but nothing else. Constructing this often reveals the cause of the problem btw.

    – Jesper Juhl
    Mar 21 at 20:29












  • @Jesper Juhl ok i will try to create it , maybe i will get it to be fixed :D

    – Frankoo
    Mar 21 at 22:11











  • @Jesper Juhl i have explained my problem right now much better .

    – Frankoo
    Mar 21 at 23:59















0















 auto Readstring = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

printf("message has been sent to kernel [Read]! n");


FlushViewOfFile(Readstring, 4096);
UnmapViewOfFile(Readstring);


// maybe am stupid

auto send_test = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);


printf("message has been sent to kernel [Test]! n");


FlushViewOfFile(send_test, 4096);
UnmapViewOfFile(send_test);


that's what am trying to do and everytime i try to send the "Read" string + "Test" string it doesn't do anything but , if i only send "Read" string to my mapped section i can read it fine . i just want to know is it a problem because am not defining any offset to mapviewoffile but i have also tried to use (sizeof(char*)) and it didn't work. basically its simple i just want to send this 2 strings to my second process which has a while loop running it will check the first string and if its equal to the shared memory section it will execute the other while loop which keeps reading shared memory until its equal to the string "Test" this is how am reading the strings from my second process "its kernel btw".



while (TRUE)
{
DbgPrintEx(0, 0, "running waiting for a command to execute.. n");
ReadSharedMemory();
if (strcmp((PCHAR)SharedSection, "Stop") == 0)
DbgPrintEx(0, 0, "breaking out of the loop");
break;

while (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Read") == 0)

DbgPrintEx(0, 0, "Read loop is runningn");



ReadSharedMemory();
DbgPrintEx(0, 0, "sharedsection string - > : %sn", (PCHAR)SharedSection);



LARGE_INTEGER Timeout;
Timeout.QuadPart = RELATIVE(SECONDS(1));
KeDelayExecutionThread(KernelMode, FALSE, &Timeout);


if (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Test") == 0)

DbgPrintEx(0, 0, "it works finally !!!! n");
DbgPrintEx(0, 0, "[Test while loop]sharedsection string - > : %sn", (PCHAR)SharedSection);





and here is how i am reading shared memory



if (sectionHandle)
return;

if (SharedSection)
ZwUnmapViewOfSection(NtCurrentProcess(), SharedSection);

SIZE_T ulViewSize = 1024 * 10;
NTSTATUS ntStatus = ZwMapViewOfSection(sectionHandle, NtCurrentProcess(), &SharedSection, 0, ulViewSize, NULL, &ulViewSize, ViewShare, 0, PAGE_READWRITE | PAGE_NOCACHE);
if (ntStatus != STATUS_SUCCESS)

DbgPrintEx(0,0,"ZwMapViewOfSection fail! Status: %pn", ntStatus);
ZwClose(sectionHandle);
return;

DbgPrintEx(0,0,"ZwMapViewOfSection completed!n");
DbgPrintEx(0, 0, "String is : %s now !n", (PCHAR)SharedSection);


and sharedsections is just a null PVOID.










share|improve this question
























  • Could you please post a Minimal, Complete, and Verifiable example? It's a bit hard to try and understand what you are asking purely from your explanation + code snippet. A fully formed example would help.

    – Jesper Juhl
    Mar 21 at 20:17











  • @Jesper Juhl edited my post : couldn't add much better because i haven't seen anyone having this problem so i can't create an example because i really don't know why its doing that .

    – Frankoo
    Mar 21 at 20:24











  • I think tou may not understand what a Minimal, Complete, and Verifiable example is about. Perhaps read about SSCCE. The basic point is that you should produce a simple program (that we can cut-n-paste) that reproduces the problem and does not include anything unrelated to the problem. This means a main function + whatever else you need to cause the problem, but nothing else. Constructing this often reveals the cause of the problem btw.

    – Jesper Juhl
    Mar 21 at 20:29












  • @Jesper Juhl ok i will try to create it , maybe i will get it to be fixed :D

    – Frankoo
    Mar 21 at 22:11











  • @Jesper Juhl i have explained my problem right now much better .

    – Frankoo
    Mar 21 at 23:59













0












0








0








 auto Readstring = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

printf("message has been sent to kernel [Read]! n");


FlushViewOfFile(Readstring, 4096);
UnmapViewOfFile(Readstring);


// maybe am stupid

auto send_test = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);


printf("message has been sent to kernel [Test]! n");


FlushViewOfFile(send_test, 4096);
UnmapViewOfFile(send_test);


that's what am trying to do and everytime i try to send the "Read" string + "Test" string it doesn't do anything but , if i only send "Read" string to my mapped section i can read it fine . i just want to know is it a problem because am not defining any offset to mapviewoffile but i have also tried to use (sizeof(char*)) and it didn't work. basically its simple i just want to send this 2 strings to my second process which has a while loop running it will check the first string and if its equal to the shared memory section it will execute the other while loop which keeps reading shared memory until its equal to the string "Test" this is how am reading the strings from my second process "its kernel btw".



while (TRUE)
{
DbgPrintEx(0, 0, "running waiting for a command to execute.. n");
ReadSharedMemory();
if (strcmp((PCHAR)SharedSection, "Stop") == 0)
DbgPrintEx(0, 0, "breaking out of the loop");
break;

while (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Read") == 0)

DbgPrintEx(0, 0, "Read loop is runningn");



ReadSharedMemory();
DbgPrintEx(0, 0, "sharedsection string - > : %sn", (PCHAR)SharedSection);



LARGE_INTEGER Timeout;
Timeout.QuadPart = RELATIVE(SECONDS(1));
KeDelayExecutionThread(KernelMode, FALSE, &Timeout);


if (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Test") == 0)

DbgPrintEx(0, 0, "it works finally !!!! n");
DbgPrintEx(0, 0, "[Test while loop]sharedsection string - > : %sn", (PCHAR)SharedSection);





and here is how i am reading shared memory



if (sectionHandle)
return;

if (SharedSection)
ZwUnmapViewOfSection(NtCurrentProcess(), SharedSection);

SIZE_T ulViewSize = 1024 * 10;
NTSTATUS ntStatus = ZwMapViewOfSection(sectionHandle, NtCurrentProcess(), &SharedSection, 0, ulViewSize, NULL, &ulViewSize, ViewShare, 0, PAGE_READWRITE | PAGE_NOCACHE);
if (ntStatus != STATUS_SUCCESS)

DbgPrintEx(0,0,"ZwMapViewOfSection fail! Status: %pn", ntStatus);
ZwClose(sectionHandle);
return;

DbgPrintEx(0,0,"ZwMapViewOfSection completed!n");
DbgPrintEx(0, 0, "String is : %s now !n", (PCHAR)SharedSection);


and sharedsections is just a null PVOID.










share|improve this question
















 auto Readstring = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);

printf("message has been sent to kernel [Read]! n");


FlushViewOfFile(Readstring, 4096);
UnmapViewOfFile(Readstring);


// maybe am stupid

auto send_test = (char*)MapViewOfFile(hMapFileW, FILE_MAP_WRITE, 0, 0, 4096);


printf("message has been sent to kernel [Test]! n");


FlushViewOfFile(send_test, 4096);
UnmapViewOfFile(send_test);


that's what am trying to do and everytime i try to send the "Read" string + "Test" string it doesn't do anything but , if i only send "Read" string to my mapped section i can read it fine . i just want to know is it a problem because am not defining any offset to mapviewoffile but i have also tried to use (sizeof(char*)) and it didn't work. basically its simple i just want to send this 2 strings to my second process which has a while loop running it will check the first string and if its equal to the shared memory section it will execute the other while loop which keeps reading shared memory until its equal to the string "Test" this is how am reading the strings from my second process "its kernel btw".



while (TRUE)
{
DbgPrintEx(0, 0, "running waiting for a command to execute.. n");
ReadSharedMemory();
if (strcmp((PCHAR)SharedSection, "Stop") == 0)
DbgPrintEx(0, 0, "breaking out of the loop");
break;

while (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Read") == 0)

DbgPrintEx(0, 0, "Read loop is runningn");



ReadSharedMemory();
DbgPrintEx(0, 0, "sharedsection string - > : %sn", (PCHAR)SharedSection);



LARGE_INTEGER Timeout;
Timeout.QuadPart = RELATIVE(SECONDS(1));
KeDelayExecutionThread(KernelMode, FALSE, &Timeout);


if (!(PCHAR)SharedSection == NULL && strcmp((PCHAR)SharedSection, "Test") == 0)

DbgPrintEx(0, 0, "it works finally !!!! n");
DbgPrintEx(0, 0, "[Test while loop]sharedsection string - > : %sn", (PCHAR)SharedSection);





and here is how i am reading shared memory



if (sectionHandle)
return;

if (SharedSection)
ZwUnmapViewOfSection(NtCurrentProcess(), SharedSection);

SIZE_T ulViewSize = 1024 * 10;
NTSTATUS ntStatus = ZwMapViewOfSection(sectionHandle, NtCurrentProcess(), &SharedSection, 0, ulViewSize, NULL, &ulViewSize, ViewShare, 0, PAGE_READWRITE | PAGE_NOCACHE);
if (ntStatus != STATUS_SUCCESS)

DbgPrintEx(0,0,"ZwMapViewOfSection fail! Status: %pn", ntStatus);
ZwClose(sectionHandle);
return;

DbgPrintEx(0,0,"ZwMapViewOfSection completed!n");
DbgPrintEx(0, 0, "String is : %s now !n", (PCHAR)SharedSection);


and sharedsections is just a null PVOID.







c++ windows kernel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 23:58







Frankoo

















asked Mar 21 at 20:07









FrankooFrankoo

84




84












  • Could you please post a Minimal, Complete, and Verifiable example? It's a bit hard to try and understand what you are asking purely from your explanation + code snippet. A fully formed example would help.

    – Jesper Juhl
    Mar 21 at 20:17











  • @Jesper Juhl edited my post : couldn't add much better because i haven't seen anyone having this problem so i can't create an example because i really don't know why its doing that .

    – Frankoo
    Mar 21 at 20:24











  • I think tou may not understand what a Minimal, Complete, and Verifiable example is about. Perhaps read about SSCCE. The basic point is that you should produce a simple program (that we can cut-n-paste) that reproduces the problem and does not include anything unrelated to the problem. This means a main function + whatever else you need to cause the problem, but nothing else. Constructing this often reveals the cause of the problem btw.

    – Jesper Juhl
    Mar 21 at 20:29












  • @Jesper Juhl ok i will try to create it , maybe i will get it to be fixed :D

    – Frankoo
    Mar 21 at 22:11











  • @Jesper Juhl i have explained my problem right now much better .

    – Frankoo
    Mar 21 at 23:59

















  • Could you please post a Minimal, Complete, and Verifiable example? It's a bit hard to try and understand what you are asking purely from your explanation + code snippet. A fully formed example would help.

    – Jesper Juhl
    Mar 21 at 20:17











  • @Jesper Juhl edited my post : couldn't add much better because i haven't seen anyone having this problem so i can't create an example because i really don't know why its doing that .

    – Frankoo
    Mar 21 at 20:24











  • I think tou may not understand what a Minimal, Complete, and Verifiable example is about. Perhaps read about SSCCE. The basic point is that you should produce a simple program (that we can cut-n-paste) that reproduces the problem and does not include anything unrelated to the problem. This means a main function + whatever else you need to cause the problem, but nothing else. Constructing this often reveals the cause of the problem btw.

    – Jesper Juhl
    Mar 21 at 20:29












  • @Jesper Juhl ok i will try to create it , maybe i will get it to be fixed :D

    – Frankoo
    Mar 21 at 22:11











  • @Jesper Juhl i have explained my problem right now much better .

    – Frankoo
    Mar 21 at 23:59
















Could you please post a Minimal, Complete, and Verifiable example? It's a bit hard to try and understand what you are asking purely from your explanation + code snippet. A fully formed example would help.

– Jesper Juhl
Mar 21 at 20:17





Could you please post a Minimal, Complete, and Verifiable example? It's a bit hard to try and understand what you are asking purely from your explanation + code snippet. A fully formed example would help.

– Jesper Juhl
Mar 21 at 20:17













@Jesper Juhl edited my post : couldn't add much better because i haven't seen anyone having this problem so i can't create an example because i really don't know why its doing that .

– Frankoo
Mar 21 at 20:24





@Jesper Juhl edited my post : couldn't add much better because i haven't seen anyone having this problem so i can't create an example because i really don't know why its doing that .

– Frankoo
Mar 21 at 20:24













I think tou may not understand what a Minimal, Complete, and Verifiable example is about. Perhaps read about SSCCE. The basic point is that you should produce a simple program (that we can cut-n-paste) that reproduces the problem and does not include anything unrelated to the problem. This means a main function + whatever else you need to cause the problem, but nothing else. Constructing this often reveals the cause of the problem btw.

– Jesper Juhl
Mar 21 at 20:29






I think tou may not understand what a Minimal, Complete, and Verifiable example is about. Perhaps read about SSCCE. The basic point is that you should produce a simple program (that we can cut-n-paste) that reproduces the problem and does not include anything unrelated to the problem. This means a main function + whatever else you need to cause the problem, but nothing else. Constructing this often reveals the cause of the problem btw.

– Jesper Juhl
Mar 21 at 20:29














@Jesper Juhl ok i will try to create it , maybe i will get it to be fixed :D

– Frankoo
Mar 21 at 22:11





@Jesper Juhl ok i will try to create it , maybe i will get it to be fixed :D

– Frankoo
Mar 21 at 22:11













@Jesper Juhl i have explained my problem right now much better .

– Frankoo
Mar 21 at 23:59





@Jesper Juhl i have explained my problem right now much better .

– Frankoo
Mar 21 at 23:59












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288511%2fmapviewoffile-problem-cant-use-it-more-than-once%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55288511%2fmapviewoffile-problem-cant-use-it-more-than-once%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript