Skip to content

Question about marshaling #147

@fralik

Description

@fralik

I am trying to marshal the following call:

 unsigned long
 BaseInitiateShutdown(
     [ in, unique ] PREGISTRY_SERVER_NAME ServerName,
     [ in, unique ] PREG_UNICODE_STRING lpMessage,
     [ in ] unsigned long dwTimeout,
     [ in ] unsigned char bForceAppsClosed,
     [ in ] unsigned char bRebootAfterShutdown
     );

Is it the right thing to do it so:

private final WChar.NullTerminated serverName;
private final RPCUnicodeString.NullTerminated messageToUser;
private final long timeout;
private final boolean forceAppsClosed;
private final boolean rebootAfterShutdown;

public void marshal(PacketOutput packetOut) throws IOException {
    if (packetOut.writeReferentID(this.serverName)) {
        packetOut.writeMarshallable(serverName);
        packetOut.align(Alignment.FOUR);
    }
    // <NDR: struct> [in, unique] PREG_UNICODE_STRING lpMessage
    packetOut.writeMarshallable(this.messageToUser);
    packetOut.align(Alignment.EIGHT);

    // <NDR: unsigned long> [in] unisnged long dwTimeout
    packetOut.writeLong(timeout);
    
    // <NDR: unsigned char> [in] unsigned char bForceAppsClosed
    packetOut.writeBoolean(forceAppsClosed);
    
    // <NDR: unsigned char> [in] unsigned char bRebootAfterShutdown
    packetOut.writeBoolean(rebootAfterShutdown);
}

It seems like the first entity (serverName) writes OK, but the rest is not. Remote PC shuts down OK, but messageToUser and other parameters have no effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions