Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

un exe fonctionne plus sur IIS 6

8 réponses
Avatar
viviane
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge

8 réponses

Avatar
Guillaume Bordier [MS]
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par défaut, ni
IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This topic
provides administrative information on installing and configuring CGI
applications on the Web server, and setting the timeout value for a CGI
script.

CGI programs are executed when the Web server receives a URL that contains
the CGI program name and any parameters that it requires. If your CGI
program is compiled into an executable (.exe) file, you must give the
directory that contains the program Execute permissions so that users can
run the program. If your CGI program is written as a script, for example a
Perl script, then you can give the directory either Execute permissions or
Script permissions. To use Script permissions, the script interpreter must
be marked as a script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes by
default. If you create a new account and add it to the IIS_WPG group to run
a worker process identity, you still must grant this new account two user
rights to start CGI processes. These user rights are Adjust memory quotas
for a process and Replace a process level token. To modify user rights, see
Edit local security settings or Edit a security setting on a Group Policy
object.

Important In order to take a more proactive stance against malicious users
and attackers, IIS is not installed on members of the Microsoft® Windows®
Server 2003 family by default. Furthermore, when you initially install IIS,
the service is installed in a highly secure and "locked" mode. By default,
IIS serves only static content -- meaning features like ASP, ASP.NET,
Server-Side Includes, WebDAV publishing, and FrontPage® Server Extensions do
not work unless enabled. If you do not enable this functionality after
installing IIS, IIS returns a 404 error. You can serve dynamic content and
enable these features through the Web Service Extensions node in IIS
Manager. Also, if an application extension is not mapped in IIS, IIS returns
a 404 error. To map an extension, see Setting Application Mappings. For more
information on how to troubleshoot 404 errors, including 404.2 and 404.3;
issues related to a new installation of IIS 6.0; or an upgrade from a
previous version of IIS, see Troubleshooting.

If you want to develop new CGI applications, Microsoft provides several
alternatives. For faster execution, consider developing an Internet Server
API (ISAPI) extension instead. For ease of development, consider developing
an ASP.NET application. For more information, see ASP.NET.

Important You must be a member of the Administrators group on the local
computer to perform the following procedure (or procedures), or you must
have been delegated the appropriate authority. As a security best practice,
log on to your computer using an account that is not in the Administrators
group, and then use the Run as command to run IIS Manager as an
administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security, separate
your CGI programs from your content files. You do not need to name the
directory Cgi-bin, although you can do so if you want. For more information,
see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the appropriate
script interpreter. For example, to run Perl scripts, obtain a Perl
interpreter. Windows operating systems do not provide versions of Perl, SED,
or AWK. Instead, you must obtain these interpreters from third-party
developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the directory
either Execute permissions or Script permissions. For more information, see
Access Control.

If you choose to give the directory Script permissions, you must mark the
script interpreter as a script engine in the directory properties. Only
interpreters that are marked as script engines are allowed to execute in the
directory. Executable files (.dll and .exe files) cannot be directly
executed; that is, a browser request cannot launch an executable file on the
Web server by including the program name in the URL. By enabling Scripts
only permissions and selecting the Script engine check box, you can safely
put content files (such as .asp or .gif files) in the same directory as your
CGI scripts. Content files are displayed in the browser and scripts are
executed, but no one can run an unauthorized program and script commands are
not displayed in the browser.
4.. For CGI scripts, create an application mapping between the file name
extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you are
using Perl scripts stored in files with a .pl extension, map the .pl
extension to the program that runs Perl scripts. Map .bat and .cmd files to
the command interpreter (Cmd.exe). For more information, see Setting
Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions, verify
that all users who need to run the program have Execute permissions for the
directory. If your Web site accepts anonymous users, make sure that the
anonymous user (the IUSR_computername account) has Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command interpreter's
special characters to a mapped CGI application. By default, the following
characters cannot be included in the URL that calls the CGI application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge









