Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

HX fails at anonymous memory mapping (DOSX)

posted by myrkraverk, 25.11.2010, 00:44

Dear HX users,

HX 2.17 runs into an infinite loop or hangs with the following code. I did not bother to find out where it stops though. I am running on Freedos in VirtualBox. It works fine in Wine.

Mappings to actual files work.

#include <windows.h>

#include <iostream>
#include <cstdlib>

int main( int, char *[] )
{

  // Note: hardcoded size.
  HANDLE map = CreateFileMapping( 0, NULL, PAGE_READWRITE, 0, 6, NULL );

  void *buffer = MapViewOfFile( map, FILE_MAP_WRITE, 0, 0, 0 );

  std::memcpy( buffer, "hello", 6 );

  std::cout << static_cast< char * >( buffer ) << std::endl;

  return 0;
}


This is currently my showstopper at supporting DOS (though I don't think anyone will want to use my application, much less in DOS).

This is a practice/demonstration at using memory mappings so "just using new[]" isn't going to "help." In practice I'd probably use something else, honest!

If there is a memory mapper in some other DOS extender I may play with it as well.


Johann

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 94 users online (0 registered, 94 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum