Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8887971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:56:10+00:00 2026-06-14T21:56:10+00:00

Edit: Here is the entire code, ignore Romanian comments. Also 2 or 3 names

  • 0

Edit: Here is the entire code, ignore Romanian comments. Also 2 or 3 names are untranslated from Romanian: http://pastebin.com/JjtayvXX

I am trying to learn the basics of OS, now I’m working with named pipes under windows and I can’t tell what’s wrong.

Honestly I’m working off an example a friend did, but he’s just as bad as me if not worse. While hi’s program works (albeit it does something else), he can’t explain anything, most likely just copied from somewhere, still … not important, what I was trying to say I’m learning from examples, and not professional ones.

Server receives a message from the client, returns max and min numbers.

Server.c:

#include "windows.h"
#include "stdio.h"

struct Msg {
int numbers[20];
int length;
};

...

int main () {

HANDLE inputPipe, outputPipe; 
Msg msg;

while (true) {

inputPipe = CreateNamedPipe ("\\\\.\\pipe\\Client2Server",
                 PIPE_ACCESS_INBOUND,
                 PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, 
                 PIPE_UNLIMITED_INSTANCES,
                 0, //Numb of output bytes
                 sizeof(Msg),  // Numb of input bytes
                 0, // Wait forever
                 NULL); // Don't know how to use security

ConnectNamedPipe (inputPipe,NULL);

    // Here is where the server dies
    ReadFile (inputPipe, &msg,sizeof(Msg),NULL,NULL); 

Now Client.c:

struct Msg {
int numbers[20];
int length;
};


int main () {

HANDLE outputPipe, inputPipe;
Msg msg;

    // @misc: read data from keyboard, create msg   

outputPipe = CreateFile ("\\\\.\\pipe\\Client2Server",
            GENERIC_WRITE,
            FILE_SHARE_READ, // * comment after code
            NULL, // again, I know nothing about security attributes
            CREATE_ALWAYS, // either create or overwrite
            0,
            NULL);

// Here is where it dies
WriteFile (outputPipe, &msg, sizeof(Msg), NULL, NULL);

I get Access violation writing location 0x00000000. No idea why.

  • I would like that this process only writes, and another process (server) only reads. Is FILE_SHARE_READ OK ?

Also I don’t know how to mess with CreationDisposition / FlagsAndAttributes (last 2 parameters at CreateFile), are they OK ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:56:11+00:00Added an answer on June 14, 2026 at 9:56 pm

    Edit: Added actual answer, reference to other topic, tried it myself

    WriteFile()'s fourth parameter (pointer to variable that will store number of bytes) should not be null. Based on the API description, this parameter can ONLY be NULL if the fifth param, lpOverlapped, is NOT null.

    See similar topic here:
    Why does WriteFile crash when writing to the standard output?


    Can you check/printf the return values of ReadFile() (failed if return = 0 or FALSE) and client.c CreateFile() (failed if returns INVALID_HANDLE_VALUE) to see if they succeed?

    If failed, can you print the value returned by GetLastError() immediately after the call so that we can see the specific error?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
EDIT: See this in action here: http://jsbin.com/emobi/5 -- and that's using mouseenter/mouseleave. I have
EDIT - The code looks strange here, so I suggest viewing the files directly
here's my code: insert into archive from temp where temp.field6>archive.field6 i would like to
EDIT: Here is the entire chunck of what is in the table Hopefully this
EDIT: Here is the edited control file (control.ascx): <%@ Control Language=C# AutoEventWireup=true CodeFile=Sale.ascx.cs Inherits=Enmasse.Modules.Demo_Enmasse.Sale
EDIT: Here's a create script for the table minus the constraints on the keys
When inserting values into my table what do I edit here? Do I delete
When a user links to link it redirects to edit.php - here's an example:
I'm looking to analyze and compare the following `signals': (Edit: better renderings here: oscillations

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.