begin 666 note.gif
M1TE&.#EA"@`*`+/_`(V,C?__S/_,`/%!?]=7<# P-/3T# P(6%A0("`@``
M`````````````````````"'Y! $```4`+ `````*``H`0 0H$,AI#)U*
AR1HB)(8'<N,7&EJG;JV P4GZ&@D2(";<>HF@,.B)```[
`
end

begin 666 important.gif
M1TE&.#EA"@`*`)'_````_P``@,# P)F9F2'Y! $```(`+ `````*``H```( ?E!6G"+D!1%-PB#$9L'A"$('9)P:6`4GFTYR/*Q0`.P``
`
end
Avatar
viviane
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le navigateur de
l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans le
message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par défaut, ni
IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This topic
provides administrative information on installing and configuring CGI
applications on the Web server, and setting the timeout value for a CGI
script.

CGI programs are executed when the Web server receives a URL that contains
the CGI program name and any parameters that it requires. If your CGI
program is compiled into an executable (.exe) file, you must give the
directory that contains the program Execute permissions so that users can
run the program. If your CGI program is written as a script, for example a
Perl script, then you can give the directory either Execute permissions or
Script permissions. To use Script permissions, the script interpreter must
be marked as a script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes by
default. If you create a new account and add it to the IIS_WPG group to
run a worker process identity, you still must grant this new account two
user rights to start CGI processes. These user rights are Adjust memory
quotas for a process and Replace a process level token. To modify user
rights, see Edit local security settings or Edit a security setting on a
Group Policy object.

Important In order to take a more proactive stance against malicious users
and attackers, IIS is not installed on members of the Microsoft® Windows®
Server 2003 family by default. Furthermore, when you initially install
IIS, the service is installed in a highly secure and "locked" mode. By
default, IIS serves only static content -- meaning features like ASP,
ASP.NET, Server-Side Includes, WebDAV publishing, and FrontPage® Server
Extensions do not work unless enabled. If you do not enable this
functionality after installing IIS, IIS returns a 404 error. You can serve
dynamic content and enable these features through the Web Service
Extensions node in IIS Manager. Also, if an application extension is not
mapped in IIS, IIS returns a 404 error. To map an extension, see Setting
Application Mappings. For more information on how to troubleshoot 404
errors, including 404.2 and 404.3; issues related to a new installation of
IIS 6.0; or an upgrade from a previous version of IIS, see
Troubleshooting.

If you want to develop new CGI applications, Microsoft provides several
alternatives. For faster execution, consider developing an Internet Server
API (ISAPI) extension instead. For ease of development, consider
developing an ASP.NET application. For more information, see ASP.NET.

Important You must be a member of the Administrators group on the local
computer to perform the following procedure (or procedures), or you must
have been delegated the appropriate authority. As a security best
practice, log on to your computer using an account that is not in the
Administrators group, and then use the Run as command to run IIS Manager
as an administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need to
name the directory Cgi-bin, although you can do so if you want. For more
information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the appropriate
script interpreter. For example, to run Perl scripts, obtain a Perl
interpreter. Windows operating systems do not provide versions of Perl,
SED, or AWK. Instead, you must obtain these interpreters from third-party
developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the directory
either Execute permissions or Script permissions. For more information,
see Access Control.

If you choose to give the directory Script permissions, you must mark the
script interpreter as a script engine in the directory properties. Only
interpreters that are marked as script engines are allowed to execute in
the directory. Executable files (.dll and .exe files) cannot be directly
executed; that is, a browser request cannot launch an executable file on
the Web server by including the program name in the URL. By enabling
Scripts only permissions and selecting the Script engine check box, you
can safely put content files (such as .asp or .gif files) in the same
directory as your CGI scripts. Content files are displayed in the browser
and scripts are executed, but no one can run an unauthorized program and
script commands are not displayed in the browser.
4.. For CGI scripts, create an application mapping between the file name
extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you are
using Perl scripts stored in files with a .pl extension, map the .pl
extension to the program that runs Perl scripts. Map .bat and .cmd files
to the command interpreter (Cmd.exe). For more information, see Setting
Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute permissions
for the directory. If your Web site accepts anonymous users, make sure
that the anonymous user (the IUSR_computername account) has Execute
permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By default,
the following characters cannot be included in the URL that calls the CGI
application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge












Avatar
Guillaume Bordier [MS]
Bonjour,

Donc vous confirmez avoir configuré IIS pour le CGI ?

Avez-vous les sources de ce programme, il serait peut être intéressant de
regarder de plus près.

En ligne de commande, votre executable fonctionne-t-il correctement ?





"viviane" wrote in message
news:cij5el$ltr$
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le navigateur
de l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans le
message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par défaut,
ni IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This topic
provides administrative information on installing and configuring CGI
applications on the Web server, and setting the timeout value for a CGI
script.

CGI programs are executed when the Web server receives a URL that
contains the CGI program name and any parameters that it requires. If
your CGI program is compiled into an executable (.exe) file, you must
give the directory that contains the program Execute permissions so that
users can run the program. If your CGI program is written as a script,
for example a Perl script, then you can give the directory either Execute
permissions or Script permissions. To use Script permissions, the script
interpreter must be marked as a script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes by
default. If you create a new account and add it to the IIS_WPG group to
run a worker process identity, you still must grant this new account two
user rights to start CGI processes. These user rights are Adjust memory
quotas for a process and Replace a process level token. To modify user
rights, see Edit local security settings or Edit a security setting on a
Group Policy object.

Important In order to take a more proactive stance against malicious
users and attackers, IIS is not installed on members of the Microsoft®
Windows® Server 2003 family by default. Furthermore, when you initially
install IIS, the service is installed in a highly secure and "locked"
mode. By default, IIS serves only static content -- meaning features like
ASP, ASP.NET, Server-Side Includes, WebDAV publishing, and FrontPage®
Server Extensions do not work unless enabled. If you do not enable this
functionality after installing IIS, IIS returns a 404 error. You can
serve dynamic content and enable these features through the Web Service
Extensions node in IIS Manager. Also, if an application extension is not
mapped in IIS, IIS returns a 404 error. To map an extension, see Setting
Application Mappings. For more information on how to troubleshoot 404
errors, including 404.2 and 404.3; issues related to a new installation
of IIS 6.0; or an upgrade from a previous version of IIS, see
Troubleshooting.

If you want to develop new CGI applications, Microsoft provides several
alternatives. For faster execution, consider developing an Internet
Server API (ISAPI) extension instead. For ease of development, consider
developing an ASP.NET application. For more information, see ASP.NET.

Important You must be a member of the Administrators group on the local
computer to perform the following procedure (or procedures), or you must
have been delegated the appropriate authority. As a security best
practice, log on to your computer using an account that is not in the
Administrators group, and then use the Run as command to run IIS Manager
as an administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need to
name the directory Cgi-bin, although you can do so if you want. For more
information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the appropriate
script interpreter. For example, to run Perl scripts, obtain a Perl
interpreter. Windows operating systems do not provide versions of Perl,
SED, or AWK. Instead, you must obtain these interpreters from third-party
developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the directory
either Execute permissions or Script permissions. For more information,
see Access Control.

If you choose to give the directory Script permissions, you must mark
the script interpreter as a script engine in the directory properties.
Only interpreters that are marked as script engines are allowed to
execute in the directory. Executable files (.dll and .exe files) cannot
be directly executed; that is, a browser request cannot launch an
executable file on the Web server by including the program name in the
URL. By enabling Scripts only permissions and selecting the Script engine
check box, you can safely put content files (such as .asp or .gif files)
in the same directory as your CGI scripts. Content files are displayed in
the browser and scripts are executed, but no one can run an unauthorized
program and script commands are not displayed in the browser.
4.. For CGI scripts, create an application mapping between the file name
extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you are
using Perl scripts stored in files with a .pl extension, map the .pl
extension to the program that runs Perl scripts. Map .bat and .cmd files
to the command interpreter (Cmd.exe). For more information, see Setting
Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute
permissions for the directory. If your Web site accepts anonymous users,
make sure that the anonymous user (the IUSR_computername account) has
Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By default,
the following characters cannot be included in the URL that calls the CGI
application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge
















Avatar
viviane
Je suis l'auteur du soft et c'est mon hébergeur qui est confronté à ce
problème
Il héberge mes sites dynamiques depuis trois ans...
Il a simplement changer de serveurs w2003/iis6 au lieu de w2000/iis5
En fait une seule ligne de code déraille : l'appel à API WriteFile
CallDLL32("kernel32","WriteFile", :hConsoleOutput, &gbPageArenvoyer, l, &w,
Null)
Le reste de l'exe est ok (lecture/écriture dans la base, envoi e-mail)
Les exe se termine par le renvoi de la page avec le résultat de l'opération
Et là Niet... Erreur Cgi : l'appli n'a pas renvoyé entête Htpp correcte
Nous avons rapatrié les sites sur l'ancien serveur est tout est à nouveau OK

J'ai isolé le problème par des écritures successives dans un fichier txt
pour m'appercevoir que c'est cette fonction... qui ne fonctionnent pas

Donc vous confirmez avoir configuré IIS pour le CGI ?


Définitevement oui car l'exe réalise les autres taches avant le renvoi
dans le navigateur de la page résultat.
Celle ci est correcte car j'ai mis son code html dans le corps des e-mails
envoyés

C'est comme si cette API ne fonctionnait plus !!!
J'ai pensé à un time-out qq part. L'exe ne renvoi pas assez vite la page
ou iis n'attend pas assez...

Un indice : sur le nouveau et l'ancien serveur, le même exe, la longueur de
la variable (l)
contenant le code html renvoyé est différente : 2 octets ???!!!

Voici les tests effectués:
Sur ancien serveur








[EXEC]
TestDebut 040917 - 14022133
TestEnvoi 040917 - 14022214
AvantAppelDll1 040917 - 14022214
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.creation-e-commerce.com/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB7 <<<< chiffre différent sur nouveau
AvantAppelDll2 040917 - 14022215
AprèstAppelDll2 040917 - 14022215
TestFin 040917 - 14022216


Sur nouveau serveur







[EXEC]
TestDebut 040917 - 13592395
TestEnvoi 040917 - 13592438
AvantAppelDll1 040917 - 13592438
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.formation-osteopathie/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB5 <<<<<<<<< chiffre différent sur
ancien serv
AvantAppelDll2 040917 - 13592442
<<<<< plus rien

Une histoire de codage ?

Merci d'éclairer ma lanterne qui est bien falote...

Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %
Bonjour,

Donc vous confirmez avoir configuré IIS pour le CGI ?

Avez-vous les sources de ce programme, il serait peut être intéressant de
regarder de plus près.

En ligne de commande, votre executable fonctionne-t-il correctement ?





"viviane" wrote in message
news:cij5el$ltr$
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le navigateur
de l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans le
message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par défaut,
ni IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This topic
provides administrative information on installing and configuring CGI
applications on the Web server, and setting the timeout value for a CGI
script.

CGI programs are executed when the Web server receives a URL that
contains the CGI program name and any parameters that it requires. If
your CGI program is compiled into an executable (.exe) file, you must
give the directory that contains the program Execute permissions so that
users can run the program. If your CGI program is written as a script,
for example a Perl script, then you can give the directory either
Execute permissions or Script permissions. To use Script permissions,
the script interpreter must be marked as a script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes by
default. If you create a new account and add it to the IIS_WPG group to
run a worker process identity, you still must grant this new account two
user rights to start CGI processes. These user rights are Adjust memory
quotas for a process and Replace a process level token. To modify user
rights, see Edit local security settings or Edit a security setting on a
Group Policy object.

Important In order to take a more proactive stance against malicious
users and attackers, IIS is not installed on members of the Microsoft®
Windows® Server 2003 family by default. Furthermore, when you initially
install IIS, the service is installed in a highly secure and "locked"
mode. By default, IIS serves only static content -- meaning features
like ASP, ASP.NET, Server-Side Includes, WebDAV publishing, and
FrontPage® Server Extensions do not work unless enabled. If you do not
enable this functionality after installing IIS, IIS returns a 404 error.
You can serve dynamic content and enable these features through the Web
Service Extensions node in IIS Manager. Also, if an application
extension is not mapped in IIS, IIS returns a 404 error. To map an
extension, see Setting Application Mappings. For more information on how
to troubleshoot 404 errors, including 404.2 and 404.3; issues related to
a new installation of IIS 6.0; or an upgrade from a previous version of
IIS, see Troubleshooting.

If you want to develop new CGI applications, Microsoft provides several
alternatives. For faster execution, consider developing an Internet
Server API (ISAPI) extension instead. For ease of development, consider
developing an ASP.NET application. For more information, see ASP.NET.

Important You must be a member of the Administrators group on the local
computer to perform the following procedure (or procedures), or you must
have been delegated the appropriate authority. As a security best
practice, log on to your computer using an account that is not in the
Administrators group, and then use the Run as command to run IIS Manager
as an administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need to
name the directory Cgi-bin, although you can do so if you want. For more
information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the
appropriate script interpreter. For example, to run Perl scripts, obtain
a Perl interpreter. Windows operating systems do not provide versions of
Perl, SED, or AWK. Instead, you must obtain these interpreters from
third-party developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the
directory either Execute permissions or Script permissions. For more
information, see Access Control.

If you choose to give the directory Script permissions, you must mark
the script interpreter as a script engine in the directory properties.
Only interpreters that are marked as script engines are allowed to
execute in the directory. Executable files (.dll and .exe files) cannot
be directly executed; that is, a browser request cannot launch an
executable file on the Web server by including the program name in the
URL. By enabling Scripts only permissions and selecting the Script
engine check box, you can safely put content files (such as .asp or .gif
files) in the same directory as your CGI scripts. Content files are
displayed in the browser and scripts are executed, but no one can run an
unauthorized program and script commands are not displayed in the
browser.
4.. For CGI scripts, create an application mapping between the file
name extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you
are using Perl scripts stored in files with a .pl extension, map the .pl
extension to the program that runs Perl scripts. Map .bat and .cmd files
to the command interpreter (Cmd.exe). For more information, see Setting
Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute
permissions for the directory. If your Web site accepts anonymous users,
make sure that the anonymous user (the IUSR_computername account) has
Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By
default, the following characters cannot be included in the URL that
calls the CGI application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge




















Avatar
Guillaume Bordier [MS]
Bonjour,

La fiche 238788 explique comment s'attacher en debugger à une appli CGI, ce
qui peut être utile pour poursuivre les investigations.
Car je ne vois pas grand chose qui puisse provoquer le problème.

avez vous bien comme précisé dans la fiche 239588 ajouté 1 à la taille de
votre buffer avant de passer à WriteFile ?

Vous pouvez essayer de m'envoyer votre appli si elle peut fonctionner en
standalone, je peux l'essayer sur un autre serveur.

( enlever o n l i n e de mon adresse)


"viviane" wrote in message
news:cijlug$qfh$
Je suis l'auteur du soft et c'est mon hébergeur qui est confronté à ce
problème
Il héberge mes sites dynamiques depuis trois ans...
Il a simplement changer de serveurs w2003/iis6 au lieu de w2000/iis5
En fait une seule ligne de code déraille : l'appel à API WriteFile
CallDLL32("kernel32","WriteFile", :hConsoleOutput, &gbPageArenvoyer, l,
&w,
Null)
Le reste de l'exe est ok (lecture/écriture dans la base, envoi e-mail)
Les exe se termine par le renvoi de la page avec le résultat de
l'opération
Et là Niet... Erreur Cgi : l'appli n'a pas renvoyé entête Htpp correcte
Nous avons rapatrié les sites sur l'ancien serveur est tout est à nouveau
OK

J'ai isolé le problème par des écritures successives dans un fichier txt
pour m'appercevoir que c'est cette fonction... qui ne fonctionnent pas

Donc vous confirmez avoir configuré IIS pour le CGI ?


Définitevement oui car l'exe réalise les autres taches avant le renvoi
dans le navigateur de la page résultat.
Celle ci est correcte car j'ai mis son code html dans le corps des e-mails
envoyés

C'est comme si cette API ne fonctionnait plus !!!
J'ai pensé à un time-out qq part. L'exe ne renvoi pas assez vite la page
ou iis n'attend pas assez...

Un indice : sur le nouveau et l'ancien serveur, le même exe, la longueur
de
la variable (l)
contenant le code html renvoyé est différente : 2 octets ???!!!

Voici les tests effectués:
Sur ancien serveur








[EXEC]
TestDebut 040917 - 14022133
TestEnvoi 040917 - 14022214
AvantAppelDll1 040917 - 14022214
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.creation-e-commerce.com/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB7 <<<< chiffre différent sur nouveau
AvantAppelDll2 040917 - 14022215
AprèstAppelDll2 040917 - 14022215
TestFin 040917 - 14022216


Sur nouveau serveur







[EXEC]
TestDebut 040917 - 13592395
TestEnvoi 040917 - 13592438
AvantAppelDll1 040917 - 13592438
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.formation-osteopathie/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB5 <<<<<<<<< chiffre différent sur
ancien serv
AvantAppelDll2 040917 - 13592442
<<<<< plus rien

Une histoire de codage ?

Merci d'éclairer ma lanterne qui est bien falote...

Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %
Bonjour,

Donc vous confirmez avoir configuré IIS pour le CGI ?

Avez-vous les sources de ce programme, il serait peut être intéressant de
regarder de plus près.

En ligne de commande, votre executable fonctionne-t-il correctement ?





"viviane" wrote in message
news:cij5el$ltr$
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le
navigateur de l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans le
message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par défaut,
ni IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This
topic provides administrative information on installing and configuring
CGI applications on the Web server, and setting the timeout value for a
CGI script.

CGI programs are executed when the Web server receives a URL that
contains the CGI program name and any parameters that it requires. If
your CGI program is compiled into an executable (.exe) file, you must
give the directory that contains the program Execute permissions so
that users can run the program. If your CGI program is written as a
script, for example a Perl script, then you can give the directory
either Execute permissions or Script permissions. To use Script
permissions, the script interpreter must be marked as a script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes by
default. If you create a new account and add it to the IIS_WPG group to
run a worker process identity, you still must grant this new account
two user rights to start CGI processes. These user rights are Adjust
memory quotas for a process and Replace a process level token. To
modify user rights, see Edit local security settings or Edit a security
setting on a Group Policy object.

Important In order to take a more proactive stance against malicious
users and attackers, IIS is not installed on members of the Microsoft®
Windows® Server 2003 family by default. Furthermore, when you initially
install IIS, the service is installed in a highly secure and "locked"
mode. By default, IIS serves only static content -- meaning features
like ASP, ASP.NET, Server-Side Includes, WebDAV publishing, and
FrontPage® Server Extensions do not work unless enabled. If you do not
enable this functionality after installing IIS, IIS returns a 404
error. You can serve dynamic content and enable these features through
the Web Service Extensions node in IIS Manager. Also, if an application
extension is not mapped in IIS, IIS returns a 404 error. To map an
extension, see Setting Application Mappings. For more information on
how to troubleshoot 404 errors, including 404.2 and 404.3; issues
related to a new installation of IIS 6.0; or an upgrade from a previous
version of IIS, see Troubleshooting.

If you want to develop new CGI applications, Microsoft provides several
alternatives. For faster execution, consider developing an Internet
Server API (ISAPI) extension instead. For ease of development, consider
developing an ASP.NET application. For more information, see ASP.NET.

Important You must be a member of the Administrators group on the local
computer to perform the following procedure (or procedures), or you
must have been delegated the appropriate authority. As a security best
practice, log on to your computer using an account that is not in the
Administrators group, and then use the Run as command to run IIS
Manager as an administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need to
name the directory Cgi-bin, although you can do so if you want. For
more information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the
appropriate script interpreter. For example, to run Perl scripts,
obtain a Perl interpreter. Windows operating systems do not provide
versions of Perl, SED, or AWK. Instead, you must obtain these
interpreters from third-party developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the
directory either Execute permissions or Script permissions. For more
information, see Access Control.

If you choose to give the directory Script permissions, you must mark
the script interpreter as a script engine in the directory properties.
Only interpreters that are marked as script engines are allowed to
execute in the directory. Executable files (.dll and .exe files) cannot
be directly executed; that is, a browser request cannot launch an
executable file on the Web server by including the program name in the
URL. By enabling Scripts only permissions and selecting the Script
engine check box, you can safely put content files (such as .asp or
.gif files) in the same directory as your CGI scripts. Content files
are displayed in the browser and scripts are executed, but no one can
run an unauthorized program and script commands are not displayed in
the browser.
4.. For CGI scripts, create an application mapping between the file
name extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you
are using Perl scripts stored in files with a .pl extension, map the
.pl extension to the program that runs Perl scripts. Map .bat and .cmd
files to the command interpreter (Cmd.exe). For more information, see
Setting Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute
permissions for the directory. If your Web site accepts anonymous
users, make sure that the anonymous user (the IUSR_computername
account) has Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By
default, the following characters cannot be included in the URL that
calls the CGI application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge
























Avatar
viviane
Merci pour votre aide, mais l'appli n'est pas fait avec un outil MS (Windev
de PcSoft)
J'ai beau tourner le problème dans tous les sens, scruter mon code, le
réduire au mini
faire toutes sortes d'essai, j'en déduis que c'est plutôt un problème
serveur.
D'autant que l'on dispose encore du 'vieux serveur' w2000 iis5 pour faire
tourner
les sites avant de basculer. Mon hébergeur cherche...
Merci encore
Cordialement. Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %23MJFI$
Bonjour,

La fiche 238788 explique comment s'attacher en debugger à une appli CGI,
ce qui peut être utile pour poursuivre les investigations.
Car je ne vois pas grand chose qui puisse provoquer le problème.

avez vous bien comme précisé dans la fiche 239588 ajouté 1 à la taille de
votre buffer avant de passer à WriteFile ?

Vous pouvez essayer de m'envoyer votre appli si elle peut fonctionner en
standalone, je peux l'essayer sur un autre serveur.

( enlever o n l i n e de mon adresse)


"viviane" wrote in message
news:cijlug$qfh$
Je suis l'auteur du soft et c'est mon hébergeur qui est confronté à ce
problème
Il héberge mes sites dynamiques depuis trois ans...
Il a simplement changer de serveurs w2003/iis6 au lieu de w2000/iis5
En fait une seule ligne de code déraille : l'appel à API WriteFile
CallDLL32("kernel32","WriteFile", :hConsoleOutput, &gbPageArenvoyer, l,
&w,
Null)
Le reste de l'exe est ok (lecture/écriture dans la base, envoi e-mail)
Les exe se termine par le renvoi de la page avec le résultat de
l'opération
Et là Niet... Erreur Cgi : l'appli n'a pas renvoyé entête Htpp correcte
Nous avons rapatrié les sites sur l'ancien serveur est tout est à nouveau
OK

J'ai isolé le problème par des écritures successives dans un fichier txt
pour m'appercevoir que c'est cette fonction... qui ne fonctionnent pas

Donc vous confirmez avoir configuré IIS pour le CGI ?


Définitevement oui car l'exe réalise les autres taches avant le renvoi
dans le navigateur de la page résultat.
Celle ci est correcte car j'ai mis son code html dans le corps des
e-mails
envoyés

C'est comme si cette API ne fonctionnait plus !!!
J'ai pensé à un time-out qq part. L'exe ne renvoi pas assez vite la page
ou iis n'attend pas assez...

Un indice : sur le nouveau et l'ancien serveur, le même exe, la longueur
de
la variable (l)
contenant le code html renvoyé est différente : 2 octets ???!!!

Voici les tests effectués:
Sur ancien serveur








[EXEC]
TestDebut 040917 - 14022133
TestEnvoi 040917 - 14022214
AvantAppelDll1 040917 - 14022214
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.creation-e-commerce.com/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB7 <<<< chiffre différent sur nouveau
AvantAppelDll2 040917 - 14022215
AprèstAppelDll2 040917 - 14022215
TestFin 040917 - 14022216


Sur nouveau serveur







[EXEC]
TestDebut 040917 - 13592395
TestEnvoi 040917 - 13592438
AvantAppelDll1 040917 - 13592438
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.formation-osteopathie/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB5 <<<<<<<<< chiffre différent sur
ancien serv
AvantAppelDll2 040917 - 13592442
<<<<< plus rien

Une histoire de codage ?

Merci d'éclairer ma lanterne qui est bien falote...

Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %
Bonjour,

Donc vous confirmez avoir configuré IIS pour le CGI ?

Avez-vous les sources de ce programme, il serait peut être intéressant
de regarder de plus près.

En ligne de commande, votre executable fonctionne-t-il correctement ?





"viviane" wrote in message
news:cij5el$ltr$
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le
navigateur de l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans
le message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par
défaut, ni IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This
topic provides administrative information on installing and
configuring CGI applications on the Web server, and setting the
timeout value for a CGI script.

CGI programs are executed when the Web server receives a URL that
contains the CGI program name and any parameters that it requires. If
your CGI program is compiled into an executable (.exe) file, you must
give the directory that contains the program Execute permissions so
that users can run the program. If your CGI program is written as a
script, for example a Perl script, then you can give the directory
either Execute permissions or Script permissions. To use Script
permissions, the script interpreter must be marked as a script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes
by default. If you create a new account and add it to the IIS_WPG
group to run a worker process identity, you still must grant this new
account two user rights to start CGI processes. These user rights are
Adjust memory quotas for a process and Replace a process level token.
To modify user rights, see Edit local security settings or Edit a
security setting on a Group Policy object.

Important In order to take a more proactive stance against malicious
users and attackers, IIS is not installed on members of the Microsoft®
Windows® Server 2003 family by default. Furthermore, when you
initially install IIS, the service is installed in a highly secure and
"locked" mode. By default, IIS serves only static content -- meaning
features like ASP, ASP.NET, Server-Side Includes, WebDAV publishing,
and FrontPage® Server Extensions do not work unless enabled. If you do
not enable this functionality after installing IIS, IIS returns a 404
error. You can serve dynamic content and enable these features through
the Web Service Extensions node in IIS Manager. Also, if an
application extension is not mapped in IIS, IIS returns a 404 error.
To map an extension, see Setting Application Mappings. For more
information on how to troubleshoot 404 errors, including 404.2 and
404.3; issues related to a new installation of IIS 6.0; or an upgrade
from a previous version of IIS, see Troubleshooting.

If you want to develop new CGI applications, Microsoft provides
several alternatives. For faster execution, consider developing an
Internet Server API (ISAPI) extension instead. For ease of
development, consider developing an ASP.NET application. For more
information, see ASP.NET.

Important You must be a member of the Administrators group on the
local computer to perform the following procedure (or procedures), or
you must have been delegated the appropriate authority. As a security
best practice, log on to your computer using an account that is not in
the Administrators group, and then use the Run as command to run IIS
Manager as an administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need to
name the directory Cgi-bin, although you can do so if you want. For
more information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the
appropriate script interpreter. For example, to run Perl scripts,
obtain a Perl interpreter. Windows operating systems do not provide
versions of Perl, SED, or AWK. Instead, you must obtain these
interpreters from third-party developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the
directory either Execute permissions or Script permissions. For more
information, see Access Control.

If you choose to give the directory Script permissions, you must mark
the script interpreter as a script engine in the directory properties.
Only interpreters that are marked as script engines are allowed to
execute in the directory. Executable files (.dll and .exe files)
cannot be directly executed; that is, a browser request cannot launch
an executable file on the Web server by including the program name in
the URL. By enabling Scripts only permissions and selecting the Script
engine check box, you can safely put content files (such as .asp or
.gif files) in the same directory as your CGI scripts. Content files
are displayed in the browser and scripts are executed, but no one can
run an unauthorized program and script commands are not displayed in
the browser.
4.. For CGI scripts, create an application mapping between the file
name extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you
are using Perl scripts stored in files with a .pl extension, map the
.pl extension to the program that runs Perl scripts. Map .bat and .cmd
files to the command interpreter (Cmd.exe). For more information, see
Setting Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute
permissions for the directory. If your Web site accepts anonymous
users, make sure that the anonymous user (the IUSR_computername
account) has Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By
default, the following characters cannot be included in the URL that
calls the CGI application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge




























Avatar
Guillaume Bordier [MS]
Bonjour,

Je viens de compiler le sample suivant qui fonctionne parfaitement sous
Windows 2003/IIS6, êtes vous sûr de renvoyer les bons headers ? peut être
IIS 6.0 est-il plus restrictif que IIS 5.0. Si vous n'avez pas de
compilateur sous la main, je peux vous envoyer la forme executable.


Si votre erreurs est bien "The specified CGI application misbehaved by not
returning a complete set of HTTP headers" c'est bien que votre appli ne
renvoie pas les bons headers HTTP, voir fiche 145661.


#include <windows.h>
#include <stdio.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])

{

TCHAR szBuf[20048];

TCHAR szContent[2048];

TCHAR szBuf1[2048];

int taille=0;

HANDLE H1=NULL;

DWORD bw=0;

_tcscpy(szContent,TEXT("<HTML> hello world </HTML>"));


_tcscpy(szBuf,TEXT(""));

_tcscat(szBuf,TEXT("HTTP/1.1 200 OKn"));

_tcscat(szBuf,TEXT("Content-Type: text/htmlnnn"));

_tcscat(szBuf,szContent);

H1=GetStdHandle(STD_OUTPUT_HANDLE);

if (H1) {

if (!WriteFile(H1,szBuf,(_tcslen(szBuf)+1)*sizeof(TCHAR),&bw,NULL)){

return(-1);

}

}

return 0;

}


"viviane" wrote in message
news:cimluh$pmc$
Merci pour votre aide, mais l'appli n'est pas fait avec un outil MS
(Windev de PcSoft)
J'ai beau tourner le problème dans tous les sens, scruter mon code, le
réduire au mini
faire toutes sortes d'essai, j'en déduis que c'est plutôt un problème
serveur.
D'autant que l'on dispose encore du 'vieux serveur' w2000 iis5 pour faire
tourner
les sites avant de basculer. Mon hébergeur cherche...
Merci encore
Cordialement. Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %23MJFI$
Bonjour,

La fiche 238788 explique comment s'attacher en debugger à une appli CGI,
ce qui peut être utile pour poursuivre les investigations.
Car je ne vois pas grand chose qui puisse provoquer le problème.

avez vous bien comme précisé dans la fiche 239588 ajouté 1 à la taille de
votre buffer avant de passer à WriteFile ?

Vous pouvez essayer de m'envoyer votre appli si elle peut fonctionner en
standalone, je peux l'essayer sur un autre serveur.

( enlever o n l i n e de mon adresse)


"viviane" wrote in message
news:cijlug$qfh$
Je suis l'auteur du soft et c'est mon hébergeur qui est confronté à ce
problème
Il héberge mes sites dynamiques depuis trois ans...
Il a simplement changer de serveurs w2003/iis6 au lieu de w2000/iis5
En fait une seule ligne de code déraille : l'appel à API WriteFile
CallDLL32("kernel32","WriteFile", :hConsoleOutput, &gbPageArenvoyer, l,
&w,
Null)
Le reste de l'exe est ok (lecture/écriture dans la base, envoi e-mail)
Les exe se termine par le renvoi de la page avec le résultat de
l'opération
Et là Niet... Erreur Cgi : l'appli n'a pas renvoyé entête Htpp correcte
Nous avons rapatrié les sites sur l'ancien serveur est tout est à
nouveau OK

J'ai isolé le problème par des écritures successives dans un fichier txt
pour m'appercevoir que c'est cette fonction... qui ne fonctionnent pas

Donc vous confirmez avoir configuré IIS pour le CGI ?


Définitevement oui car l'exe réalise les autres taches avant le renvoi
dans le navigateur de la page résultat.
Celle ci est correcte car j'ai mis son code html dans le corps des
e-mails
envoyés

C'est comme si cette API ne fonctionnait plus !!!
J'ai pensé à un time-out qq part. L'exe ne renvoi pas assez vite la page
ou iis n'attend pas assez...

Un indice : sur le nouveau et l'ancien serveur, le même exe, la longueur
de
la variable (l)
contenant le code html renvoyé est différente : 2 octets ???!!!

Voici les tests effectués:
Sur ancien serveur








[EXEC]
TestDebut 040917 - 14022133
TestEnvoi 040917 - 14022214
AvantAppelDll1 040917 - 14022214
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.creation-e-commerce.com/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB7 <<<< chiffre différent sur nouveau
AvantAppelDll2 040917 - 14022215
AprèstAppelDll2 040917 - 14022215
TestFin 040917 - 14022216


Sur nouveau serveur







[EXEC]
TestDebut 040917 - 13592395
TestEnvoi 040917 - 13592438
AvantAppelDll1 040917 - 13592438
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.formation-osteopathie/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB5 <<<<<<<<< chiffre différent sur
ancien serv
AvantAppelDll2 040917 - 13592442
<<<<< plus rien

Une histoire de codage ?

Merci d'éclairer ma lanterne qui est bien falote...

Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %
Bonjour,

Donc vous confirmez avoir configuré IIS pour le CGI ?

Avez-vous les sources de ce programme, il serait peut être intéressant
de regarder de plus près.

En ligne de commande, votre executable fonctionne-t-il correctement ?





"viviane" wrote in message
news:cij5el$ltr$
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant
FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le
navigateur de l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans
le message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par
défaut, ni IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This
topic provides administrative information on installing and
configuring CGI applications on the Web server, and setting the
timeout value for a CGI script.

CGI programs are executed when the Web server receives a URL that
contains the CGI program name and any parameters that it requires. If
your CGI program is compiled into an executable (.exe) file, you must
give the directory that contains the program Execute permissions so
that users can run the program. If your CGI program is written as a
script, for example a Perl script, then you can give the directory
either Execute permissions or Script permissions. To use Script
permissions, the script interpreter must be marked as a script
engine.

Note The IIS_WPG group doesn't have the right to start CGI processes
by default. If you create a new account and add it to the IIS_WPG
group to run a worker process identity, you still must grant this new
account two user rights to start CGI processes. These user rights are
Adjust memory quotas for a process and Replace a process level token.
To modify user rights, see Edit local security settings or Edit a
security setting on a Group Policy object.

Important In order to take a more proactive stance against malicious
users and attackers, IIS is not installed on members of the
Microsoft® Windows® Server 2003 family by default. Furthermore, when
you initially install IIS, the service is installed in a highly
secure and "locked" mode. By default, IIS serves only static
content -- meaning features like ASP, ASP.NET, Server-Side Includes,
WebDAV publishing, and FrontPage® Server Extensions do not work
unless enabled. If you do not enable this functionality after
installing IIS, IIS returns a 404 error. You can serve dynamic
content and enable these features through the Web Service Extensions
node in IIS Manager. Also, if an application extension is not mapped
in IIS, IIS returns a 404 error. To map an extension, see Setting
Application Mappings. For more information on how to troubleshoot 404
errors, including 404.2 and 404.3; issues related to a new
installation of IIS 6.0; or an upgrade from a previous version of
IIS, see Troubleshooting.

If you want to develop new CGI applications, Microsoft provides
several alternatives. For faster execution, consider developing an
Internet Server API (ISAPI) extension instead. For ease of
development, consider developing an ASP.NET application. For more
information, see ASP.NET.

Important You must be a member of the Administrators group on the
local computer to perform the following procedure (or procedures), or
you must have been delegated the appropriate authority. As a security
best practice, log on to your computer using an account that is not
in the Administrators group, and then use the Run as command to run
IIS Manager as an administrator. From the command prompt, type runas
/user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need
to name the directory Cgi-bin, although you can do so if you want.
For more information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the
appropriate script interpreter. For example, to run Perl scripts,
obtain a Perl interpreter. Windows operating systems do not provide
versions of Perl, SED, or AWK. Instead, you must obtain these
interpreters from third-party developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the
directory either Execute permissions or Script permissions. For more
information, see Access Control.

If you choose to give the directory Script permissions, you must
mark the script interpreter as a script engine in the directory
properties. Only interpreters that are marked as script engines are
allowed to execute in the directory. Executable files (.dll and .exe
files) cannot be directly executed; that is, a browser request cannot
launch an executable file on the Web server by including the program
name in the URL. By enabling Scripts only permissions and selecting
the Script engine check box, you can safely put content files (such
as .asp or .gif files) in the same directory as your CGI scripts.
Content files are displayed in the browser and scripts are executed,
but no one can run an unauthorized program and script commands are
not displayed in the browser.
4.. For CGI scripts, create an application mapping between the file
name extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if you
are using Perl scripts stored in files with a .pl extension, map the
.pl extension to the program that runs Perl scripts. Map .bat and
.cmd files to the command interpreter (Cmd.exe). For more
information, see Setting Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute
permissions for the directory. If your Web site accepts anonymous
users, make sure that the anonymous user (the IUSR_computername
account) has Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By
default, the following characters cannot be included in the URL that
calls the CGI application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge
































Avatar
viviane
C'est corrigé !
Une legère faute de frappe dans l'entête.... AAARRGGH !
W2000 / iis5 laisse passer... pas w2003 / iis6
Merci beaucoup
Très cordialement. Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news:
Bonjour,

Je viens de compiler le sample suivant qui fonctionne parfaitement sous
Windows 2003/IIS6, êtes vous sûr de renvoyer les bons headers ? peut être
IIS 6.0 est-il plus restrictif que IIS 5.0. Si vous n'avez pas de
compilateur sous la main, je peux vous envoyer la forme executable.


Si votre erreurs est bien "The specified CGI application misbehaved by not
returning a complete set of HTTP headers" c'est bien que votre appli ne
renvoie pas les bons headers HTTP, voir fiche 145661.


#include <windows.h>
#include <stdio.h>
#include <tchar.h>
int _tmain(int argc, _TCHAR* argv[])

{

TCHAR szBuf[20048];

TCHAR szContent[2048];

TCHAR szBuf1[2048];

int taille=0;

HANDLE H1=NULL;

DWORD bw=0;

_tcscpy(szContent,TEXT("<HTML> hello world </HTML>"));


_tcscpy(szBuf,TEXT(""));

_tcscat(szBuf,TEXT("HTTP/1.1 200 OKn"));

_tcscat(szBuf,TEXT("Content-Type: text/htmlnnn"));

_tcscat(szBuf,szContent);

H1=GetStdHandle(STD_OUTPUT_HANDLE);

if (H1) {

if (!WriteFile(H1,szBuf,(_tcslen(szBuf)+1)*sizeof(TCHAR),&bw,NULL)){

return(-1);

}

}

return 0;

}


"viviane" wrote in message
news:cimluh$pmc$
Merci pour votre aide, mais l'appli n'est pas fait avec un outil MS
(Windev de PcSoft)
J'ai beau tourner le problème dans tous les sens, scruter mon code, le
réduire au mini
faire toutes sortes d'essai, j'en déduis que c'est plutôt un problème
serveur.
D'autant que l'on dispose encore du 'vieux serveur' w2000 iis5 pour faire
tourner
les sites avant de basculer. Mon hébergeur cherche...
Merci encore
Cordialement. Serge Aubert

"Guillaume Bordier [MS]" a écrit dans le
message de news: %23MJFI$
Bonjour,

La fiche 238788 explique comment s'attacher en debugger à une appli CGI,
ce qui peut être utile pour poursuivre les investigations.
Car je ne vois pas grand chose qui puisse provoquer le problème.

avez vous bien comme précisé dans la fiche 239588 ajouté 1 à la taille
de votre buffer avant de passer à WriteFile ?

Vous pouvez essayer de m'envoyer votre appli si elle peut fonctionner en
standalone, je peux l'essayer sur un autre serveur.

( enlever o n l i n e de mon adresse)


"viviane" wrote in message
news:cijlug$qfh$
Je suis l'auteur du soft et c'est mon hébergeur qui est confronté à ce
problème
Il héberge mes sites dynamiques depuis trois ans...
Il a simplement changer de serveurs w2003/iis6 au lieu de w2000/iis5
En fait une seule ligne de code déraille : l'appel à API WriteFile
CallDLL32("kernel32","WriteFile", :hConsoleOutput, &gbPageArenvoyer, l,
&w,
Null)
Le reste de l'exe est ok (lecture/écriture dans la base, envoi e-mail)
Les exe se termine par le renvoi de la page avec le résultat de
l'opération
Et là Niet... Erreur Cgi : l'appli n'a pas renvoyé entête Htpp correcte
Nous avons rapatrié les sites sur l'ancien serveur est tout est à
nouveau OK

J'ai isolé le problème par des écritures successives dans un fichier
txt
pour m'appercevoir que c'est cette fonction... qui ne fonctionnent pas

Donc vous confirmez avoir configuré IIS pour le CGI ?


Définitevement oui car l'exe réalise les autres taches avant le renvoi
dans le navigateur de la page résultat.
Celle ci est correcte car j'ai mis son code html dans le corps des
e-mails
envoyés

C'est comme si cette API ne fonctionnait plus !!!
J'ai pensé à un time-out qq part. L'exe ne renvoi pas assez vite la
page
ou iis n'attend pas assez...

Un indice : sur le nouveau et l'ancien serveur, le même exe, la
longueur de
la variable (l)
contenant le code html renvoyé est différente : 2 octets ???!!!

Voici les tests effectués:
Sur ancien serveur








[EXEC]
TestDebut 040917 - 14022133
TestEnvoi 040917 - 14022214
AvantAppelDll1 040917 - 14022214
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.creation-e-commerce.com/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB7 <<<< chiffre différent sur nouveau
AvantAppelDll2 040917 - 14022215
AprèstAppelDll2 040917 - 14022215
TestFin 040917 - 14022216


Sur nouveau serveur







[EXEC]
TestDebut 040917 - 13592395
TestEnvoi 040917 - 13592438
AvantAppelDll1 040917 - 13592438
ContenuHtml=<HTML>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<meta http-equiv="Refresh"
content="1;URL=http://www.formation-osteopathie/index.htm">
<title></title>
</head>
<body bgcolor="#000066">
<br><br><br><table width="400" height="150" border="0" align="center"
bgcolor="#FFFFFF" summary="">
<tr><td align="center">
<H4>Votre mail a été expédié</H4></td></tr></table></body></html>

ContenuOutputl=Nulllllle
ContenuW=Nulllllllllllllllllle
ContenuNbBytesB5 <<<<<<<<< chiffre différent sur
ancien serv
AvantAppelDll2 040917 - 13592442
<<<<< plus rien

Une histoire de codage ?

Merci d'éclairer ma lanterne qui est bien falote...

Serge Aubert

"Guillaume Bordier [MS]" a écrit dans
le message de news: %
Bonjour,

Donc vous confirmez avoir configuré IIS pour le CGI ?

Avez-vous les sources de ce programme, il serait peut être intéressant
de regarder de plus près.

En ligne de commande, votre executable fonctionne-t-il correctement ?





"viviane" wrote in message
news:cij5el$ltr$
Merci... mais vous n'avez pas bien compris mon problème
L'exe fonctionne (envoi d'un mail par exemple)
mais c'est l'avant dernière ligne qui dec... (juste avant
FinProgramme)
C'est un appel à l'Api WriteFile pour renvoyer la page dans le
navigateur de l'internaute
et là : rien... pas de message d'erreur de l'exe.
(j'ai fait des tests de trace qui arrivent jusqu'à cette ligne)

Sur d'autres exe c'est tj cette ligne qui merd...
Les fonctions précédentes fonctionnent.

Et tous ça fonctionnait correctement sur w2000 / iis5

Oscours ! Serge Aubert


"Guillaume Bordier [MS]" a écrit dans
le message de news:
Bonjour,

Avez vous configuré votre IIS pour qu'il accepte le cgi ? , par
défaut, ni IIS 5, ni IIS 6 ne l'accepte.

Si ce n'est pas le cas, voici un extrait de l'aide en ligne.
Configuring CGI Applications
IIS 6.0 supports Common Gateway Interface (CGI) applications. This
topic provides administrative information on installing and
configuring CGI applications on the Web server, and setting the
timeout value for a CGI script.

CGI programs are executed when the Web server receives a URL that
contains the CGI program name and any parameters that it requires.
If your CGI program is compiled into an executable (.exe) file, you
must give the directory that contains the program Execute
permissions so that users can run the program. If your CGI program
is written as a script, for example a Perl script, then you can give
the directory either Execute permissions or Script permissions. To
use Script permissions, the script interpreter must be marked as a
script engine.

Note The IIS_WPG group doesn't have the right to start CGI processes
by default. If you create a new account and add it to the IIS_WPG
group to run a worker process identity, you still must grant this
new account two user rights to start CGI processes. These user
rights are Adjust memory quotas for a process and Replace a process
level token. To modify user rights, see Edit local security settings
or Edit a security setting on a Group Policy object.

Important In order to take a more proactive stance against malicious
users and attackers, IIS is not installed on members of the
Microsoft® Windows® Server 2003 family by default. Furthermore, when
you initially install IIS, the service is installed in a highly
secure and "locked" mode. By default, IIS serves only static
content -- meaning features like ASP, ASP.NET, Server-Side Includes,
WebDAV publishing, and FrontPage® Server Extensions do not work
unless enabled. If you do not enable this functionality after
installing IIS, IIS returns a 404 error. You can serve dynamic
content and enable these features through the Web Service Extensions
node in IIS Manager. Also, if an application extension is not mapped
in IIS, IIS returns a 404 error. To map an extension, see Setting
Application Mappings. For more information on how to troubleshoot
404 errors, including 404.2 and 404.3; issues related to a new
installation of IIS 6.0; or an upgrade from a previous version of
IIS, see Troubleshooting.

If you want to develop new CGI applications, Microsoft provides
several alternatives. For faster execution, consider developing an
Internet Server API (ISAPI) extension instead. For ease of
development, consider developing an ASP.NET application. For more
information, see ASP.NET.

Important You must be a member of the Administrators group on the
local computer to perform the following procedure (or procedures),
or you must have been delegated the appropriate authority. As a
security best practice, log on to your computer using an account
that is not in the Administrators group, and then use the Run as
command to run IIS Manager as an administrator. From the command
prompt, type runas /user:administrative_accountname "mmc
%systemroot%system32inetsrviis.msc".

Installing CGI Applications
To install and configure CGI applications

1.. Set up a directory for your CGI programs. For extra security,
separate your CGI programs from your content files. You do not need
to name the directory Cgi-bin, although you can do so if you want.
For more information, see Using Virtual Directories.
2.. If your CGI programs are scripts, obtain and install the
appropriate script interpreter. For example, to run Perl scripts,
obtain a Perl interpreter. Windows operating systems do not provide
versions of Perl, SED, or AWK. Instead, you must obtain these
interpreters from third-party developers.
3.. If your CGI programs are .exe files, give the directory Execute
permissions. If your CGI programs are scripts, you can give the
directory either Execute permissions or Script permissions. For more
information, see Access Control.

If you choose to give the directory Script permissions, you must
mark the script interpreter as a script engine in the directory
properties. Only interpreters that are marked as script engines are
allowed to execute in the directory. Executable files (.dll and .exe
files) cannot be directly executed; that is, a browser request
cannot launch an executable file on the Web server by including the
program name in the URL. By enabling Scripts only permissions and
selecting the Script engine check box, you can safely put content
files (such as .asp or .gif files) in the same directory as your CGI
scripts. Content files are displayed in the browser and scripts are
executed, but no one can run an unauthorized program and script
commands are not displayed in the browser.
4.. For CGI scripts, create an application mapping between the file
name extension of your script and the script interpreter.

IIS maps file name extensions to an interpreter. For example, if
you are using Perl scripts stored in files with a .pl extension, map
the .pl extension to the program that runs Perl scripts. Map .bat
and .cmd files to the command interpreter (Cmd.exe). For more
information, see Setting Application Mappings.
5.. Set NTFS permissions. If you are using NTFS access permissions,
verify that all users who need to run the program have Execute
permissions for the directory. If your Web site accepts anonymous
users, make sure that the anonymous user (the IUSR_computername
account) has Execute permissions.
IIS supports most of the standard server environment variables.

For greater security, the Web server does not pass the command
interpreter's special characters to a mapped CGI application. By
default, the following characters cannot be included in the URL that
calls the CGI application:

| ( , ; % < >
"viviane" wrote in message
news:cige8a$m5d$
J'ai des exe qui fonctionnaient sur w2000 et iis5
qui ne fonctionnent plus sur w2003 / iis6

En cause l'API WriteFile (envoi de la page) qui semble ne plus
fonctionner
L'exe s'arrête sans erreur mais sans avoir envoyer la page
(erreur cgi, l'appli n'a pas envoyer d'entête....)

Une idée, une piste ?
Merci de votre aide
Serge