50分求一个BC3.1下的XMS管理程序,我的调不通.

ydyuse 西北工业大学 2003-01-13 09:01:27
要求,不用INT15H。系统用DOS6.22
...全文
9 点赞 收藏 9
写回复
9 条回复
ydyuse 2003年01月15日
好,给我吧,我马上给分
回复 点赞
spirix 2003年01月15日
can you make that?
回复 点赞
spirix 2003年01月15日


// xmstest.cpp
//===========================================

#include "xmslib.h"
#include <STDIO.H>
MyXMS Mxms;
void main()
{
FILE *fp1,*fp2;
unsigned int Max;
unsigned Total;

unsigned long fsize=0,Xms_Size=0,FileLenth=0;
long size_=0;
// buff= new far char[2024];
char buff[2024]="ddddddddddddddddddddddddddddddddddd\
dddddddddddddddfffffffffffffffffffffffffffffffffffff\
ddddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddfffffffffffffffffffffffffffffffffffff\
ddddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddfffffffffffffffffffffffffffffffffffff\
ddddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
ddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddfffffffffffffffffffffffffffffffffffff\
ddddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
dddddddddddddddddddddddddddddddddddddddddddddddddddd\
ddddddddddddddddddddddddddddddddddddddddddddddddddd";
printf(" %d ",XMS_Test());


if((fp1= fopen("Temp.bmp","rb+"))==NULL) printf("Wrong");
if((fp2=fopen("out.exe", "wb" ))==NULL) printf("Wrong");
unsigned handle;
printf(" %d ", Mxms.XMS_Get(handle,100));
Mxms.XMS_Check(Max,Total);
printf("%d,%u|",Max,Total);
Mxms.Xmd.Source_Handle=0;
Mxms.Xmd.Source_Offset=(unsigned long)(buff);
Mxms.Xmd.Target_Handle=handle,
Mxms.Xmd.Target_Offset=0;
fseek(fp1,0L,2);
FileLenth=ftell(fp1);
rewind(fp1);

while(1)
{
size_=ftell(fp1);

fsize=fread((char far *)buff,1,2024,fp1);
Mxms.Xmd.Target_Offset=Xms_Size;
Mxms.Xmd.Move_Bytes=fsize;
Mxms.XMS_Move();
Xms_Size+=fsize;
// fseek(fp1,Xms_Size,0);
// Mxms.Xmd.Target_Offset+=fsize;
if (Xms_Size>=FileLenth) break;
}
//Xms_Size=Mxms.Xmd.Target_Offset;

fsize=0;
Mxms.Xmd.Source_Handle=handle;
Mxms.Xmd.Source_Offset=0;
Mxms.Xmd.Target_Handle=0,
Mxms.Xmd.Target_Offset=(unsigned long)(buff);


while(1)
{
if(Xms_Size-fsize>2024)
{
Mxms.Xmd.Source_Offset=fsize;
Mxms.Xmd.Move_Bytes=2024;
Mxms.XMS_Move();
fwrite(buff,2024,1,fp2);
fsize+=2024;
}
else
{
Mxms.Xmd.Source_Offset=fsize;
Mxms.Xmd.Move_Bytes=Xms_Size-fsize;
Mxms.XMS_Move();
fwrite(buff,Xms_Size-fsize,1,fp2);
break;
}


}
Mxms.XMS_Free(handle);
fclose (fp1);
fclose (fp2);

}

// bc3.1下运行
回复 点赞
spirix 2003年01月14日
我给的文档不能用吗?
我已经用它在dos下开发过两个软件了,用不用把测试程序也给你?
回复 点赞
ydyuse 2003年01月13日
只要可用,肯定给分
回复 点赞
spirix 2003年01月13日
请参考我的文档!
http://www.csdn.net/develop/read_article.asp?id=7198
记得给分哦!
回复 点赞
ydyuse 2003年01月13日
DOS4GW 模式??不好意思,我不明白是什么?
回复 点赞
Nepton 2003年01月13日
使用 DOS4GW 模式写程序
回复 点赞
ydyuse 2003年01月13日
各位继续!
回复 点赞
发动态
发帖子
C语言
创建于2007-09-28

3.2w+

社区成员

24.0w+

社区内容

C语言相关问题讨论
社区公告
暂无公告